diff options
Diffstat (limited to 'gnu/java/security/jce')
7 files changed, 37 insertions, 23 deletions
diff --git a/gnu/java/security/jce/hash/MessageDigestAdapter.java b/gnu/java/security/jce/hash/MessageDigestAdapter.java index 2651ecf92..d0947b86f 100644 --- a/gnu/java/security/jce/hash/MessageDigestAdapter.java +++ b/gnu/java/security/jce/hash/MessageDigestAdapter.java @@ -1,5 +1,5 @@ /* MessageDigestAdapter.java -- - Copyright (C) 2001, 2002, 2006 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2006, 2015 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -89,31 +89,37 @@ class MessageDigestAdapter this.adaptee = adaptee; } + @Override public Object clone() { return new MessageDigestAdapter((IMessageDigest) adaptee.clone()); } + @Override public int engineGetDigestLength() { return adaptee.hashSize(); } - + + @Override public void engineUpdate(byte input) { adaptee.update(input); } + @Override public void engineUpdate(byte[] input, int offset, int len) { adaptee.update(input, offset, len); } + @Override public byte[] engineDigest() { return adaptee.digest(); } + @Override public int engineDigest(byte[] buf, int offset, int len) throws DigestException { @@ -126,6 +132,7 @@ class MessageDigestAdapter return result; } + @Override public void engineReset() { adaptee.reset(); diff --git a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java index 971cffe92..9ab5a53f7 100644 --- a/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java +++ b/gnu/java/security/jce/sig/DSSKeyPairGeneratorSpi.java @@ -1,5 +1,5 @@ /* DSSKeyPairGeneratorSpi.java -- - Copyright 2001, 2002, 2006, 2014 Free Software Foundation, Inc. + Copyright 2001, 2002, 2006, 2014, 2015 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -67,11 +67,13 @@ public class DSSKeyPairGeneratorSpi super(Registry.DSS_KPG); } + @Override public void initialize(int keysize, SecureRandom random) { this.initialize(keysize, false, random); } + @Override public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { diff --git a/gnu/java/security/jce/sig/DSSParametersGenerator.java b/gnu/java/security/jce/sig/DSSParametersGenerator.java index 09c138610..cad1fb380 100644 --- a/gnu/java/security/jce/sig/DSSParametersGenerator.java +++ b/gnu/java/security/jce/sig/DSSParametersGenerator.java @@ -1,5 +1,5 @@ /* DSSParametersGenerator.java -- JCE Adapter for a generator of DSS parameters - Copyright (C) 2006 Free Software Foundation, Inc. + Copyright (C) 2006, 2015 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -73,7 +73,7 @@ public class DSSParametersGenerator private FIPS186 fips; // default 0-arguments constructor - + @Override protected void engineInit(int size, SecureRandom random) { if ((size % 64) != 0 || size < 512 || size > 1024) @@ -85,6 +85,7 @@ public class DSSParametersGenerator this.rnd = random; } + @Override protected void engineInit(AlgorithmParameterSpec spec, SecureRandom random) throws InvalidAlgorithmParameterException { @@ -97,6 +98,7 @@ public class DSSParametersGenerator this.engineInit(size, random); } + @Override protected AlgorithmParameters engineGenerateParameters() { if (modulusLength < 1) diff --git a/gnu/java/security/jce/sig/EncodedKeyFactory.java b/gnu/java/security/jce/sig/EncodedKeyFactory.java index df8bb14b1..9f866fa07 100644 --- a/gnu/java/security/jce/sig/EncodedKeyFactory.java +++ b/gnu/java/security/jce/sig/EncodedKeyFactory.java @@ -1,5 +1,5 @@ /* EncodedKeyFactory.java -- JCE Encoded key factory Adapter - Copyright (C) 2006, 2010, 2014 Free Software Foundation, Inc. + Copyright (C) 2006, 2010, 2014, 2015 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -305,7 +305,7 @@ public class EncodedKeyFactory * @return an instance of {@link DSSPublicKey} constructed from the * information in the designated key-specification. */ - private DSSPublicKey decodeDSSPublicKey(DSAPublicKeySpec spec) + private static DSSPublicKey decodeDSSPublicKey(DSAPublicKeySpec spec) { BigInteger p = spec.getP(); BigInteger q = spec.getQ(); @@ -319,7 +319,7 @@ public class EncodedKeyFactory * @return an instance of {@link GnuRSAPublicKey} constructed from the * information in the designated key-specification. */ - private GnuRSAPublicKey decodeRSAPublicKey(RSAPublicKeySpec spec) + private static GnuRSAPublicKey decodeRSAPublicKey(RSAPublicKeySpec spec) { BigInteger n = spec.getModulus(); BigInteger e = spec.getPublicExponent(); @@ -334,7 +334,7 @@ public class EncodedKeyFactory * {@link DHPublicKey} interface exists at run-time, or if an * exception occurs during its instantiation. */ - private DHPublicKey decodeDHPublicKey(DHPublicKeySpec spec) + private static DHPublicKey decodeDHPublicKey(DHPublicKeySpec spec) throws InvalidKeySpecException { BigInteger p = spec.getP(); @@ -355,7 +355,7 @@ public class EncodedKeyFactory * {@link DHPublicKey} interface exists at run-time, or if an * exception occurs during its instantiation. */ - private DHPublicKey decodeDHPublicKey(byte[] encoded) + private static DHPublicKey decodeDHPublicKey(byte[] encoded) throws InvalidKeySpecException { Object obj = invokeValueOf("gnu.javax.crypto.key.dh.GnuDHPublicKey", @@ -368,7 +368,7 @@ public class EncodedKeyFactory * @return an instance of {@link DSSPrivateKey} constructed from the * information in the designated key-specification. */ - private PrivateKey decodeDSSPrivateKey(DSAPrivateKeySpec spec) + private static PrivateKey decodeDSSPrivateKey(DSAPrivateKeySpec spec) { BigInteger p = spec.getP(); BigInteger q = spec.getQ(); @@ -382,7 +382,7 @@ public class EncodedKeyFactory * @return an instance of {@link GnuRSAPrivateKey} constructed from the * information in the designated key-specification. */ - private PrivateKey decodeRSAPrivateKey(RSAPrivateCrtKeySpec spec) + private static PrivateKey decodeRSAPrivateKey(RSAPrivateCrtKeySpec spec) { BigInteger n = spec.getModulus(); BigInteger e = spec.getPublicExponent(); @@ -404,7 +404,7 @@ public class EncodedKeyFactory * {@link DHPrivateKey} interface exists at run-time, or if an * exception occurs during its instantiation. */ - private DHPrivateKey decodeDHPrivateKey(DHPrivateKeySpec spec) + private static DHPrivateKey decodeDHPrivateKey(DHPrivateKeySpec spec) throws InvalidKeySpecException { BigInteger p = spec.getP(); @@ -425,7 +425,7 @@ public class EncodedKeyFactory * {@link DHPrivateKey} interface exists at run-time, or if an * exception occurs during its instantiation. */ - private DHPrivateKey decodeDHPrivateKey(byte[] encoded) + private static DHPrivateKey decodeDHPrivateKey(byte[] encoded) throws InvalidKeySpecException { Object obj = invokeValueOf("gnu.javax.crypto.key.dh.GnuDHPrivateKey", diff --git a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java index cd612aaa5..8ad0c3d8b 100644 --- a/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java +++ b/gnu/java/security/jce/sig/KeyPairGeneratorAdapter.java @@ -83,12 +83,15 @@ public abstract class KeyPairGeneratorAdapter this.adaptee = KeyPairGeneratorFactory.getInstance(localiseName(kpgName)); } + @Override public abstract void initialize(int keysize, SecureRandom random); + @Override public abstract void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException; + @Override public KeyPair generateKeyPair() { if (!adaptee.isInitialized()) @@ -133,7 +136,6 @@ public abstract class KeyPairGeneratorAdapter */ private static String localiseName(String kpgName) { - /** if ("DiffieHellman".equals(kpgName)) return Registry.DH_KPG; if ("DH".equals(kpgName)) @@ -142,7 +144,6 @@ public abstract class KeyPairGeneratorAdapter return Registry.DSA_KPG; if ("RSA".equals(kpgName)) return Registry.RSA_KPG; - */ return kpgName; } diff --git a/gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java b/gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java index fa3cbd5a8..aab10ff98 100644 --- a/gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java +++ b/gnu/java/security/jce/sig/RSAKeyPairGeneratorSpi.java @@ -1,5 +1,5 @@ /* RSAKeyPairGeneratorSpi.java -- JCE RSA KeyPairGenerator Adapter - Copyright (C) 2001, 2002, 2006, 2014 Free Software Foundation, Inc. + Copyright (C) 2001, 2002, 2006, 2014, 2015 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -63,6 +63,7 @@ public class RSAKeyPairGeneratorSpi super(Registry.RSA_KPG); } + @Override public void initialize(int keysize, SecureRandom random) { HashMap<String,Object> attributes = new HashMap<String,Object>(); @@ -75,6 +76,7 @@ public class RSAKeyPairGeneratorSpi adaptee.setup(attributes); } + @Override public void initialize(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException { diff --git a/gnu/java/security/jce/sig/SignatureAdapter.java b/gnu/java/security/jce/sig/SignatureAdapter.java index 7f7c1569f..7fe391ee2 100644 --- a/gnu/java/security/jce/sig/SignatureAdapter.java +++ b/gnu/java/security/jce/sig/SignatureAdapter.java @@ -1,5 +1,5 @@ /* SignatureAdapter.java -- - Copyright 2001, 2002, 2006, 2010, 2014 Free Software Foundation, Inc. + Copyright 2001, 2002, 2006, 2010, 2014, 2015 Free Software Foundation, Inc. This file is a part of GNU Classpath. @@ -39,7 +39,6 @@ exception statement from your version. */ package gnu.java.security.jce.sig; import gnu.java.security.Configuration; -import gnu.java.security.sig.BaseSignature; import gnu.java.security.sig.ISignature; import gnu.java.security.sig.ISignatureCodec; import gnu.java.security.sig.SignatureFactory; @@ -109,6 +108,7 @@ class SignatureAdapter this.codec = codec; } + @Override public Object clone() { return new SignatureAdapter((ISignature) adaptee.clone(), codec); @@ -118,7 +118,7 @@ class SignatureAdapter public void engineInitVerify(PublicKey publicKey) throws InvalidKeyException { HashMap<String,Object> attributes = new HashMap<String,Object>(); - attributes.put(BaseSignature.VERIFIER_KEY, publicKey); + attributes.put(ISignature.VERIFIER_KEY, publicKey); try { adaptee.setupVerify(attributes); @@ -133,7 +133,7 @@ class SignatureAdapter public void engineInitSign(PrivateKey privateKey) throws InvalidKeyException { HashMap<String,Object> attributes = new HashMap<String,Object>(); - attributes.put(BaseSignature.SIGNER_KEY, privateKey); + attributes.put(ISignature.SIGNER_KEY, privateKey); try { adaptee.setupSign(attributes); @@ -149,8 +149,8 @@ class SignatureAdapter throws InvalidKeyException { HashMap<String,Object> attributes = new HashMap<String,Object>(); - attributes.put(BaseSignature.SIGNER_KEY, privateKey); - attributes.put(BaseSignature.SOURCE_OF_RANDOMNESS, random); + attributes.put(ISignature.SIGNER_KEY, privateKey); + attributes.put(ISignature.SOURCE_OF_RANDOMNESS, random); try { adaptee.setupSign(attributes); |
