summaryrefslogtreecommitdiff
path: root/gnu/java/security/sig
diff options
context:
space:
mode:
Diffstat (limited to 'gnu/java/security/sig')
-rw-r--r--gnu/java/security/sig/SignatureCodecFactory.java6
-rw-r--r--gnu/java/security/sig/dss/DSSSignature.java4
-rw-r--r--gnu/java/security/sig/dss/DSSSignatureRawCodec.java6
-rw-r--r--gnu/java/security/sig/dss/DSSSignatureX509Codec.java5
-rw-r--r--gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java4
-rw-r--r--gnu/java/security/sig/rsa/EMSA_PSS.java4
-rw-r--r--gnu/java/security/sig/rsa/RSA.java1
-rw-r--r--gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java7
-rw-r--r--gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java5
-rw-r--r--gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java5
-rw-r--r--gnu/java/security/sig/rsa/RSAPSSSignature.java12
-rw-r--r--gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java5
12 files changed, 48 insertions, 16 deletions
diff --git a/gnu/java/security/sig/SignatureCodecFactory.java b/gnu/java/security/sig/SignatureCodecFactory.java
index 7bf04ff40..59ef812ed 100644
--- a/gnu/java/security/sig/SignatureCodecFactory.java
+++ b/gnu/java/security/sig/SignatureCodecFactory.java
@@ -1,5 +1,5 @@
/* SignatureCodecFactory.java -- Factory to instantiate Signature codecs
- Copyright (C) 2006, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -145,9 +145,9 @@ public class SignatureCodecFactory
return getRawCodec(name);
case Registry.X509_ENCODING_ID:
return getX509Codec(name);
+ default:
+ return null;
}
-
- return null;
}
/**
diff --git a/gnu/java/security/sig/dss/DSSSignature.java b/gnu/java/security/sig/dss/DSSSignature.java
index 5e098e337..9b65df54e 100644
--- a/gnu/java/security/sig/dss/DSSSignature.java
+++ b/gnu/java/security/sig/dss/DSSSignature.java
@@ -220,7 +220,7 @@ public class DSSSignature
* @return an object encapsulating the DSS signature pair <code>r</code> and
* <code>s</code>.
*/
- private Object encodeSignature(BigInteger r, BigInteger s)
+ private static Object encodeSignature(BigInteger r, BigInteger s)
{
return new BigInteger[] { r, s };
}
@@ -231,7 +231,7 @@ public class DSSSignature
*
* @return the DSS signature pair <code>r</code> and <code>s</code>.
*/
- private BigInteger[] decodeSignature(Object signature)
+ private static BigInteger[] decodeSignature(Object signature)
{
return (BigInteger[]) signature;
}
diff --git a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
index 169f84bd1..1c21d5ef6 100644
--- a/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
+++ b/gnu/java/security/sig/dss/DSSSignatureRawCodec.java
@@ -1,5 +1,6 @@
/* DSSSignatureRawCodec.java --
- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2015
+ Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -51,6 +52,7 @@ import java.math.BigInteger;
public class DSSSignatureRawCodec
implements ISignatureCodec
{
+ @Override
public int getFormatID()
{
return RAW_FORMAT;
@@ -86,6 +88,7 @@ public class DSSSignatureRawCodec
* @exception IllegalArgumentException if the designated signature is not a
* DSS (Digital Signature Standard) one.
*/
+ @Override
public byte[] encodeSignature(Object signature)
{
BigInteger r, s;
@@ -126,6 +129,7 @@ public class DSSSignatureRawCodec
return baos.toByteArray();
}
+ @Override
public Object decodeSignature(byte[] k)
{
// magic
diff --git a/gnu/java/security/sig/dss/DSSSignatureX509Codec.java b/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
index f7aeda4f0..6d97ccac5 100644
--- a/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
+++ b/gnu/java/security/sig/dss/DSSSignatureX509Codec.java
@@ -1,5 +1,5 @@
/* DSSSignatureX509Codec.java -- X.509 encoder/decoder for DSS signatures
- Copyright (C) 2006, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2014, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -103,6 +103,7 @@ public class DSSSignatureX509Codec
{
// implicit 0-arguments constructor
+ @Override
public int getFormatID()
{
return Registry.X509_ENCODING_ID;
@@ -123,6 +124,7 @@ public class DSSSignatureX509Codec
* @throws InvalidParameterException if an exception occurs during the
* marshalling process.
*/
+ @Override
public byte[] encodeSignature(Object signature)
{
BigInteger[] rs = (BigInteger[]) signature;
@@ -162,6 +164,7 @@ public class DSSSignatureX509Codec
* @throw InvalidParameterException if an exception occurs during the
* unmarshalling process.
*/
+ @Override
public Object decodeSignature(byte[] input)
{
if (input == null)
diff --git a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
index fad0ac552..905413595 100644
--- a/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
+++ b/gnu/java/security/sig/rsa/EMSA_PKCS1_V1_5.java
@@ -1,5 +1,6 @@
/* EMSA_PKCS1_V1_5.java --
- Copyright (C) 2003, 2006, 2014 Free Software Foundation, Inc.
+ Copyright (C) 2003, 2006, 2014, 2015
+ Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -171,6 +172,7 @@ public class EMSA_PKCS1_V1_5
return new EMSA_PKCS1_V1_5(hash);
}
+ @Override
public Object clone()
{
return getInstance(hash.name());
diff --git a/gnu/java/security/sig/rsa/EMSA_PSS.java b/gnu/java/security/sig/rsa/EMSA_PSS.java
index 7a8e591a3..38a0af1ff 100644
--- a/gnu/java/security/sig/rsa/EMSA_PSS.java
+++ b/gnu/java/security/sig/rsa/EMSA_PSS.java
@@ -1,5 +1,6 @@
/* EMSA_PSS.java --
- Copyright (C) 2001, 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2010, 2015
+ Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -109,6 +110,7 @@ public class EMSA_PSS
return new EMSA_PSS(hash);
}
+ @Override
public Object clone()
{
return getInstance(hash.name());
diff --git a/gnu/java/security/sig/rsa/RSA.java b/gnu/java/security/sig/rsa/RSA.java
index 343b2cf65..9a99e2404 100644
--- a/gnu/java/security/sig/rsa/RSA.java
+++ b/gnu/java/security/sig/rsa/RSA.java
@@ -242,6 +242,7 @@ public class RSA
return result;
}
+ @SuppressWarnings("null") // r != null if rsaBlinding = true
private static final BigInteger RSADP(final RSAPrivateKey K, BigInteger c)
{
// 1. If the representative c is not between 0 and n - 1, output
diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
index 1420331de..9e350b50e 100644
--- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
+++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5Signature.java
@@ -1,5 +1,5 @@
/* RSAPKCS1V1_5Signature.java --
- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2015 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -111,11 +111,13 @@ public class RSAPKCS1V1_5Signature
this.pkcs1 = (EMSA_PKCS1_V1_5) that.pkcs1.clone();
}
+ @Override
public Object clone()
{
return new RSAPKCS1V1_5Signature(this);
}
+ @Override
protected void setupForVerification(final PublicKey k)
throws IllegalArgumentException
{
@@ -125,6 +127,7 @@ public class RSAPKCS1V1_5Signature
publicKey = k;
}
+ @Override
protected void setupForSigning(final PrivateKey k)
throws IllegalArgumentException
{
@@ -134,6 +137,7 @@ public class RSAPKCS1V1_5Signature
privateKey = k;
}
+ @Override
protected Object generateSignature() throws IllegalStateException
{
// 1. EMSA-PKCS1-v1_5 encoding: Apply the EMSA-PKCS1-v1_5 encoding
@@ -163,6 +167,7 @@ public class RSAPKCS1V1_5Signature
return RSA.I2OSP(s, k);
}
+ @Override
protected boolean verifySignature(final Object sig)
throws IllegalStateException
{
diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
index 548dc3deb..f1e09718a 100644
--- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
+++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureRawCodec.java
@@ -1,5 +1,5 @@
/* RSAPKCS1V1_5SignatureRawCodec.java -- Raw RSA PKCS1 v1.5 signature codeec
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -50,6 +50,7 @@ import gnu.java.security.sig.ISignatureCodec;
public class RSAPKCS1V1_5SignatureRawCodec
implements ISignatureCodec
{
+ @Override
public int getFormatID()
{
return RAW_FORMAT;
@@ -79,6 +80,7 @@ public class RSAPKCS1V1_5SignatureRawCodec
* @exception IllegalArgumentException if the designated signature is not an
* RSA-PKCS#1 (v1.5) one.
*/
+ @Override
public byte[] encodeSignature(Object signature)
{
byte[] buffer;
@@ -124,6 +126,7 @@ public class RSAPKCS1V1_5SignatureRawCodec
* with the right <i>magic</i> characters, or if the <i>version</i>
* is not supported.
*/
+ @Override
public Object decodeSignature(byte[] input)
{
// magic
diff --git a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
index ee8586f7d..c6fd5d340 100644
--- a/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
+++ b/gnu/java/security/sig/rsa/RSAPKCS1V1_5SignatureX509Codec.java
@@ -1,5 +1,5 @@
/* RSAPSSSignatureX509Codec.java -- X.509 encoder/decoder for RSA signatures
- Copyright (C) 2006 Free Software Foundation, Inc.
+ Copyright (C) 2006, 2015 Free Software Foundation, Inc.
This file is part of GNU Classpath.
@@ -87,6 +87,7 @@ public class RSAPKCS1V1_5SignatureX509Codec
{
// default 0-arguments constructor
+ @Override
public int getFormatID()
{
return Registry.X509_ENCODING_ID;
@@ -103,6 +104,7 @@ public class RSAPKCS1V1_5SignatureX509Codec
* @return the raw bytes of an RSA signature which could be then used as the
* contents of a BIT STRING as per rfc-2459.
*/
+ @Override
public byte[] encodeSignature(Object signature)
{
byte[] result = (byte[]) signature;
@@ -118,6 +120,7 @@ public class RSAPKCS1V1_5SignatureX509Codec
* case of RSA PKCS1 (v1.5) this is the same as the input.
* @throw InvalidParameterException if the <code>input</code> array is null.
*/
+ @Override
public Object decodeSignature(byte[] input)
{
if (input == null)
diff --git a/gnu/java/security/sig/rsa/RSAPSSSignature.java b/gnu/java/security/sig/rsa/RSAPSSSignature.java
index 7b042f77f..f9aaade48 100644
--- a/gnu/java/security/sig/rsa/RSAPSSSignature.java
+++ b/gnu/java/security/sig/rsa/RSAPSSSignature.java
@@ -1,5 +1,6 @@
/* RSAPSSSignature.java --
- Copyright (C) 2001, 2002, 2003, 2006, 2010 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2010, 2015
+ Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -136,28 +137,32 @@ public class RSAPSSSignature
this.pss = (EMSA_PSS) that.pss.clone();
}
+ @Override
public Object clone()
{
return new RSAPSSSignature(this);
}
+ @Override
protected void setupForVerification(PublicKey k)
throws IllegalArgumentException
{
if (! (k instanceof RSAPublicKey))
throw new IllegalArgumentException();
- publicKey = (RSAPublicKey) k;
+ publicKey = k;
}
+ @Override
protected void setupForSigning(PrivateKey k) throws IllegalArgumentException
{
if (! (k instanceof RSAPrivateKey))
throw new IllegalArgumentException();
- privateKey = (RSAPrivateKey) k;
+ privateKey = k;
}
+ @Override
protected Object generateSignature() throws IllegalStateException
{
// 1. Apply the EMSA-PSS encoding operation to the message M to produce an
@@ -189,6 +194,7 @@ public class RSAPSSSignature
return RSA.I2OSP(s, k);
}
+ @Override
protected boolean verifySignature(Object sig) throws IllegalStateException
{
if (publicKey == null)
diff --git a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
index b147ea3ea..7b1166291 100644
--- a/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
+++ b/gnu/java/security/sig/rsa/RSAPSSSignatureRawCodec.java
@@ -1,5 +1,5 @@
/* RSAPSSSignatureRawCodec.java --
- Copyright (C) 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
+ Copyright (C) 2001, 2002, 2003, 2006, 2015 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -52,6 +52,7 @@ public class RSAPSSSignatureRawCodec
{
// implicit 0-arguments constructor
+ @Override
public int getFormatID()
{
return RAW_FORMAT;
@@ -80,6 +81,7 @@ public class RSAPSSSignatureRawCodec
* @exception IllegalArgumentException if the designated signature is not an
* RSA-PSS one.
*/
+ @Override
public byte[] encodeSignature(Object signature)
{
byte[] buffer;
@@ -109,6 +111,7 @@ public class RSAPSSSignatureRawCodec
return baos.toByteArray();
}
+ @Override
public Object decodeSignature(byte[] k)
{
// magic