summaryrefslogtreecommitdiff
path: root/gnu/javax/crypto/jce
diff options
context:
space:
mode:
authorRaif S. Naffah <raif@swiftdsl.com.au>2006-06-26 13:30:13 +0000
committerRaif S. Naffah <raif@swiftdsl.com.au>2006-06-26 13:30:13 +0000
commitc948fa4733757a5412a7a9cd2d3d3f75549e118c (patch)
tree6ec0b9ad353d6b260f2eb3e3bf3447f74ee879c8 /gnu/javax/crypto/jce
parent7fe55a493c6d51fd7653d5caf2e61e17a6ee03d2 (diff)
downloadclasspath-c948fa4733757a5412a7a9cd2d3d3f75549e118c.tar.gz
2006-06-26 Raif S. Naffah <raif@swiftdsl.com.au>
* gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java: Source formatting. * gnu/javax/crypto/jce/GnuSasl.java: Likewise. * gnu/javax/crypto/jce/GnuCrypto.java: Likewise. * gnu/javax/crypto/jce/DiffieHellmanImpl.java: Likewise. * gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java: Likewise. * gnu/javax/crypto/jce/spec/TMMHParameterSpec.java: Likewise. * gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java: Likewise. * gnu/javax/crypto/jce/sig/DHKeyFactory.java: Likewise. * gnu/javax/crypto/jce/prng/UMacRandomSpi.java: Likewise. * gnu/javax/crypto/jce/prng/ICMRandomSpi.java: Likewise. * gnu/javax/crypto/jce/prng/FortunaImpl.java: Likewise. * gnu/javax/crypto/jce/prng/CSPRNGSpi.java: Likewise. * gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java: Likewise. * gnu/javax/crypto/jce/params/DERWriter.java: Likewise. * gnu/javax/crypto/jce/params/DERReader.java: Likewise. * gnu/javax/crypto/jce/params/DEREncodingException.java: Likewise. * gnu/javax/crypto/jce/params/BlockCipherParameters.java: Likewise. * gnu/javax/crypto/jce/mac/UMac32Spi.java: Likewise. * gnu/javax/crypto/jce/mac/UHash32Spi.java: Likewise. * gnu/javax/crypto/jce/mac/TMMH16Spi.java: Likewise. * gnu/javax/crypto/jce/mac/OMacTwofishImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacSquareImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacSerpentImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacKhazadImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacDESImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacCast5Impl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java: Likewise. * gnu/javax/crypto/jce/mac/OMacAnubisImpl.java: Likewise. * gnu/javax/crypto/jce/mac/MacAdapter.java: Likewise. * gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacTigerSpi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacSHA512Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacSHA384Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacSHA256Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacSHA160Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacMD5Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacMD4Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacMD2Spi.java: Likewise. * gnu/javax/crypto/jce/mac/HMacHavalSpi.java: Likewise. * gnu/javax/crypto/jce/keyring/GnuKeyring.java: Likewise. * gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java: Likewise. * gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java: Likewise. * gnu/javax/crypto/jce/cipher/TwofishSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/TripleDESSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/SquareSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/SerpentSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/RijndaelSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/PBES2.java: Likewise. * gnu/javax/crypto/jce/cipher/NullCipherSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/KhazadSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/DESSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/CipherAdapter.java: Likewise. * gnu/javax/crypto/jce/cipher/Cast5Spi.java: Likewise. * gnu/javax/crypto/jce/cipher/BlowfishSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/ARCFourSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/AnubisSpi.java: Likewise. * gnu/javax/crypto/jce/cipher/AESSpi.java: Likewise.
Diffstat (limited to 'gnu/javax/crypto/jce')
-rw-r--r--gnu/javax/crypto/jce/DiffieHellmanImpl.java5
-rw-r--r--gnu/javax/crypto/jce/GnuCrypto.java159
-rw-r--r--gnu/javax/crypto/jce/GnuSasl.java94
-rw-r--r--gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java75
-rw-r--r--gnu/javax/crypto/jce/cipher/AESSpi.java24
-rw-r--r--gnu/javax/crypto/jce/cipher/ARCFourSpi.java49
-rw-r--r--gnu/javax/crypto/jce/cipher/AnubisSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/BlowfishSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/Cast5Spi.java20
-rw-r--r--gnu/javax/crypto/jce/cipher/CipherAdapter.java191
-rw-r--r--gnu/javax/crypto/jce/cipher/DESSpi.java11
-rw-r--r--gnu/javax/crypto/jce/cipher/KhazadSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/NullCipherSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/PBES2.java511
-rw-r--r--gnu/javax/crypto/jce/cipher/RijndaelSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/SerpentSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/SquareSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/TripleDESSpi.java7
-rw-r--r--gnu/javax/crypto/jce/cipher/TwofishSpi.java7
-rw-r--r--gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java11
-rw-r--r--gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java3
-rw-r--r--gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java11
-rw-r--r--gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java3
-rw-r--r--gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java11
-rw-r--r--gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java3
-rw-r--r--gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java31
-rw-r--r--gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java28
-rw-r--r--gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java28
-rw-r--r--gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java4
-rw-r--r--gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java4
-rw-r--r--gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java34
-rw-r--r--gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java56
-rw-r--r--gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java4
-rw-r--r--gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java4
-rw-r--r--gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java12
-rw-r--r--gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java4
-rw-r--r--gnu/javax/crypto/jce/keyring/GnuKeyring.java10
-rw-r--r--gnu/javax/crypto/jce/mac/HMacHavalSpi.java21
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD2Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD4Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacMD5Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA160Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA256Spi.java21
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA384Spi.java21
-rw-r--r--gnu/javax/crypto/jce/mac/HMacSHA512Spi.java21
-rw-r--r--gnu/javax/crypto/jce/mac/HMacTigerSpi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/MacAdapter.java44
-rw-r--r--gnu/javax/crypto/jce/mac/OMacAnubisImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacCast5Impl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacDESImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacImpl.java42
-rw-r--r--gnu/javax/crypto/jce/mac/OMacKhazadImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacSerpentImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacSquareImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/OMacTwofishImpl.java9
-rw-r--r--gnu/javax/crypto/jce/mac/TMMH16Spi.java16
-rw-r--r--gnu/javax/crypto/jce/mac/UHash32Spi.java7
-rw-r--r--gnu/javax/crypto/jce/mac/UMac32Spi.java22
-rw-r--r--gnu/javax/crypto/jce/params/BlockCipherParameters.java137
-rw-r--r--gnu/javax/crypto/jce/params/DEREncodingException.java5
-rw-r--r--gnu/javax/crypto/jce/params/DERReader.java35
-rw-r--r--gnu/javax/crypto/jce/params/DERWriter.java29
-rw-r--r--gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java33
-rw-r--r--gnu/javax/crypto/jce/prng/CSPRNGSpi.java35
-rw-r--r--gnu/javax/crypto/jce/prng/FortunaImpl.java26
-rw-r--r--gnu/javax/crypto/jce/prng/ICMRandomSpi.java46
-rw-r--r--gnu/javax/crypto/jce/prng/UMacRandomSpi.java49
-rw-r--r--gnu/javax/crypto/jce/sig/DHKeyFactory.java29
-rw-r--r--gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java57
-rw-r--r--gnu/javax/crypto/jce/spec/TMMHParameterSpec.java38
-rw-r--r--gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java25
82 files changed, 936 insertions, 1492 deletions
diff --git a/gnu/javax/crypto/jce/DiffieHellmanImpl.java b/gnu/javax/crypto/jce/DiffieHellmanImpl.java
index 02761477a..cb1748a63 100644
--- a/gnu/javax/crypto/jce/DiffieHellmanImpl.java
+++ b/gnu/javax/crypto/jce/DiffieHellmanImpl.java
@@ -99,8 +99,8 @@ public final class DiffieHellmanImpl
result = pub.getY().modPow(key.getX(), s1.getP());
if (! lastPhase)
- throw new IllegalArgumentException("This key-agreement MUST be concluded in one step only");
-
+ throw new IllegalArgumentException(
+ "This key-agreement MUST be concluded in one step only");
last_phase_done = true;
return null;
}
@@ -117,7 +117,6 @@ public final class DiffieHellmanImpl
System.arraycopy(buf, 1, buf2, 0, buf2.length);
buf = buf2;
}
-
return buf;
}
diff --git a/gnu/javax/crypto/jce/GnuCrypto.java b/gnu/javax/crypto/jce/GnuCrypto.java
index b0e73b132..fd5cefe4a 100644
--- a/gnu/javax/crypto/jce/GnuCrypto.java
+++ b/gnu/javax/crypto/jce/GnuCrypto.java
@@ -49,24 +49,14 @@ import java.util.HashSet;
import java.util.Set;
/**
- * <p>The GNU Crypto implementation of the Java Cryptographic Extension (JCE)
- * Provider.</p>
- *
+ * The additional GNU algorithm implementation as a Java Cryptographic Extension
+ * (JCE) Provider.
+ *
* @see java.security.Provider
*/
-public final class GnuCrypto extends Provider
+public final class GnuCrypto
+ extends Provider
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -------------------------------------------------------------------------
-
- /**
- * <p>The <a href="http://www.gnu.org/software/gnu-crypto/">GNU Crypto</a>
- * Provider.</p>
- */
public GnuCrypto()
{
super(Registry.GNU_CRYPTO, 2.1, "GNU Crypto JCE Provider");
@@ -120,8 +110,7 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.AES.class.getName());
put("Cipher.PBEWithHMacHavalAndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacHavalAndBlowfish",
+ put("Cipher.PBEWithHMacHavalAndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Blowfish.class.getName());
put("Cipher.PBEWithHMacHavalAndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Cast5.class.getName());
@@ -133,8 +122,7 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Serpent.class.getName());
put("Cipher.PBEWithHMacHavalAndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Square.class.getName());
- put(
- "Cipher.PBEWithHMacHavalAndTripleDES",
+ put("Cipher.PBEWithHMacHavalAndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.TripleDES.class.getName());
put("Cipher.PBEWithHMacHavalAndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacHaval.Twofish.class.getName());
@@ -228,8 +216,7 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.AES.class.getName());
put("Cipher.PBEWithHMacSHA256AndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacSHA256AndBlowfish",
+ put("Cipher.PBEWithHMacSHA256AndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Blowfish.class.getName());
put("Cipher.PBEWithHMacSHA256AndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Cast5.class.getName());
@@ -237,24 +224,20 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.DES.class.getName());
put("Cipher.PBEWithHMacSHA256AndKhazad",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Khazad.class.getName());
- put(
- "Cipher.PBEWithHMacSHA256AndSerpent",
+ put("Cipher.PBEWithHMacSHA256AndSerpent",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Serpent.class.getName());
put("Cipher.PBEWithHMacSHA256AndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Square.class.getName());
- put(
- "Cipher.PBEWithHMacSHA256AndTripleDES",
+ put("Cipher.PBEWithHMacSHA256AndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.TripleDES.class.getName());
- put(
- "Cipher.PBEWithHMacSHA256AndTwofish",
+ put("Cipher.PBEWithHMacSHA256AndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA256.Twofish.class.getName());
put("Cipher.PBEWithHMacSHA384AndAES",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.AES.class.getName());
put("Cipher.PBEWithHMacSHA384AndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacSHA384AndBlowfish",
+ put("Cipher.PBEWithHMacSHA384AndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Blowfish.class.getName());
put("Cipher.PBEWithHMacSHA384AndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Cast5.class.getName());
@@ -262,24 +245,20 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.DES.class.getName());
put("Cipher.PBEWithHMacSHA384AndKhazad",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Khazad.class.getName());
- put(
- "Cipher.PBEWithHMacSHA384AndSerpent",
+ put("Cipher.PBEWithHMacSHA384AndSerpent",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Serpent.class.getName());
put("Cipher.PBEWithHMacSHA384AndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Square.class.getName());
- put(
- "Cipher.PBEWithHMacSHA384AndTripleDES",
+ put("Cipher.PBEWithHMacSHA384AndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.TripleDES.class.getName());
- put(
- "Cipher.PBEWithHMacSHA384AndTwofish",
+ put("Cipher.PBEWithHMacSHA384AndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA384.Twofish.class.getName());
put("Cipher.PBEWithHMacSHA512AndAES",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.AES.class.getName());
put("Cipher.PBEWithHMacSHA512AndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacSHA512AndBlowfish",
+ put("Cipher.PBEWithHMacSHA512AndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Blowfish.class.getName());
put("Cipher.PBEWithHMacSHA512AndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Cast5.class.getName());
@@ -287,24 +266,20 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.DES.class.getName());
put("Cipher.PBEWithHMacSHA512AndKhazad",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Khazad.class.getName());
- put(
- "Cipher.PBEWithHMacSHA512AndSerpent",
+ put("Cipher.PBEWithHMacSHA512AndSerpent",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Serpent.class.getName());
put("Cipher.PBEWithHMacSHA512AndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Square.class.getName());
- put(
- "Cipher.PBEWithHMacSHA512AndTripleDES",
+ put("Cipher.PBEWithHMacSHA512AndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.TripleDES.class.getName());
- put(
- "Cipher.PBEWithHMacSHA512AndTwofish",
+ put("Cipher.PBEWithHMacSHA512AndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacSHA512.Twofish.class.getName());
put("Cipher.PBEWithHMacTigerAndAES",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.AES.class.getName());
put("Cipher.PBEWithHMacTigerAndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacTigerAndBlowfish",
+ put("Cipher.PBEWithHMacTigerAndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Blowfish.class.getName());
put("Cipher.PBEWithHMacTigerAndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Cast5.class.getName());
@@ -316,44 +291,34 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Serpent.class.getName());
put("Cipher.PBEWithHMacTigerAndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Square.class.getName());
- put(
- "Cipher.PBEWithHMacTigerAndTripleDES",
+ put("Cipher.PBEWithHMacTigerAndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.TripleDES.class.getName());
put("Cipher.PBEWithHMacTigerAndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacTiger.Twofish.class.getName());
put("Cipher.PBEWithHMacWhirlpoolAndAES",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.AES.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndAnubis",
+ put("Cipher.PBEWithHMacWhirlpoolAndAnubis",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Anubis.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndBlowfish",
+ put("Cipher.PBEWithHMacWhirlpoolAndBlowfish",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Blowfish.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndCast5",
+ put("Cipher.PBEWithHMacWhirlpoolAndCast5",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Cast5.class.getName());
put("Cipher.PBEWithHMacWhirlpoolAndDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.DES.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndKhazad",
+ put("Cipher.PBEWithHMacWhirlpoolAndKhazad",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Khazad.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndSerpent",
+ put("Cipher.PBEWithHMacWhirlpoolAndSerpent",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Serpent.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndSquare",
+ put("Cipher.PBEWithHMacWhirlpoolAndSquare",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Square.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndTripleDES",
+ put("Cipher.PBEWithHMacWhirlpoolAndTripleDES",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.TripleDES.class.getName());
- put(
- "Cipher.PBEWithHMacWhirlpoolAndTwofish",
+ put("Cipher.PBEWithHMacWhirlpoolAndTwofish",
gnu.javax.crypto.jce.cipher.PBES2.HMacWhirlpool.Twofish.class.getName());
// SecretKeyFactory interface to PBKDF2.
- put(
- "SecretKeyFactory.PBKDF2WithHMacHaval",
+ put("SecretKeyFactory.PBKDF2WithHMacHaval",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacHaval.class.getName());
put("SecretKeyFactory.PBKDF2WithHMacMD2",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD2.class.getName());
@@ -361,30 +326,23 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD4.class.getName());
put("SecretKeyFactory.PBKDF2WithHMacMD5",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacMD5.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacSHA1",
+ put("SecretKeyFactory.PBKDF2WithHMacSHA1",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA1.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacSHA256",
+ put("SecretKeyFactory.PBKDF2WithHMacSHA256",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA256.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacSHA384",
+ put("SecretKeyFactory.PBKDF2WithHMacSHA384",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA384.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacSHA512",
+ put("SecretKeyFactory.PBKDF2WithHMacSHA512",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacSHA512.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacTiger",
+ put("SecretKeyFactory.PBKDF2WithHMacTiger",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacTiger.class.getName());
- put(
- "SecretKeyFactory.PBKDF2WithHMacWhirlpool",
+ put("SecretKeyFactory.PBKDF2WithHMacWhirlpool",
gnu.javax.crypto.jce.PBKDF2SecretKeyFactory.HMacWhirlpool.class.getName());
// Simple SecretKeyFactory implementations.
put("SecretKeyFactory.Anubis",
gnu.javax.crypto.jce.key.AnubisSecretKeyFactoryImpl.class.getName());
- put(
- "SecretKeyFactory.Blowfish",
+ put("SecretKeyFactory.Blowfish",
gnu.javax.crypto.jce.key.BlowfishSecretKeyFactoryImpl.class.getName());
put("SecretKeyFactory.Cast5",
gnu.javax.crypto.jce.key.Cast5SecretKeyFactoryImpl.class.getName());
@@ -392,11 +350,9 @@ public final class GnuCrypto extends Provider
gnu.javax.crypto.jce.key.DESSecretKeyFactoryImpl.class.getName());
put("SecretKeyFactory.Khazad",
gnu.javax.crypto.jce.key.KhazadSecretKeyFactoryImpl.class.getName());
- put(
- "SecretKeyFactory.Rijndael",
+ put("SecretKeyFactory.Rijndael",
gnu.javax.crypto.jce.key.RijndaelSecretKeyFactoryImpl.class.getName());
- put(
- "SecretKeyFactory.Serpent",
+ put("SecretKeyFactory.Serpent",
gnu.javax.crypto.jce.key.SerpentSecretKeyFactoryImpl.class.getName());
put("SecretKeyFactory.Square",
gnu.javax.crypto.jce.key.SquareSecretKeyFactoryImpl.class.getName());
@@ -410,7 +366,6 @@ public final class GnuCrypto extends Provider
put("AlgorithmParameters.BlockCipherParameters",
gnu.javax.crypto.jce.params.BlockCipherParameters.class.getName());
-
// KeyGenerator Adapter implementations
put("KeyGenerator.Anubis",
gnu.javax.crypto.jce.key.AnubisKeyGeneratorImpl.class.getName());
@@ -541,19 +496,25 @@ public final class GnuCrypto extends Provider
put("Alg.Alias.Cipher.RSA", "RSAES-PKCS1-v1_5");
// SecureRandom
- put("SecureRandom.ARCFOUR", gnu.javax.crypto.jce.prng.ARCFourRandomSpi.class.getName());
+ put("SecureRandom.ARCFOUR",
+ gnu.javax.crypto.jce.prng.ARCFourRandomSpi.class.getName());
put("SecureRandom.ARCFOUR ImplementedIn", "Software");
- put("SecureRandom.CSPRNG", gnu.javax.crypto.jce.prng.CSPRNGSpi.class.getName());
+ put("SecureRandom.CSPRNG",
+ gnu.javax.crypto.jce.prng.CSPRNGSpi.class.getName());
put("SecureRandom.CSPRNG ImplementedIn", "Software");
- put("SecureRandom.ICM", gnu.javax.crypto.jce.prng.ICMRandomSpi.class.getName());
+ put("SecureRandom.ICM",
+ gnu.javax.crypto.jce.prng.ICMRandomSpi.class.getName());
put("SecureRandom.ICM ImplementedIn", "Software");
- put("SecureRandom.UMAC-KDF", gnu.javax.crypto.jce.prng.UMacRandomSpi.class.getName());
+ put("SecureRandom.UMAC-KDF",
+ gnu.javax.crypto.jce.prng.UMacRandomSpi.class.getName());
put("SecureRandom.UMAC-KDF ImplementedIn", "Software");
- put("SecureRandom.Fortuna", gnu.javax.crypto.jce.prng.FortunaImpl.class.getName ());
+ put("SecureRandom.Fortuna",
+ gnu.javax.crypto.jce.prng.FortunaImpl.class.getName());
put("SecureRandom.Fortuna ImplementedIn", "Software");
// KeyStore
- put("KeyStore.GKR", gnu.javax.crypto.jce.keyring.GnuKeyring.class.getName());
+ put("KeyStore.GKR",
+ gnu.javax.crypto.jce.keyring.GnuKeyring.class.getName());
put("Alg.Alias.KeyStore.GnuKeyring", "GKR");
// KeyPairGenerator ---------------------------------------------------
@@ -587,13 +548,10 @@ public final class GnuCrypto extends Provider
});
}
- // Class methods
- // -------------------------------------------------------------------------
-
/**
- * <p>Returns a {@link Set} of names of symmetric key block cipher algorithms
- * available from this {@link Provider}.</p>
- *
+ * Returns a {@link Set} of names of symmetric key block cipher algorithms
+ * available from this {@link Provider}.
+ *
* @return a {@link Set} of cipher names (Strings).
*/
public static final Set getCipherNames()
@@ -605,16 +563,13 @@ public final class GnuCrypto extends Provider
}
/**
- * <p>Returns a {@link Set} of names of MAC algorithms available from
- * this {@link Provider}.</p>
- *
+ * Returns a {@link Set} of names of MAC algorithms available from this
+ * {@link Provider}.
+ *
* @return a {@link Set} of MAC names (Strings).
*/
public static final Set getMacNames()
{
return MacFactory.getNames();
}
-
- // Instance methods
- // -------------------------------------------------------------------------
}
diff --git a/gnu/javax/crypto/jce/GnuSasl.java b/gnu/javax/crypto/jce/GnuSasl.java
index 6ee86ae19..923b40a5f 100644
--- a/gnu/javax/crypto/jce/GnuSasl.java
+++ b/gnu/javax/crypto/jce/GnuSasl.java
@@ -47,53 +47,63 @@ import java.security.PrivilegedAction;
import java.security.Provider;
import java.util.Set;
-public final class GnuSasl extends Provider
+public final class GnuSasl
+ extends Provider
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public GnuSasl()
{
- super (Registry.GNU_SASL, 2.1, "GNU Crypto SASL Provider");
+ super(Registry.GNU_SASL, 2.1, "GNU SASL Provider");
- AccessController.doPrivileged (new PrivilegedAction()
+ AccessController.doPrivileged(new PrivilegedAction()
+ {
+ public Object run()
{
- public Object run()
- {
- // SASL Client and Server mechanisms
- put("SaslClientFactory.ANONYMOUS", gnu.javax.crypto.sasl.ClientFactory.class.getName());
- put("SaslClientFactory.PLAIN", gnu.javax.crypto.sasl.ClientFactory.class.getName());
- put("SaslClientFactory.CRAM-MD5", gnu.javax.crypto.sasl.ClientFactory.class.getName());
- put("SaslClientFactory.SRP", gnu.javax.crypto.sasl.ClientFactory.class.getName());
-
- put("SaslServerFactory.ANONYMOUS", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.PLAIN", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.CRAM-MD5", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-MD5", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-SHA-160", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-RIPEMD128", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-RIPEMD160", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-TIGER", gnu.javax.crypto.sasl.ServerFactory.class.getName());
- put("SaslServerFactory.SRP-WHIRLPOOL", gnu.javax.crypto.sasl.ServerFactory.class.getName());
-
- put("Alg.Alias.SaslServerFactory.SRP-SHS", "SRP-SHA-160");
- put("Alg.Alias.SaslServerFactory.SRP-SHA", "SRP-SHA-160");
- put("Alg.Alias.SaslServerFactory.SRP-SHA1", "SRP-SHA-160");
- put("Alg.Alias.SaslServerFactory.SRP-SHA-1", "SRP-SHA-160");
- put("Alg.Alias.SaslServerFactory.SRP-SHA160", "SRP-SHA-160");
- put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-128", "SRP-RIPEMD128");
- put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-160", "SRP-RIPEMD160");
-
- return null;
- }
- });
+ // SASL Client and Server mechanisms
+ put("SaslClientFactory.ANONYMOUS",
+ gnu.javax.crypto.sasl.ClientFactory.class.getName());
+ put("SaslClientFactory.PLAIN",
+ gnu.javax.crypto.sasl.ClientFactory.class.getName());
+ put("SaslClientFactory.CRAM-MD5",
+ gnu.javax.crypto.sasl.ClientFactory.class.getName());
+ put("SaslClientFactory.SRP",
+ gnu.javax.crypto.sasl.ClientFactory.class.getName());
+
+ put("SaslServerFactory.ANONYMOUS",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.PLAIN",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.CRAM-MD5",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-MD5",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-SHA-160",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-RIPEMD128",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-RIPEMD160",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-TIGER",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+ put("SaslServerFactory.SRP-WHIRLPOOL",
+ gnu.javax.crypto.sasl.ServerFactory.class.getName());
+
+ put("Alg.Alias.SaslServerFactory.SRP-SHS", "SRP-SHA-160");
+ put("Alg.Alias.SaslServerFactory.SRP-SHA", "SRP-SHA-160");
+ put("Alg.Alias.SaslServerFactory.SRP-SHA1", "SRP-SHA-160");
+ put("Alg.Alias.SaslServerFactory.SRP-SHA-1", "SRP-SHA-160");
+ put("Alg.Alias.SaslServerFactory.SRP-SHA160", "SRP-SHA-160");
+ put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-128", "SRP-RIPEMD128");
+ put("Alg.Alias.SaslServerFactory.SRP-RIPEMD-160", "SRP-RIPEMD160");
+
+ return null;
+ }
+ });
}
/**
- * <p>Returns a {@link Set} of names of SASL Client mechanisms available from
- * this {@link Provider}.</p>
- *
+ * Returns a {@link Set} of names of SASL Client mechanisms available from
+ * this {@link Provider}.
+ *
* @return a {@link Set} of SASL Client mechanisms (Strings).
*/
public static final Set getSaslClientMechanismNames()
@@ -102,9 +112,9 @@ public final class GnuSasl extends Provider
}
/**
- * <p>Returns a {@link Set} of names of SASL Server mechanisms available from
- * this {@link Provider}.</p>
- *
+ * Returns a {@link Set} of names of SASL Server mechanisms available from
+ * this {@link Provider}.
+ *
* @return a {@link Set} of SASL Server mechanisms (Strings).
*/
public static final Set getSaslServerMechanismNames()
diff --git a/gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java b/gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java
index dfe15958f..be7fb18b0 100644
--- a/gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java
+++ b/gnu/javax/crypto/jce/PBKDF2SecretKeyFactory.java
@@ -53,57 +53,38 @@ import gnu.java.security.prng.IRandom;
import gnu.java.security.prng.LimitReachedException;
import gnu.javax.crypto.prng.PRNGFactory;
-public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
+public abstract class PBKDF2SecretKeyFactory
+ extends SecretKeyFactorySpi
{
-
- // Constants and fields.
- // ------------------------------------------------------------------------
-
protected String macName;
-
private static final int DEFAULT_ITERATION_COUNT = 1000;
-
private static final int DEFAULT_KEY_LEN = 32;
- // Constructor.
- // ------------------------------------------------------------------------
-
protected PBKDF2SecretKeyFactory(String macName)
{
this.macName = macName;
}
- // Instance methods.
- // ------------------------------------------------------------------------
-
protected SecretKey engineGenerateSecret(KeySpec spec)
throws InvalidKeySpecException
{
- if (!(spec instanceof PBEKeySpec))
- {
- throw new InvalidKeySpecException("not a PBEKeySpec");
- }
+ if (! (spec instanceof PBEKeySpec))
+ throw new InvalidKeySpecException("not a PBEKeySpec");
IRandom kdf = PRNGFactory.getInstance("PBKDF2-" + macName);
HashMap attr = new HashMap();
attr.put(IPBE.PASSWORD, ((PBEKeySpec) spec).getPassword());
byte[] salt = ((PBEKeySpec) spec).getSalt();
if (salt == null)
- {
- salt = new byte[0];
- }
+ salt = new byte[0];
attr.put(IPBE.SALT, salt);
int ic = ((PBEKeySpec) spec).getIterationCount();
if (ic <= 0)
- {
- ic = DEFAULT_ITERATION_COUNT;
- }
+ ic = DEFAULT_ITERATION_COUNT;
attr.put(IPBE.ITERATION_COUNT, Integer.valueOf(ic));
kdf.init(attr);
int len = ((PBEKeySpec) spec).getKeyLength();
if (len <= 0)
- {
- len = DEFAULT_KEY_LEN;
- }
+ len = DEFAULT_KEY_LEN;
byte[] dk = new byte[len];
try
{
@@ -113,7 +94,6 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
{
throw new IllegalArgumentException(lre.toString());
}
-
return new SecretKeySpec(dk, "PBKDF2");
}
@@ -128,10 +108,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
return new SecretKeySpec(key.getEncoded(), key.getAlgorithm());
}
- // Inner classes.
- // ------------------------------------------------------------------------
-
- public static class HMacHaval extends PBKDF2SecretKeyFactory
+ public static class HMacHaval
+ extends PBKDF2SecretKeyFactory
{
public HMacHaval()
{
@@ -139,7 +117,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacMD2 extends PBKDF2SecretKeyFactory
+ public static class HMacMD2
+ extends PBKDF2SecretKeyFactory
{
public HMacMD2()
{
@@ -147,7 +126,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacMD4 extends PBKDF2SecretKeyFactory
+ public static class HMacMD4
+ extends PBKDF2SecretKeyFactory
{
public HMacMD4()
{
@@ -155,7 +135,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacMD5 extends PBKDF2SecretKeyFactory
+ public static class HMacMD5
+ extends PBKDF2SecretKeyFactory
{
public HMacMD5()
{
@@ -163,7 +144,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacRipeMD128 extends PBKDF2SecretKeyFactory
+ public static class HMacRipeMD128
+ extends PBKDF2SecretKeyFactory
{
public HMacRipeMD128()
{
@@ -171,7 +153,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacRipeMD160 extends PBKDF2SecretKeyFactory
+ public static class HMacRipeMD160
+ extends PBKDF2SecretKeyFactory
{
public HMacRipeMD160()
{
@@ -179,7 +162,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacSHA1 extends PBKDF2SecretKeyFactory
+ public static class HMacSHA1
+ extends PBKDF2SecretKeyFactory
{
public HMacSHA1()
{
@@ -187,7 +171,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacSHA256 extends PBKDF2SecretKeyFactory
+ public static class HMacSHA256
+ extends PBKDF2SecretKeyFactory
{
public HMacSHA256()
{
@@ -195,7 +180,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacSHA384 extends PBKDF2SecretKeyFactory
+ public static class HMacSHA384
+ extends PBKDF2SecretKeyFactory
{
public HMacSHA384()
{
@@ -203,7 +189,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacSHA512 extends PBKDF2SecretKeyFactory
+ public static class HMacSHA512
+ extends PBKDF2SecretKeyFactory
{
public HMacSHA512()
{
@@ -211,7 +198,8 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacTiger extends PBKDF2SecretKeyFactory
+ public static class HMacTiger
+ extends PBKDF2SecretKeyFactory
{
public HMacTiger()
{
@@ -219,11 +207,12 @@ public abstract class PBKDF2SecretKeyFactory extends SecretKeyFactorySpi
}
}
- public static class HMacWhirlpool extends PBKDF2SecretKeyFactory
+ public static class HMacWhirlpool
+ extends PBKDF2SecretKeyFactory
{
public HMacWhirlpool()
{
super("HMAC-WHIRLPOOL");
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/AESSpi.java b/gnu/javax/crypto/jce/cipher/AESSpi.java
index 33de68956..1322e5e8a 100644
--- a/gnu/javax/crypto/jce/cipher/AESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/AESSpi.java
@@ -50,23 +50,17 @@ import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException;
/**
- * The implementation of the AES <i>Service Provider Interface</i>
- * (<b>SPI</b>) adapter.
+ * The implementation of the AES <i>Service Provider Interface</i> (<b>SPI</b>)
+ * adapter.
*/
-public final class AESSpi extends CipherAdapter
+public final class AESSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public AESSpi()
{
super(Registry.AES_CIPHER, 16);
}
- // Methods from CipherAdapter
- // -----------------------------------------------------------------------
-
protected void engineInit(int opmode, Key key, AlgorithmParameterSpec params,
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException
@@ -74,10 +68,8 @@ public final class AESSpi extends CipherAdapter
if (params instanceof BlockCipherParameterSpec)
{
if (((BlockCipherParameterSpec) params).getBlockSize() != 16)
- {
- throw new InvalidAlgorithmParameterException(
- "AES block size must be 16 bytes");
- }
+ throw new InvalidAlgorithmParameterException(
+ "AES block size must be 16 bytes");
}
super.engineInit(opmode, key, params, random);
}
@@ -90,9 +82,7 @@ public final class AESSpi extends CipherAdapter
try
{
if (params != null)
- {
- spec = params.getParameterSpec(BlockCipherParameterSpec.class);
- }
+ spec = params.getParameterSpec(BlockCipherParameterSpec.class);
}
catch (InvalidParameterSpecException ipse)
{
diff --git a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
index 963fa1c00..abcb486b5 100644
--- a/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
+++ b/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
@@ -62,29 +62,20 @@ import javax.crypto.NoSuchPaddingException;
import javax.crypto.ShortBufferException;
/**
- * The <i>Service Provider Interface</i> (<b>SPI</b>) for the ARCFOUR
- * stream cipher.
+ * The <i>Service Provider Interface</i> (<b>SPI</b>) for the ARCFOUR stream
+ * cipher.
*/
-public class ARCFourSpi extends CipherSpi
+public class ARCFourSpi
+ extends CipherSpi
{
-
- // Constants and variables.
- // -----------------------------------------------------------------------
-
private IRandom keystream;
- // Constructors.
- // -----------------------------------------------------------------------
-
public ARCFourSpi()
{
super();
keystream = PRNGFactory.getInstance(Registry.ARCFOUR_PRNG);
}
- // Methods implementing CipherSpi.
- // -----------------------------------------------------------------------
-
protected int engineGetBlockSize()
{
return 0; // stream cipher.
@@ -119,14 +110,10 @@ public class ARCFourSpi extends CipherSpi
throws InvalidKeyException
{
if (mode != Cipher.ENCRYPT_MODE && mode != Cipher.DECRYPT_MODE)
- {
- throw new IllegalArgumentException(
- "arcfour is for encryption or decryption only");
- }
- if (key == null || !key.getFormat().equalsIgnoreCase("RAW"))
- {
- throw new InvalidKeyException("key must be non-null raw bytes");
- }
+ throw new IllegalArgumentException(
+ "arcfour is for encryption or decryption only");
+ if (key == null || ! key.getFormat().equalsIgnoreCase("RAW"))
+ throw new InvalidKeyException("key must be non-null raw bytes");
HashMap attrib = new HashMap();
attrib.put(ARCFour.ARCFOUR_KEY_MATERIAL, key.getEncoded());
keystream.init(attrib);
@@ -149,16 +136,12 @@ public class ARCFourSpi extends CipherSpi
protected byte[] engineUpdate(byte[] in, int offset, int length)
{
if (length < 0 || offset < 0 || length + offset > in.length)
- {
- throw new ArrayIndexOutOfBoundsException();
- }
+ throw new ArrayIndexOutOfBoundsException();
byte[] result = new byte[length];
try
{
for (int i = 0; i < length; i++)
- {
- result[i] = (byte) (in[i + offset] ^ keystream.nextByte());
- }
+ result[i] = (byte)(in[i + offset] ^ keystream.nextByte());
}
catch (LimitReachedException wontHappen)
{
@@ -171,19 +154,13 @@ public class ARCFourSpi extends CipherSpi
{
if (length < 0 || inOffset < 0 || length + inOffset > in.length
|| outOffset < 0)
- {
- throw new ArrayIndexOutOfBoundsException();
- }
+ throw new ArrayIndexOutOfBoundsException();
if (outOffset + length > out.length)
- {
- throw new ShortBufferException();
- }
+ throw new ShortBufferException();
try
{
for (int i = 0; i < length; i++)
- {
- out[i + outOffset] = (byte) (in[i + inOffset] ^ keystream.nextByte());
- }
+ out[i + outOffset] = (byte)(in[i + inOffset] ^ keystream.nextByte());
}
catch (LimitReachedException wontHappen)
{
diff --git a/gnu/javax/crypto/jce/cipher/AnubisSpi.java b/gnu/javax/crypto/jce/cipher/AnubisSpi.java
index 0fca3b491..e35e4e724 100644
--- a/gnu/javax/crypto/jce/cipher/AnubisSpi.java
+++ b/gnu/javax/crypto/jce/cipher/AnubisSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Anubis <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class AnubisSpi extends CipherAdapter
+public final class AnubisSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public AnubisSpi()
{
super(Registry.ANUBIS_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
index d31d7e193..fec200ca6 100644
--- a/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
+++ b/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Blowfish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class BlowfishSpi extends CipherAdapter
+public final class BlowfishSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public BlowfishSpi()
{
super(Registry.BLOWFISH_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/Cast5Spi.java b/gnu/javax/crypto/jce/cipher/Cast5Spi.java
index b1d4cf703..bf0803400 100644
--- a/gnu/javax/crypto/jce/cipher/Cast5Spi.java
+++ b/gnu/javax/crypto/jce/cipher/Cast5Spi.java
@@ -43,26 +43,12 @@ import gnu.java.security.Registry;
/**
* The implementation of the <code>CAST5</code> (a.k.a. CAST-128) <i>Service
* Provider Interface</i> (<b>SPI</b>) Adapter.
- *
- * @version Revision: $
*/
-public class Cast5Spi extends CipherAdapter
+public class Cast5Spi
+ extends CipherAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -------------------------------------------------------------------------
-
public Cast5Spi()
{
super(Registry.CAST5_CIPHER);
}
-
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/cipher/CipherAdapter.java b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
index 899109c27..4e9af6ab8 100644
--- a/gnu/javax/crypto/jce/cipher/CipherAdapter.java
+++ b/gnu/javax/crypto/jce/cipher/CipherAdapter.java
@@ -39,8 +39,8 @@ exception statement from your version. */
package gnu.javax.crypto.jce.cipher;
import gnu.java.security.Registry;
-import gnu.javax.crypto.cipher.IBlockCipher;
import gnu.javax.crypto.cipher.CipherFactory;
+import gnu.javax.crypto.cipher.IBlockCipher;
import gnu.javax.crypto.jce.spec.BlockCipherParameterSpec;
import gnu.javax.crypto.mode.IMode;
import gnu.javax.crypto.mode.ModeFactory;
@@ -68,61 +68,48 @@ import javax.crypto.ShortBufferException;
import javax.crypto.spec.IvParameterSpec;
/**
- * <p>The implementation of a generic {@link Cipher} <i>Adapter</i> class to
- * wrap GNU Crypto cipher instances.</p>
- *
- * <p>This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for
+ * The implementation of a generic {@link Cipher} <i>Adapter</i> class to wrap
+ * GNU cipher instances.
+ * <p>
+ * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for
* the {@link Cipher} class, which provides the functionality of symmetric-key
- * block ciphers, such as the AES.<p>
- *
- * <p>This base class defines all of the abstract methods in {@link CipherSpi},
+ * block ciphers, such as the AES.
+ * <p>
+ * This base class defines all of the abstract methods in {@link CipherSpi},
* but does not define the (non-abstract) key wrapping functions that extended
* the base cipher SPI, and these methods thus immediately throw an
* {@link UnsupportedOperationException}. If a cipher implementation provides
* this functionality, or if it in fact accepts parameters other than the key
* and the initialization vector, the subclass should override those methods.
* Otherwise a subclass need only call the {@link #CipherAdapter(String)}
- * constructor with the name of the cipher.</p>
+ * constructor with the name of the cipher.
*/
-class CipherAdapter extends CipherSpi
+class CipherAdapter
+ extends CipherSpi
{
-
- // Constants and variables.
- // -------------------------------------------------------------------------
-
/** Our cipher instance. */
protected IBlockCipher cipher;
-
/** Our mode instance. */
protected IMode mode;
-
/** Our padding instance. */
protected IPad pad;
-
/** The current key size. */
protected int keyLen;
-
/** Our attributes map. */
protected Map attributes;
-
/** An incomplete block. */
protected byte[] partBlock;
-
/** The number of bytes in {@link #partBlock}. */
protected int partLen;
-
/** The length of blocks we are processing. */
protected int blockLen;
- // Constructor(s)
- // -------------------------------------------------------------------------
-
/**
- * <p>Protected constructor to be called by subclasses. The cipher name
- * argument should be the appropriate one listed in {@link gnu.java.security.Registry}.
- * The basic cipher instance is created, along with an instance of the
- * {@link gnu.javax.crypto.mode.ECB} mode and no padding.</p>
- *
+ * Protected constructor to be called by subclasses. The cipher name argument
+ * should be the appropriate one listed in {@link Registry}. The basic cipher
+ * instance is created, along with an instance of the
+ * {@link gnu.javax.crypto.mode.ECB} mode and no padding.
+ *
* @param cipherName The cipher to instantiate.
* @param blockLen The block length to use.
*/
@@ -136,8 +123,8 @@ class CipherAdapter extends CipherSpi
}
/**
- * <p>Creates a new cipher adapter with the default block size.</p>
- *
+ * Creates a new cipher adapter with the default block size.
+ *
* @param cipherName The cipher to instantiate.
*/
protected CipherAdapter(String cipherName)
@@ -149,9 +136,6 @@ class CipherAdapter extends CipherSpi
attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, Integer.valueOf(blockLen));
}
- // Instance methods implementing javax.crypto.CipherSpi.
- // -------------------------------------------------------------------------
-
protected void engineSetMode(String modeName) throws NoSuchAlgorithmException
{
if (modeName.length() >= 3
@@ -172,14 +156,10 @@ class CipherAdapter extends CipherSpi
}
}
else
- {
- attributes.remove(IMode.MODE_BLOCK_SIZE);
- }
+ attributes.remove(IMode.MODE_BLOCK_SIZE);
mode = ModeFactory.getInstance(modeName, cipher, blockLen);
if (mode == null)
- {
- throw new NoSuchAlgorithmException(modeName);
- }
+ throw new NoSuchAlgorithmException(modeName);
}
protected void engineSetPadding(String padName) throws NoSuchPaddingException
@@ -191,17 +171,13 @@ class CipherAdapter extends CipherSpi
}
pad = PadFactory.getInstance(padName);
if (pad == null)
- {
- throw new NoSuchPaddingException(padName);
- }
+ throw new NoSuchPaddingException(padName);
}
protected int engineGetBlockSize()
{
if (cipher != null)
- {
- return blockLen;
- }
+ return blockLen;
return 0;
}
@@ -215,17 +191,16 @@ class CipherAdapter extends CipherSpi
{
byte[] iv = (byte[]) attributes.get(IMode.IV);
if (iv == null)
- {
- return null;
- }
+ return null;
return (byte[]) iv.clone();
}
protected AlgorithmParameters engineGetParameters()
{
- BlockCipherParameterSpec spec = new BlockCipherParameterSpec(
- (byte[]) attributes.get(IMode.IV),
- cipher.currentBlockSize(),
+ byte[] iv = (byte[]) attributes.get(IMode.IV);
+ int cipherBlockSize = cipher.currentBlockSize();
+ BlockCipherParameterSpec spec = new BlockCipherParameterSpec(iv,
+ cipherBlockSize,
keyLen);
AlgorithmParameters params;
try
@@ -280,15 +255,11 @@ class CipherAdapter extends CipherSpi
attributes.put(IMode.STATE, Integer.valueOf(IMode.DECRYPTION));
break;
}
- if (!key.getFormat().equalsIgnoreCase("RAW"))
- {
- throw new InvalidKeyException("bad key format " + key.getFormat());
- }
+ if (! key.getFormat().equalsIgnoreCase("RAW"))
+ throw new InvalidKeyException("bad key format " + key.getFormat());
byte[] kb = key.getEncoded();
if (keyLen == 0)
- {
- keyLen = kb.length;
- }
+ keyLen = kb.length;
else if (keyLen < kb.length)
{
byte[] kbb = kb;
@@ -304,12 +275,12 @@ class CipherAdapter extends CipherSpi
InvalidAlgorithmParameterException
{
if (params == null)
- {
+ {
// All cipher modes require parameters (like an IV) except ECB. When
// these cant be derived from the given key then it must be generated
// randomly if in ENCRYPT or WRAP mode. Parameters that have defaults
// for our cipher must be set to these defaults.
- if(! mode.name().toLowerCase().startsWith(Registry.ECB_MODE + "("))
+ if (! mode.name().toLowerCase().startsWith(Registry.ECB_MODE + "("))
{
switch (opmode)
{
@@ -323,20 +294,21 @@ class CipherAdapter extends CipherSpi
throw new InvalidAlgorithmParameterException(
"Required algorithm parameters are missing for mode: "
+ mode.name());
- }
+ }
}
// Add default for block length etc.
blockLen = cipher.defaultBlockSize();
- attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, Integer.valueOf(blockLen));
+ attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE,
+ Integer.valueOf(blockLen));
keyLen = 0;
}
else if (params instanceof BlockCipherParameterSpec)
{
- attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE,
- Integer.valueOf(((BlockCipherParameterSpec) params).getBlockSize()));
- attributes.put(IMode.IV, ((BlockCipherParameterSpec) params).getIV());
- keyLen = ((BlockCipherParameterSpec) params).getKeySize();
- blockLen = ((BlockCipherParameterSpec) params).getBlockSize();
+ BlockCipherParameterSpec bcps = (BlockCipherParameterSpec) params;
+ blockLen = bcps.getBlockSize();
+ attributes.put(IBlockCipher.CIPHER_BLOCK_SIZE, Integer.valueOf(blockLen));
+ attributes.put(IMode.IV, bcps.getIV());
+ keyLen = bcps.getKeySize();
}
else if (params instanceof IvParameterSpec)
{
@@ -356,9 +328,7 @@ class CipherAdapter extends CipherSpi
try
{
if (params != null)
- {
- spec = params.getParameterSpec(BlockCipherParameterSpec.class);
- }
+ spec = params.getParameterSpec(BlockCipherParameterSpec.class);
}
catch (InvalidParameterSpecException ignored)
{
@@ -375,91 +345,50 @@ class CipherAdapter extends CipherSpi
{
engineUpdate(input, off, len, out, 0);
}
- catch (ShortBufferException x)
- { // should not happen
+ catch (ShortBufferException x) // should not happen
+ {
x.printStackTrace(System.err);
}
return out;
}
- // protected int
- // engineUpdate(byte[] in, int inOff, int inLen, byte[] out, int outOff)
- // throws ShortBufferException
- // {
- // int blockSize = mode.currentBlockSize();
- // int count = (partLen + inLen) / blockSize;
- // if (count * blockSize > out.length - outOff) {
- // throw new ShortBufferException();
- // }
- // byte[] buf;
- // if (partLen > 0 && count > 0) {
- // buf = new byte[partLen + inLen];
- // System.arraycopy(partBlock, 0, buf, 0, partLen);
- // if (in != null && inLen > 0) {
- // System.arraycopy(in, inOff, buf, partLen, inLen);
- // }
- // partLen = 0;
- // inOff = 0;
- // } else {
- // buf = in;
- // }
- // for (int i = 0; i < count; i++) {
- // mode.update(buf, i * blockSize + inOff, out, i * blockSize + outOff);
- // }
- // if (inOff + inLen > count * blockSize) {
- // partLen = (inOff + inLen) - (count * blockSize);
- // System.arraycopy(in, count * blockSize, partBlock, 0, partLen);
- // }
- // return count * blockSize;
- // }
-
protected int engineUpdate(byte[] in, int inOff, int inLen, byte[] out,
int outOff) throws ShortBufferException
{
- if (inLen == 0)
- { // nothing to process
- return 0;
- }
+ if (inLen == 0) // nothing to process
+ return 0;
final int blockSize = mode.currentBlockSize();
final int blockCount = (partLen + inLen) / blockSize;
final int result = blockCount * blockSize;
if (result > out.length - outOff)
+ throw new ShortBufferException();
+ if (blockCount == 0) // not enough bytes for even 1 block
{
- throw new ShortBufferException();
- }
- if (blockCount == 0)
- { // not enough bytes for even 1 block
System.arraycopy(in, inOff, partBlock, partLen, inLen);
partLen += inLen;
return 0;
}
final byte[] buf;
// we have enough bytes for at least 1 block
- if (partLen == 0)
- { // if no cached bytes use input
- buf = in;
- }
- else
- { // prefix input with cached bytes
+ if (partLen == 0) // if no cached bytes use input
+ buf = in;
+ else // prefix input with cached bytes
+ {
buf = new byte[partLen + inLen];
System.arraycopy(partBlock, 0, buf, 0, partLen);
if (in != null && inLen > 0)
- {
- System.arraycopy(in, inOff, buf, partLen, inLen);
- }
+ System.arraycopy(in, inOff, buf, partLen, inLen);
inOff = 0;
}
- for (int i = 0; i < blockCount; i++)
- { // update blockCount * blockSize
+ for (int i = 0; i < blockCount; i++) // update blockCount * blockSize
+ {
mode.update(buf, inOff, out, outOff);
inOff += blockSize;
outOff += blockSize;
}
partLen += inLen - result;
- if (partLen > 0)
- { // cache remaining bytes from buf
- System.arraycopy(buf, inOff, partBlock, 0, partLen);
- }
+ if (partLen > 0) // cache remaining bytes from buf
+ System.arraycopy(buf, inOff, partBlock, 0, partLen);
return result;
}
@@ -499,9 +428,7 @@ class CipherAdapter extends CipherSpi
else
{
if (partLen > 0)
- {
- throw new IllegalBlockSizeException(partLen + " trailing bytes");
- }
+ throw new IllegalBlockSizeException(partLen + " trailing bytes");
result = buf;
}
@@ -524,9 +451,7 @@ class CipherAdapter extends CipherSpi
{
byte[] buf = engineDoFinal(in, inOff, inLen);
if (out.length + outOff < buf.length)
- {
- throw new ShortBufferException();
- }
+ throw new ShortBufferException();
System.arraycopy(buf, 0, out, outOff, buf.length);
return buf.length;
}
diff --git a/gnu/javax/crypto/jce/cipher/DESSpi.java b/gnu/javax/crypto/jce/cipher/DESSpi.java
index ff86071c4..21f62b4f0 100644
--- a/gnu/javax/crypto/jce/cipher/DESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/DESSpi.java
@@ -41,15 +41,12 @@ package gnu.javax.crypto.jce.cipher;
import gnu.java.security.Registry;
/**
- * The implementation of the DES <i>Service Provider Interface</i>
- * (<b>SPI</b>) adapter.
+ * The implementation of the DES <i>Service Provider Interface</i> (<b>SPI</b>)
+ * adapter.
*/
-public final class DESSpi extends CipherAdapter
+public final class DESSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public DESSpi()
{
super(Registry.DES_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/KhazadSpi.java b/gnu/javax/crypto/jce/cipher/KhazadSpi.java
index 397c27d2e..6e744a2f2 100644
--- a/gnu/javax/crypto/jce/cipher/KhazadSpi.java
+++ b/gnu/javax/crypto/jce/cipher/KhazadSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Khazad <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class KhazadSpi extends CipherAdapter
+public final class KhazadSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public KhazadSpi()
{
super(Registry.KHAZAD_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
index e6d78ef39..e50e00c8e 100644
--- a/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
+++ b/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Null cipher <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class NullCipherSpi extends CipherAdapter
+public final class NullCipherSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public NullCipherSpi()
{
super(Registry.NULL_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/PBES2.java b/gnu/javax/crypto/jce/cipher/PBES2.java
index 930ecaa76..26a6a2c2d 100644
--- a/gnu/javax/crypto/jce/cipher/PBES2.java
+++ b/gnu/javax/crypto/jce/cipher/PBES2.java
@@ -55,20 +55,13 @@ import javax.crypto.interfaces.PBEKey;
import javax.crypto.spec.SecretKeySpec;
/**
- * <p>.</p>
*/
-public abstract class PBES2 extends CipherAdapter
+public abstract class PBES2
+ extends CipherAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
/** The HMac (PRF) algorithm name. */
protected String macName;
- // Constructor(s)
- // -------------------------------------------------------------------------
-
protected PBES2(String cipherName, int blockLen, String macName)
{
super(cipherName, blockLen);
@@ -81,15 +74,11 @@ public abstract class PBES2 extends CipherAdapter
this.macName = macName;
}
- // Instance methods
- // -------------------------------------------------------------------------
-
protected void engineInit(int opmode, Key key, SecureRandom random)
throws InvalidKeyException
{
- if (!(key instanceof PBEKey))
+ if (! (key instanceof PBEKey))
throw new InvalidKeyException("not a PBE key");
-
super.engineInit(opmode, genkey((PBEKey) key), random);
}
@@ -97,9 +86,8 @@ public abstract class PBES2 extends CipherAdapter
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException
{
- if (!(key instanceof PBEKey))
+ if (! (key instanceof PBEKey))
throw new InvalidKeyException("not a PBE key");
-
super.engineInit(opmode, genkey((PBEKey) key), params, random);
}
@@ -107,9 +95,8 @@ public abstract class PBES2 extends CipherAdapter
SecureRandom random) throws InvalidKeyException,
InvalidAlgorithmParameterException
{
- if (!(key instanceof PBEKey))
+ if (! (key instanceof PBEKey))
throw new InvalidKeyException("not a PBE key");
-
super.engineInit(opmode, genkey((PBEKey) key), params, random);
}
@@ -117,9 +104,7 @@ public abstract class PBES2 extends CipherAdapter
{
IRandom kdf = PRNGFactory.getInstance("PBKDF2-" + macName);
if (kdf == null)
- {
- throw new IllegalArgumentException("no such KDF: PBKDF2-" + macName);
- }
+ throw new IllegalArgumentException("no such KDF: PBKDF2-" + macName);
HashMap attrib = new HashMap();
attrib.put(IPBE.ITERATION_COUNT, Integer.valueOf(key.getIterationCount()));
attrib.put(IPBE.PASSWORD, key.getPassword());
@@ -139,21 +124,14 @@ public abstract class PBES2 extends CipherAdapter
}
catch (LimitReachedException shouldNotHappen)
{
- // throw new Error(shouldNotHappen);
throw new Error(String.valueOf(shouldNotHappen));
}
return new SecretKeySpec(dk, cipher.name());
}
- // Inner classe(s)
- // =========================================================================
-
- public static class HMacSHA1 extends PBES2
+ public static class HMacSHA1
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacSHA1(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-SHA1");
@@ -164,10 +142,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-SHA1");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacSHA1
+ public static class AES
+ extends HMacSHA1
{
public AES()
{
@@ -175,7 +151,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacSHA1
+ public static class Anubis
+ extends HMacSHA1
{
public Anubis()
{
@@ -183,7 +160,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacSHA1
+ public static class Blowfish
+ extends HMacSHA1
{
public Blowfish()
{
@@ -191,7 +169,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacSHA1
+ public static class Cast5
+ extends HMacSHA1
{
public Cast5()
{
@@ -199,7 +178,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacSHA1
+ public static class DES
+ extends HMacSHA1
{
public DES()
{
@@ -207,7 +187,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacSHA1
+ public static class Khazad
+ extends HMacSHA1
{
public Khazad()
{
@@ -215,7 +196,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacSHA1
+ public static class Serpent
+ extends HMacSHA1
{
public Serpent()
{
@@ -223,7 +205,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacSHA1
+ public static class Square
+ extends HMacSHA1
{
public Square()
{
@@ -231,7 +214,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacSHA1
+ public static class TripleDES
+ extends HMacSHA1
{
public TripleDES()
{
@@ -239,7 +223,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacSHA1
+ public static class Twofish
+ extends HMacSHA1
{
public Twofish()
{
@@ -248,12 +233,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacMD5 extends PBES2
+ public static class HMacMD5
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacMD5(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-MD5");
@@ -264,10 +246,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-MD5");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacMD5
+ public static class AES
+ extends HMacMD5
{
public AES()
{
@@ -275,7 +255,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacMD5
+ public static class Anubis
+ extends HMacMD5
{
public Anubis()
{
@@ -283,7 +264,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacMD5
+ public static class Blowfish
+ extends HMacMD5
{
public Blowfish()
{
@@ -291,7 +273,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacMD5
+ public static class Cast5
+ extends HMacMD5
{
public Cast5()
{
@@ -299,7 +282,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacMD5
+ public static class DES
+ extends HMacMD5
{
public DES()
{
@@ -307,7 +291,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacMD5
+ public static class Khazad
+ extends HMacMD5
{
public Khazad()
{
@@ -315,7 +300,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacMD5
+ public static class Serpent
+ extends HMacMD5
{
public Serpent()
{
@@ -323,7 +309,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacMD5
+ public static class Square
+ extends HMacMD5
{
public Square()
{
@@ -331,7 +318,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacMD5
+ public static class TripleDES
+ extends HMacMD5
{
public TripleDES()
{
@@ -339,7 +327,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacMD5
+ public static class Twofish
+ extends HMacMD5
{
public Twofish()
{
@@ -348,12 +337,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacMD2 extends PBES2
+ public static class HMacMD2
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacMD2(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-MD2");
@@ -364,10 +350,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-MD2");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacMD2
+ public static class AES
+ extends HMacMD2
{
public AES()
{
@@ -375,7 +359,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacMD2
+ public static class Anubis
+ extends HMacMD2
{
public Anubis()
{
@@ -383,7 +368,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacMD2
+ public static class Blowfish
+ extends HMacMD2
{
public Blowfish()
{
@@ -391,7 +377,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacMD2
+ public static class Cast5
+ extends HMacMD2
{
public Cast5()
{
@@ -399,7 +386,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacMD2
+ public static class DES
+ extends HMacMD2
{
public DES()
{
@@ -407,7 +395,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacMD2
+ public static class Khazad
+ extends HMacMD2
{
public Khazad()
{
@@ -415,7 +404,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacMD2
+ public static class Serpent
+ extends HMacMD2
{
public Serpent()
{
@@ -423,7 +413,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacMD2
+ public static class Square
+ extends HMacMD2
{
public Square()
{
@@ -431,7 +422,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacMD2
+ public static class TripleDES
+ extends HMacMD2
{
public TripleDES()
{
@@ -439,7 +431,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacMD2
+ public static class Twofish
+ extends HMacMD2
{
public Twofish()
{
@@ -448,12 +441,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacMD4 extends PBES2
+ public static class HMacMD4
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacMD4(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-MD4");
@@ -464,10 +454,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-MD4");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacMD4
+ public static class AES
+ extends HMacMD4
{
public AES()
{
@@ -475,7 +463,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacMD4
+ public static class Anubis
+ extends HMacMD4
{
public Anubis()
{
@@ -483,7 +472,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacMD4
+ public static class Blowfish
+ extends HMacMD4
{
public Blowfish()
{
@@ -491,7 +481,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacMD4
+ public static class Cast5
+ extends HMacMD4
{
public Cast5()
{
@@ -499,7 +490,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacMD4
+ public static class DES
+ extends HMacMD4
{
public DES()
{
@@ -507,7 +499,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacMD4
+ public static class Khazad
+ extends HMacMD4
{
public Khazad()
{
@@ -515,7 +508,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacMD4
+ public static class Serpent
+ extends HMacMD4
{
public Serpent()
{
@@ -523,7 +517,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacMD4
+ public static class Square
+ extends HMacMD4
{
public Square()
{
@@ -531,7 +526,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacMD4
+ public static class TripleDES
+ extends HMacMD4
{
public TripleDES()
{
@@ -539,7 +535,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacMD4
+ public static class Twofish
+ extends HMacMD4
{
public Twofish()
{
@@ -548,12 +545,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacHaval extends PBES2
+ public static class HMacHaval
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacHaval(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-HAVAL");
@@ -564,10 +558,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-HAVAL");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacHaval
+ public static class AES
+ extends HMacHaval
{
public AES()
{
@@ -575,7 +567,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacHaval
+ public static class Anubis
+ extends HMacHaval
{
public Anubis()
{
@@ -583,7 +576,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacHaval
+ public static class Blowfish
+ extends HMacHaval
{
public Blowfish()
{
@@ -591,7 +585,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacHaval
+ public static class Cast5
+ extends HMacHaval
{
public Cast5()
{
@@ -599,7 +594,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacHaval
+ public static class DES
+ extends HMacHaval
{
public DES()
{
@@ -607,7 +603,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacHaval
+ public static class Khazad
+ extends HMacHaval
{
public Khazad()
{
@@ -615,7 +612,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacHaval
+ public static class Serpent
+ extends HMacHaval
{
public Serpent()
{
@@ -623,7 +621,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacHaval
+ public static class Square
+ extends HMacHaval
{
public Square()
{
@@ -631,7 +630,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacHaval
+ public static class TripleDES
+ extends HMacHaval
{
public TripleDES()
{
@@ -639,7 +639,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacHaval
+ public static class Twofish
+ extends HMacHaval
{
public Twofish()
{
@@ -648,12 +649,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacRipeMD128 extends PBES2
+ public static class HMacRipeMD128
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacRipeMD128(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-RIPEMD128");
@@ -664,10 +662,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-RIPEMD128");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacRipeMD128
+ public static class AES
+ extends HMacRipeMD128
{
public AES()
{
@@ -675,7 +671,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacRipeMD128
+ public static class Anubis
+ extends HMacRipeMD128
{
public Anubis()
{
@@ -683,7 +680,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacRipeMD128
+ public static class Blowfish
+ extends HMacRipeMD128
{
public Blowfish()
{
@@ -691,7 +689,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacRipeMD128
+ public static class Cast5
+ extends HMacRipeMD128
{
public Cast5()
{
@@ -699,7 +698,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacRipeMD128
+ public static class DES
+ extends HMacRipeMD128
{
public DES()
{
@@ -707,7 +707,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacRipeMD128
+ public static class Khazad
+ extends HMacRipeMD128
{
public Khazad()
{
@@ -715,7 +716,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacRipeMD128
+ public static class Serpent
+ extends HMacRipeMD128
{
public Serpent()
{
@@ -723,7 +725,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacRipeMD128
+ public static class Square
+ extends HMacRipeMD128
{
public Square()
{
@@ -731,7 +734,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacRipeMD128
+ public static class TripleDES
+ extends HMacRipeMD128
{
public TripleDES()
{
@@ -739,7 +743,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacRipeMD128
+ public static class Twofish
+ extends HMacRipeMD128
{
public Twofish()
{
@@ -748,12 +753,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacRipeMD160 extends PBES2
+ public static class HMacRipeMD160
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacRipeMD160(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-RIPEMD160");
@@ -764,10 +766,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-RIPEMD160");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacRipeMD160
+ public static class AES
+ extends HMacRipeMD160
{
public AES()
{
@@ -775,7 +775,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacRipeMD160
+ public static class Anubis
+ extends HMacRipeMD160
{
public Anubis()
{
@@ -783,7 +784,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacRipeMD160
+ public static class Blowfish
+ extends HMacRipeMD160
{
public Blowfish()
{
@@ -791,7 +793,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacRipeMD160
+ public static class Cast5
+ extends HMacRipeMD160
{
public Cast5()
{
@@ -799,7 +802,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacRipeMD160
+ public static class DES
+ extends HMacRipeMD160
{
public DES()
{
@@ -807,7 +811,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacRipeMD160
+ public static class Khazad
+ extends HMacRipeMD160
{
public Khazad()
{
@@ -815,7 +820,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacRipeMD160
+ public static class Serpent
+ extends HMacRipeMD160
{
public Serpent()
{
@@ -823,7 +829,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacRipeMD160
+ public static class Square
+ extends HMacRipeMD160
{
public Square()
{
@@ -831,7 +838,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacRipeMD160
+ public static class TripleDES
+ extends HMacRipeMD160
{
public TripleDES()
{
@@ -839,7 +847,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacRipeMD160
+ public static class Twofish
+ extends HMacRipeMD160
{
public Twofish()
{
@@ -848,12 +857,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacSHA256 extends PBES2
+ public static class HMacSHA256
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacSHA256(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-SHA-256");
@@ -864,10 +870,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-SHA-256");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacSHA256
+ public static class AES
+ extends HMacSHA256
{
public AES()
{
@@ -875,7 +879,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacSHA256
+ public static class Anubis
+ extends HMacSHA256
{
public Anubis()
{
@@ -883,7 +888,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacSHA256
+ public static class Blowfish
+ extends HMacSHA256
{
public Blowfish()
{
@@ -891,7 +897,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacSHA256
+ public static class Cast5
+ extends HMacSHA256
{
public Cast5()
{
@@ -899,7 +906,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacSHA256
+ public static class DES
+ extends HMacSHA256
{
public DES()
{
@@ -907,7 +915,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacSHA256
+ public static class Khazad
+ extends HMacSHA256
{
public Khazad()
{
@@ -915,7 +924,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacSHA256
+ public static class Serpent
+ extends HMacSHA256
{
public Serpent()
{
@@ -923,7 +933,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacSHA256
+ public static class Square
+ extends HMacSHA256
{
public Square()
{
@@ -931,7 +942,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacSHA256
+ public static class TripleDES
+ extends HMacSHA256
{
public TripleDES()
{
@@ -939,7 +951,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacSHA256
+ public static class Twofish
+ extends HMacSHA256
{
public Twofish()
{
@@ -948,12 +961,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacSHA384 extends PBES2
+ public static class HMacSHA384
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacSHA384(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-SHA-384");
@@ -964,10 +974,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-SHA-384");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacSHA384
+ public static class AES
+ extends HMacSHA384
{
public AES()
{
@@ -975,7 +983,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacSHA384
+ public static class Anubis
+ extends HMacSHA384
{
public Anubis()
{
@@ -983,7 +992,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacSHA384
+ public static class Blowfish
+ extends HMacSHA384
{
public Blowfish()
{
@@ -991,7 +1001,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacSHA384
+ public static class Cast5
+ extends HMacSHA384
{
public Cast5()
{
@@ -999,7 +1010,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacSHA384
+ public static class DES
+ extends HMacSHA384
{
public DES()
{
@@ -1007,7 +1019,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacSHA384
+ public static class Khazad
+ extends HMacSHA384
{
public Khazad()
{
@@ -1015,7 +1028,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacSHA384
+ public static class Serpent
+ extends HMacSHA384
{
public Serpent()
{
@@ -1023,7 +1037,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacSHA384
+ public static class Square
+ extends HMacSHA384
{
public Square()
{
@@ -1031,7 +1046,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacSHA384
+ public static class TripleDES
+ extends HMacSHA384
{
public TripleDES()
{
@@ -1039,7 +1055,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacSHA384
+ public static class Twofish
+ extends HMacSHA384
{
public Twofish()
{
@@ -1048,12 +1065,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacSHA512 extends PBES2
+ public static class HMacSHA512
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacSHA512(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-SHA-512");
@@ -1064,10 +1078,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-SHA-512");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacSHA512
+ public static class AES
+ extends HMacSHA512
{
public AES()
{
@@ -1075,7 +1087,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacSHA512
+ public static class Anubis
+ extends HMacSHA512
{
public Anubis()
{
@@ -1083,7 +1096,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacSHA512
+ public static class Blowfish
+ extends HMacSHA512
{
public Blowfish()
{
@@ -1091,7 +1105,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacSHA512
+ public static class Cast5
+ extends HMacSHA512
{
public Cast5()
{
@@ -1099,7 +1114,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacSHA512
+ public static class DES
+ extends HMacSHA512
{
public DES()
{
@@ -1107,7 +1123,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacSHA512
+ public static class Khazad
+ extends HMacSHA512
{
public Khazad()
{
@@ -1115,7 +1132,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacSHA512
+ public static class Serpent
+ extends HMacSHA512
{
public Serpent()
{
@@ -1123,7 +1141,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacSHA512
+ public static class Square
+ extends HMacSHA512
{
public Square()
{
@@ -1131,7 +1150,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacSHA512
+ public static class TripleDES
+ extends HMacSHA512
{
public TripleDES()
{
@@ -1139,7 +1159,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacSHA512
+ public static class Twofish
+ extends HMacSHA512
{
public Twofish()
{
@@ -1148,12 +1169,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacTiger extends PBES2
+ public static class HMacTiger
+ extends PBES2
{
-
- // Constructor(s)
- // ---------------------------------------------------------------------
-
public HMacTiger(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-TIGER");
@@ -1164,10 +1182,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-TIGER");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacTiger
+ public static class AES
+ extends HMacTiger
{
public AES()
{
@@ -1175,7 +1191,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacTiger
+ public static class Anubis
+ extends HMacTiger
{
public Anubis()
{
@@ -1183,7 +1200,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacTiger
+ public static class Blowfish
+ extends HMacTiger
{
public Blowfish()
{
@@ -1191,7 +1209,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacTiger
+ public static class Cast5
+ extends HMacTiger
{
public Cast5()
{
@@ -1199,7 +1218,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacTiger
+ public static class DES
+ extends HMacTiger
{
public DES()
{
@@ -1207,7 +1227,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacTiger
+ public static class Khazad
+ extends HMacTiger
{
public Khazad()
{
@@ -1215,7 +1236,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacTiger
+ public static class Serpent
+ extends HMacTiger
{
public Serpent()
{
@@ -1223,7 +1245,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacTiger
+ public static class Square
+ extends HMacTiger
{
public Square()
{
@@ -1231,7 +1254,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacTiger
+ public static class TripleDES
+ extends HMacTiger
{
public TripleDES()
{
@@ -1239,7 +1263,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacTiger
+ public static class Twofish
+ extends HMacTiger
{
public Twofish()
{
@@ -1248,12 +1273,9 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class HMacWhirlpool extends PBES2
+ public static class HMacWhirlpool
+ extends PBES2
{
-
- // Constructor(s)
- // ----------------------------------------------------------------------
-
public HMacWhirlpool(String cipher, int blockLen)
{
super(cipher, blockLen, "HMAC-WHIRLPOOL");
@@ -1264,10 +1286,8 @@ public abstract class PBES2 extends CipherAdapter
super(cipher, "HMAC-WHIRLPOOL");
}
- // Inner classe(s)
- // ======================================================================
-
- public static class AES extends HMacWhirlpool
+ public static class AES
+ extends HMacWhirlpool
{
public AES()
{
@@ -1275,7 +1295,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Anubis extends HMacWhirlpool
+ public static class Anubis
+ extends HMacWhirlpool
{
public Anubis()
{
@@ -1283,7 +1304,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Blowfish extends HMacWhirlpool
+ public static class Blowfish
+ extends HMacWhirlpool
{
public Blowfish()
{
@@ -1291,7 +1313,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Cast5 extends HMacWhirlpool
+ public static class Cast5
+ extends HMacWhirlpool
{
public Cast5()
{
@@ -1299,7 +1322,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class DES extends HMacWhirlpool
+ public static class DES
+ extends HMacWhirlpool
{
public DES()
{
@@ -1307,7 +1331,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Khazad extends HMacWhirlpool
+ public static class Khazad
+ extends HMacWhirlpool
{
public Khazad()
{
@@ -1315,7 +1340,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Serpent extends HMacWhirlpool
+ public static class Serpent
+ extends HMacWhirlpool
{
public Serpent()
{
@@ -1323,7 +1349,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Square extends HMacWhirlpool
+ public static class Square
+ extends HMacWhirlpool
{
public Square()
{
@@ -1331,7 +1358,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class TripleDES extends HMacWhirlpool
+ public static class TripleDES
+ extends HMacWhirlpool
{
public TripleDES()
{
@@ -1339,7 +1367,8 @@ public abstract class PBES2 extends CipherAdapter
}
}
- public static class Twofish extends HMacWhirlpool
+ public static class Twofish
+ extends HMacWhirlpool
{
public Twofish()
{
diff --git a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
index 137db2c3f..ad61bca59 100644
--- a/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
+++ b/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Rijndael <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class RijndaelSpi extends CipherAdapter
+public final class RijndaelSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public RijndaelSpi()
{
super(Registry.RIJNDAEL_CIPHER, 16);
diff --git a/gnu/javax/crypto/jce/cipher/SerpentSpi.java b/gnu/javax/crypto/jce/cipher/SerpentSpi.java
index 9df9685cc..fa65d34a9 100644
--- a/gnu/javax/crypto/jce/cipher/SerpentSpi.java
+++ b/gnu/javax/crypto/jce/cipher/SerpentSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Serpent <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class SerpentSpi extends CipherAdapter
+public final class SerpentSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public SerpentSpi()
{
super(Registry.SERPENT_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/SquareSpi.java b/gnu/javax/crypto/jce/cipher/SquareSpi.java
index 96e5dee38..bdc656eae 100644
--- a/gnu/javax/crypto/jce/cipher/SquareSpi.java
+++ b/gnu/javax/crypto/jce/cipher/SquareSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Square <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class SquareSpi extends CipherAdapter
+public final class SquareSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public SquareSpi()
{
super(Registry.SQUARE_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
index 5c58ea551..b9ec12b51 100644
--- a/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
+++ b/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Triple-DES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class TripleDESSpi extends CipherAdapter
+public final class TripleDESSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public TripleDESSpi()
{
super(Registry.TRIPLEDES_CIPHER);
diff --git a/gnu/javax/crypto/jce/cipher/TwofishSpi.java b/gnu/javax/crypto/jce/cipher/TwofishSpi.java
index 31df5ea40..206e0d9f8 100644
--- a/gnu/javax/crypto/jce/cipher/TwofishSpi.java
+++ b/gnu/javax/crypto/jce/cipher/TwofishSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Twofish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class TwofishSpi extends CipherAdapter
+public final class TwofishSpi
+ extends CipherAdapter
{
-
- // Constructors.
- // --------------------------------------------------------------------
-
public TwofishSpi()
{
super(Registry.TWOFISH_CIPHER);
diff --git a/gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java
index e8d7788e8..a1cc8fd7f 100644
--- a/gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/AnubisKeyGeneratorImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class AnubisKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class AnubisKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public AnubisKeyGeneratorImpl ()
+ public AnubisKeyGeneratorImpl()
{
- super (Registry.ANUBIS_CIPHER);
+ super(Registry.ANUBIS_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java
index 6442cd696..bea65a6c6 100644
--- a/gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/AnubisSecretKeyFactoryImpl.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package gnu.javax.crypto.jce.key;
-public class AnubisSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class AnubisSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public AnubisSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java
index a0e687acd..2297980fb 100644
--- a/gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/BlowfishKeyGeneratorImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class BlowfishKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class BlowfishKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public BlowfishKeyGeneratorImpl ()
+ public BlowfishKeyGeneratorImpl()
{
- super (Registry.BLOWFISH_CIPHER);
+ super(Registry.BLOWFISH_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java
index 91f97af36..53fe8b0b4 100644
--- a/gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/BlowfishSecretKeyFactoryImpl.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package gnu.javax.crypto.jce.key;
-public class BlowfishSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class BlowfishSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public BlowfishSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java
index 18d26e67f..b328e48b3 100644
--- a/gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/Cast5KeyGeneratorImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class Cast5KeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class Cast5KeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public Cast5KeyGeneratorImpl ()
+ public Cast5KeyGeneratorImpl()
{
- super (Registry.CAST5_CIPHER);
+ super(Registry.CAST5_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java
index 048b54474..fcebb528e 100644
--- a/gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/Cast5SecretKeyFactoryImpl.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package gnu.javax.crypto.jce.key;
-public class Cast5SecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class Cast5SecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public Cast5SecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java
index 19c54653a..2cd29a67f 100644
--- a/gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/DESKeyGeneratorImpl.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
@@ -43,31 +44,25 @@ import gnu.javax.crypto.cipher.DES;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
-public class DESKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class DESKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public DESKeyGeneratorImpl ()
+ public DESKeyGeneratorImpl()
{
- super (Registry.DES_CIPHER);
+ super(Registry.DES_CIPHER);
}
- // Instance methods.
- // -------------------------------------------------------------------------
-
- protected SecretKey engineGenerateKey ()
+ protected SecretKey engineGenerateKey()
{
- if (!init)
- throw new IllegalStateException ("not initialized");
- byte[] buf = new byte [currentKeySize];
+ if (! init)
+ throw new IllegalStateException("not initialized");
+ byte[] buf = new byte[currentKeySize];
do
{
- random.nextBytes (buf);
+ random.nextBytes(buf);
}
- while (DES.isWeak (buf) || DES.isSemiWeak (buf));
- DES.adjustParity (buf, 0);
- return new SecretKeySpec (buf, algorithm);
+ while (DES.isWeak(buf) || DES.isSemiWeak(buf));
+ DES.adjustParity(buf, 0);
+ return new SecretKeySpec(buf, algorithm);
}
}
diff --git a/gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java
index e0f1c5860..a138e2902 100644
--- a/gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/DESSecretKeyFactoryImpl.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import java.security.InvalidKeyException;
@@ -45,36 +46,37 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.DESKeySpec;
import javax.crypto.spec.SecretKeySpec;
-public class DESSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class DESSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public DESSecretKeyFactoryImpl()
{
}
- protected SecretKey engineGenerateSecret (KeySpec spec)
- throws InvalidKeySpecException
+ protected SecretKey engineGenerateSecret(KeySpec spec)
+ throws InvalidKeySpecException
{
if (spec instanceof DESKeySpec)
- return new SecretKeySpec (((DESKeySpec) spec).getKey(), "DES");
- return super.engineGenerateSecret (spec);
+ return new SecretKeySpec(((DESKeySpec) spec).getKey(), "DES");
+ return super.engineGenerateSecret(spec);
}
- protected KeySpec engineGetKeySpec (SecretKey key, Class spec)
- throws InvalidKeySpecException
+ protected KeySpec engineGetKeySpec(SecretKey key, Class spec)
+ throws InvalidKeySpecException
{
- if (spec.isAssignableFrom (DESKeySpec.class))
+ if (spec.isAssignableFrom(DESKeySpec.class))
try
{
- return new DESKeySpec (key.getEncoded());
+ return new DESKeySpec(key.getEncoded());
}
catch (InvalidKeyException ike)
{
- InvalidKeySpecException ikse = new InvalidKeySpecException
- ("can't create DES key spec");
- ikse.initCause (ike);
+ InvalidKeySpecException ikse = new InvalidKeySpecException(
+ "can't create DES key spec");
+ ikse.initCause(ike);
throw ikse;
}
- return super.engineGetKeySpec (key, spec);
+ return super.engineGetKeySpec(key, spec);
}
}
diff --git a/gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java
index 15e109940..f380603e4 100644
--- a/gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/DESedeSecretKeyFactoryImpl.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import java.security.InvalidKeyException;
@@ -45,36 +46,37 @@ import javax.crypto.SecretKey;
import javax.crypto.spec.DESedeKeySpec;
import javax.crypto.spec.SecretKeySpec;
-public class DESedeSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class DESedeSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public DESedeSecretKeyFactoryImpl()
{
}
- protected SecretKey engineGenerateSecret (KeySpec spec)
- throws InvalidKeySpecException
+ protected SecretKey engineGenerateSecret(KeySpec spec)
+ throws InvalidKeySpecException
{
if (spec instanceof DESedeKeySpec)
- return new SecretKeySpec (((DESedeKeySpec) spec).getKey(), "DESede");
- return super.engineGenerateSecret (spec);
+ return new SecretKeySpec(((DESedeKeySpec) spec).getKey(), "DESede");
+ return super.engineGenerateSecret(spec);
}
- protected KeySpec engineGetKeySpec (SecretKey key, Class spec)
- throws InvalidKeySpecException
+ protected KeySpec engineGetKeySpec(SecretKey key, Class spec)
+ throws InvalidKeySpecException
{
- if (spec.equals (DESedeKeySpec.class))
+ if (spec.equals(DESedeKeySpec.class))
try
{
- return new DESedeKeySpec (key.getEncoded());
+ return new DESedeKeySpec(key.getEncoded());
}
catch (InvalidKeyException ike)
{
- InvalidKeySpecException ikse = new InvalidKeySpecException
- ("can't create DESede key spec");
- ikse.initCause (ike);
+ InvalidKeySpecException ikse = new InvalidKeySpecException(
+ "can't create DESede key spec");
+ ikse.initCause(ike);
throw ikse;
}
- return super.engineGetKeySpec (key, spec);
+ return super.engineGetKeySpec(key, spec);
}
}
diff --git a/gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java
index c01391e44..21ae627eb 100644
--- a/gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/KhazadKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class KhazadKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class KhazadKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public KhazadKeyGeneratorImpl ()
+ public KhazadKeyGeneratorImpl()
{
- super (Registry.KHAZAD_CIPHER);
+ super(Registry.KHAZAD_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java
index 6c7ab42f7..19315d22e 100644
--- a/gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/KhazadSecretKeyFactoryImpl.java
@@ -35,9 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
-public class KhazadSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class KhazadSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public KhazadSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java
index 535e573ad..b60f7d6d0 100644
--- a/gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/RijndaelKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class RijndaelKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class RijndaelKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public RijndaelKeyGeneratorImpl ()
+ public RijndaelKeyGeneratorImpl()
{
- super (Registry.RIJNDAEL_CIPHER);
+ super(Registry.RIJNDAEL_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java
index d46191644..f88b07752 100644
--- a/gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/RijndaelSecretKeyFactoryImpl.java
@@ -35,9 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
-public class RijndaelSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class RijndaelSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public RijndaelSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java
index 72defe1d7..4bba171f9 100644
--- a/gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/SecretKeyFactoryImpl.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import java.security.InvalidKeyException;
@@ -45,43 +46,42 @@ import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactorySpi;
import javax.crypto.spec.SecretKeySpec;
-public abstract class SecretKeyFactoryImpl extends SecretKeyFactorySpi
+public abstract class SecretKeyFactoryImpl
+ extends SecretKeyFactorySpi
{
protected SecretKeyFactoryImpl()
{
}
- protected SecretKey engineGenerateSecret (KeySpec spec)
- throws InvalidKeySpecException
+ protected SecretKey engineGenerateSecret(KeySpec spec)
+ throws InvalidKeySpecException
{
if (spec instanceof SecretKeySpec)
return (SecretKey) spec;
- throw new InvalidKeySpecException ("unknown key spec: " +
- spec.getClass().getName());
+ throw new InvalidKeySpecException("unknown key spec: "
+ + spec.getClass().getName());
}
- protected KeySpec engineGetKeySpec (SecretKey key, Class spec)
- throws InvalidKeySpecException
+ protected KeySpec engineGetKeySpec(SecretKey key, Class spec)
+ throws InvalidKeySpecException
{
- if (spec.equals (SecretKeySpec.class))
+ if (spec.equals(SecretKeySpec.class))
{
if (key instanceof SecretKeySpec)
return (KeySpec) key;
else
- return new SecretKeySpec (key.getEncoded(), key.getAlgorithm());
+ return new SecretKeySpec(key.getEncoded(), key.getAlgorithm());
}
- throw new InvalidKeySpecException ("unsupported key spec: " +
- spec.getName());
+ throw new InvalidKeySpecException("unsupported key spec: " + spec.getName());
}
- protected SecretKey engineTranslateKey (SecretKey key)
- throws InvalidKeyException
+ protected SecretKey engineTranslateKey(SecretKey key)
+ throws InvalidKeyException
{
- if (!"RAW".equals (key.getFormat()))
- throw new InvalidKeyException ("only raw keys are supported");
-
+ if (! "RAW".equals(key.getFormat()))
+ throw new InvalidKeyException("only raw keys are supported");
// SecretKeySpec is good enough for our purposes.
- return new SecretKeySpec (key.getEncoded(), key.getAlgorithm());
+ return new SecretKeySpec(key.getEncoded(), key.getAlgorithm());
}
}
diff --git a/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java
index 567122277..319b0eaeb 100644
--- a/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/SecretKeyGeneratorImpl.java
@@ -35,6 +35,7 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.javax.crypto.cipher.CipherFactory;
@@ -53,12 +54,9 @@ import javax.crypto.KeyGeneratorSpi;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
-public class SecretKeyGeneratorImpl extends KeyGeneratorSpi
+public class SecretKeyGeneratorImpl
+ extends KeyGeneratorSpi
{
-
- // Fields.
- // -------------------------------------------------------------------------
-
protected final int defaultKeySize;
protected final List keySizes;
protected final String algorithm;
@@ -66,55 +64,47 @@ public class SecretKeyGeneratorImpl extends KeyGeneratorSpi
protected int currentKeySize;
protected SecureRandom random;
- // Constructors.
- // -------------------------------------------------------------------------
-
- protected SecretKeyGeneratorImpl (final String algorithm)
+ protected SecretKeyGeneratorImpl(final String algorithm)
{
this.algorithm = algorithm;
- IBlockCipher cipher = CipherFactory.getInstance (algorithm);
+ IBlockCipher cipher = CipherFactory.getInstance(algorithm);
if (cipher == null)
- throw new IllegalArgumentException ("no such cipher: "+algorithm);
- defaultKeySize = cipher.defaultKeySize ();
+ throw new IllegalArgumentException("no such cipher: " + algorithm);
+ defaultKeySize = cipher.defaultKeySize();
keySizes = new LinkedList();
- for (Iterator it = cipher.keySizes (); it.hasNext (); )
- {
- keySizes.add (it.next ());
- }
+ for (Iterator it = cipher.keySizes(); it.hasNext();)
+ keySizes.add(it.next());
init = false;
}
- // Instance methods.
- // -------------------------------------------------------------------------
-
- protected SecretKey engineGenerateKey ()
+ protected SecretKey engineGenerateKey()
{
- if (!init)
- throw new IllegalStateException ("not initialized");
- byte[] buf = new byte [currentKeySize];
- random.nextBytes (buf);
- return new SecretKeySpec (buf, algorithm);
+ if (! init)
+ throw new IllegalStateException("not initialized");
+ byte[] buf = new byte[currentKeySize];
+ random.nextBytes(buf);
+ return new SecretKeySpec(buf, algorithm);
}
- protected void engineInit (AlgorithmParameterSpec params, SecureRandom random)
- throws InvalidAlgorithmParameterException
+ protected void engineInit(AlgorithmParameterSpec params, SecureRandom random)
+ throws InvalidAlgorithmParameterException
{
- throw new InvalidAlgorithmParameterException (algorithm +
- " does not support algorithm paramaters");
+ throw new InvalidAlgorithmParameterException(
+ algorithm + " does not support algorithm paramaters");
}
- protected void engineInit (int keySize, SecureRandom random)
+ protected void engineInit(int keySize, SecureRandom random)
{
keySize >>>= 3; // Use bytes.
if (! keySizes.contains(Integer.valueOf(keySize)))
- throw new InvalidParameterException ("unsupported key size: " + keySize);
+ throw new InvalidParameterException("unsupported key size: " + keySize);
currentKeySize = keySize;
this.random = random;
init = true;
}
- protected void engineInit (SecureRandom random)
+ protected void engineInit(SecureRandom random)
{
- engineInit (defaultKeySize << 3, random);
+ engineInit(defaultKeySize << 3, random);
}
}
diff --git a/gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java
index 766860a96..c53190514 100644
--- a/gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/SerpentKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class SerpentKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class SerpentKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public SerpentKeyGeneratorImpl ()
+ public SerpentKeyGeneratorImpl()
{
- super (Registry.SERPENT_CIPHER);
+ super(Registry.SERPENT_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java
index 9f06bf329..5d5ac88df 100644
--- a/gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/SerpentSecretKeyFactoryImpl.java
@@ -35,9 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
-public class SerpentSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class SerpentSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public SerpentSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java
index 4bfbeb668..3d496e8a9 100644
--- a/gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/SquareKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class SquareKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class SquareKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public SquareKeyGeneratorImpl ()
+ public SquareKeyGeneratorImpl()
{
- super (Registry.SQUARE_CIPHER);
+ super(Registry.SQUARE_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java
index fce7375b3..f35835912 100644
--- a/gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/SquareSecretKeyFactoryImpl.java
@@ -35,9 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
-public class SquareSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class SquareSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public SquareSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java
index eb423fcd1..6fd557ccb 100644
--- a/gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/TripleDESKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class TripleDESKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class TripleDESKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public TripleDESKeyGeneratorImpl ()
+ public TripleDESKeyGeneratorImpl()
{
- super (Registry.TRIPLEDES_CIPHER);
+ super(Registry.TRIPLEDES_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java b/gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java
index ae7e22fee..9dd5a8f30 100644
--- a/gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java
+++ b/gnu/javax/crypto/jce/key/TwofishKeyGeneratorImpl.java
@@ -35,18 +35,16 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
import gnu.java.security.Registry;
-public class TwofishKeyGeneratorImpl extends SecretKeyGeneratorImpl
+public class TwofishKeyGeneratorImpl
+ extends SecretKeyGeneratorImpl
{
-
- // Constructors.
- // -------------------------------------------------------------------------
-
- public TwofishKeyGeneratorImpl ()
+ public TwofishKeyGeneratorImpl()
{
- super (Registry.TWOFISH_CIPHER);
+ super(Registry.TWOFISH_CIPHER);
}
}
diff --git a/gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java b/gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java
index a182d4116..0767d4cac 100644
--- a/gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java
+++ b/gnu/javax/crypto/jce/key/TwofishSecretKeyFactoryImpl.java
@@ -35,9 +35,11 @@ this exception to your version of the library, but you are not
obligated to do so. If you do not wish to do so, delete this
exception statement from your version. */
+
package gnu.javax.crypto.jce.key;
-public class TwofishSecretKeyFactoryImpl extends SecretKeyFactoryImpl
+public class TwofishSecretKeyFactoryImpl
+ extends SecretKeyFactoryImpl
{
public TwofishSecretKeyFactoryImpl()
{
diff --git a/gnu/javax/crypto/jce/keyring/GnuKeyring.java b/gnu/javax/crypto/jce/keyring/GnuKeyring.java
index 6f1dcd51f..4fcf2fde7 100644
--- a/gnu/javax/crypto/jce/keyring/GnuKeyring.java
+++ b/gnu/javax/crypto/jce/keyring/GnuKeyring.java
@@ -419,8 +419,9 @@ public class GnuKeyring
int usage = in.read();
in.reset();
if (usage != GnuPrivateKeyring.USAGE)
- throw new MalformedKeyringException("Was expecting a private keyring but got a wrong USAGE: "
- + Integer.toBinaryString(usage));
+ throw new MalformedKeyringException(
+ "Was expecting a private keyring but got a wrong USAGE: "
+ + Integer.toBinaryString(usage));
HashMap attr = new HashMap();
attr.put(IKeyring.KEYRING_DATA_IN, in);
attr.put(IKeyring.KEYRING_PASSWORD, password);
@@ -451,8 +452,9 @@ public class GnuKeyring
int usage = in.read();
in.reset();
if (usage != GnuPublicKeyring.USAGE)
- throw new MalformedKeyringException("Was expecting a public keyring but got a wrong USAGE: "
- + Integer.toBinaryString(usage));
+ throw new MalformedKeyringException(
+ "Was expecting a public keyring but got a wrong USAGE: "
+ + Integer.toBinaryString(usage));
HashMap attr = new HashMap();
attr.put(IKeyring.KEYRING_DATA_IN, in);
attr.put(IKeyring.KEYRING_PASSWORD, password);
diff --git a/gnu/javax/crypto/jce/mac/HMacHavalSpi.java b/gnu/javax/crypto/jce/mac/HMacHavalSpi.java
index df1319cbf..2967ee900 100644
--- a/gnu/javax/crypto/jce/mac/HMacHavalSpi.java
+++ b/gnu/javax/crypto/jce/mac/HMacHavalSpi.java
@@ -37,31 +37,18 @@ exception statement from your version. */
package gnu.javax.crypto.jce.mac;
+
import gnu.java.security.Registry;
/**
* The implementation of the HMAC-HAVAL <i>Service Provider Interface</i>
* (<b>SPI</b>) Adapter.
- *
- * @version Revision: $
*/
-public class HMacHavalSpi extends MacAdapter
+public class HMacHavalSpi
+ extends MacAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -------------------------------------------------------------------------
-
public HMacHavalSpi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.HAVAL_HASH);
}
-
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
index dd489639f..dd6485866 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-MD2 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacMD2Spi extends MacAdapter
+public final class HMacMD2Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacMD2Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD2_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
index 6fadf0262..939851ff5 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-MD4 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacMD4Spi extends MacAdapter
+public final class HMacMD4Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacMD4Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD4_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
index 2ef43974f..e89fbfdba 100644
--- a/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-MD5 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacMD5Spi extends MacAdapter
+public final class HMacMD5Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacMD5Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD5_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
index ad7a2340e..834ec849a 100644
--- a/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-RIPEMD-128 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacRipeMD128Spi extends MacAdapter
+public final class HMacRipeMD128Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacRipeMD128Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD128_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
index c14e3b3bf..b973ea186 100644
--- a/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-RIPEMD-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacRipeMD160Spi extends MacAdapter
+public final class HMacRipeMD160Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacRipeMD160Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD160_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
index f102c9ebc..524aa8233 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-SHA-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacSHA160Spi extends MacAdapter
+public final class HMacSHA160Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacSHA160Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA160_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
index cadad1cf5..4b0493bc6 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
@@ -37,29 +37,18 @@ exception statement from your version. */
package gnu.javax.crypto.jce.mac;
+
import gnu.java.security.Registry;
/**
- * <p>The implementation of the HMAC-SHA-256 <i>Service Provider Interface</i>
- * (<b>SPI</b>) adapter.</p>
+ * The implementation of the HMAC-SHA-256 <i>Service Provider Interface</i>
+ * (<b>SPI</b>) adapter.
*/
-public final class HMacSHA256Spi extends MacAdapter
+public final class HMacSHA256Spi
+ extends MacAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -----------------------------------------------------------------------
-
public HMacSHA256Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA256_HASH);
}
-
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
index 69ef38e50..92a5c9d2c 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
@@ -37,29 +37,18 @@ exception statement from your version. */
package gnu.javax.crypto.jce.mac;
+
import gnu.java.security.Registry;
/**
- * <p>The implementation of the HMAC-SHA-384 <i>Service Provider Interface</i>
- * (<b>SPI</b>) adapter.</p>
+ * The implementation of the HMAC-SHA-384 <i>Service Provider Interface</i>
+ * (<b>SPI</b>) adapter.
*/
-public class HMacSHA384Spi extends MacAdapter
+public class HMacSHA384Spi
+ extends MacAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -----------------------------------------------------------------------
-
public HMacSHA384Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA384_HASH);
}
-
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
}
diff --git a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
index abceb4a92..f1ecd02e5 100644
--- a/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
+++ b/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
@@ -37,29 +37,18 @@ exception statement from your version. */
package gnu.javax.crypto.jce.mac;
+
import gnu.java.security.Registry;
/**
- * <p>The implementation of the HMAC-SHA-512 <i>Service Provider Interface</i>
- * (<b>SPI</b>) adapter.</p>
+ * The implementation of the HMAC-SHA-512 <i>Service Provider Interface</i>
+ * (<b>SPI</b>) adapter.
*/
-public class HMacSHA512Spi extends MacAdapter
+public class HMacSHA512Spi
+ extends MacAdapter
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
- // Constructor(s)
- // -----------------------------------------------------------------------
-
public HMacSHA512Spi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA512_HASH);
}
-
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
}
diff --git a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
index 511993ea4..2d417ef4c 100644
--- a/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
+++ b/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the Tiger <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacTigerSpi extends MacAdapter
+public final class HMacTigerSpi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacTigerSpi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.TIGER_HASH);
diff --git a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
index 706e0cd5a..1b936d71a 100644
--- a/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
+++ b/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the HMAC-Whirlpool <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class HMacWhirlpoolSpi extends MacAdapter
+public final class HMacWhirlpoolSpi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public HMacWhirlpoolSpi()
{
super(Registry.HMAC_NAME_PREFIX + Registry.WHIRLPOOL_HASH);
diff --git a/gnu/javax/crypto/jce/mac/MacAdapter.java b/gnu/javax/crypto/jce/mac/MacAdapter.java
index dc019ca20..d8c800ac7 100644
--- a/gnu/javax/crypto/jce/mac/MacAdapter.java
+++ b/gnu/javax/crypto/jce/mac/MacAdapter.java
@@ -50,32 +50,26 @@ import java.util.Map;
import javax.crypto.MacSpi;
/**
- * <p>The implementation of a generic {@link javax.crypto.Mac} adapter class
- * to wrap GNU Crypto MAC instances.</p>
- *
- * <p>This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for
+ * The implementation of a generic {@link javax.crypto.Mac} adapter class to
+ * wrap GNU MAC instances.
+ * <p>
+ * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for
* the {@link javax.crypto.Mac} class, which provides the functionality of a
* message authentication code algorithm, such as the <i>Hashed Message
- * Authentication Code</i> (<b>HMAC</b>) algorithms.</p>
+ * Authentication Code</i> (<b>HMAC</b>) algorithms.
*/
-class MacAdapter extends MacSpi implements Cloneable
+class MacAdapter
+ extends MacSpi
+ implements Cloneable
{
-
- // Constants and variables
- // -----------------------------------------------------------------------
-
/** Our MAC instance. */
protected IMac mac;
-
/** Our MAC attributes. */
protected Map attributes;
- // Constructor(s)
- // -----------------------------------------------------------------------
-
/**
- * <p>Creates a new Mac instance for the given name.</p>
- *
+ * Creates a new Mac instance for the given name.
+ *
* @param name The name of the mac to create.
*/
protected MacAdapter(String name)
@@ -88,7 +82,7 @@ class MacAdapter extends MacSpi implements Cloneable
* Private constructor for cloning purposes.
*
* @param mac a clone of the internal {@link IMac} instance.
- * @param attributes a clone of the current {@link Map} of attributes.
+ * @param attributes a clone of the current {@link Map} of attributes.
*/
private MacAdapter(IMac mac, Map attributes)
{
@@ -98,21 +92,11 @@ class MacAdapter extends MacSpi implements Cloneable
this.attributes = attributes;
}
- // Class methods
- // -----------------------------------------------------------------------
-
- // Instance methods
- // -----------------------------------------------------------------------
-
- // Cloneable interface implementation ------------------------------------
-
public Object clone() throws CloneNotSupportedException
{
return new MacAdapter((IMac) mac.clone(), new HashMap(attributes));
}
- // Instance methods implementing javax.crypto.MacSpi ---------------------
-
protected byte[] engineDoFinal()
{
byte[] result = mac.digest();
@@ -128,10 +112,8 @@ class MacAdapter extends MacSpi implements Cloneable
protected void engineInit(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
- if (!key.getFormat().equalsIgnoreCase("RAW"))
- {
- throw new InvalidKeyException("unknown key format " + key.getFormat());
- }
+ if (! key.getFormat().equalsIgnoreCase("RAW"))
+ throw new InvalidKeyException("unknown key format " + key.getFormat());
attributes.put(IMac.MAC_KEY_MATERIAL, key.getEncoded());
mac.reset();
mac.init(attributes);
diff --git a/gnu/javax/crypto/jce/mac/OMacAnubisImpl.java b/gnu/javax/crypto/jce/mac/OMacAnubisImpl.java
index 4bfda4fd6..566e56fd1 100644
--- a/gnu/javax/crypto/jce/mac/OMacAnubisImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacAnubisImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacAnubisImpl extends MacAdapter
+public class OMacAnubisImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacAnubisImpl()
{
super(Registry.OMAC_PREFIX + Registry.ANUBIS_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java b/gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java
index 8d168e57b..55768166f 100644
--- a/gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacBlowfishImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacBlowfishImpl extends MacAdapter
+public class OMacBlowfishImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacBlowfishImpl()
{
super(Registry.OMAC_PREFIX + Registry.BLOWFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacCast5Impl.java b/gnu/javax/crypto/jce/mac/OMacCast5Impl.java
index 3385d116b..535352c39 100644
--- a/gnu/javax/crypto/jce/mac/OMacCast5Impl.java
+++ b/gnu/javax/crypto/jce/mac/OMacCast5Impl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacCast5Impl extends MacAdapter
+public class OMacCast5Impl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacCast5Impl()
{
super(Registry.OMAC_PREFIX + Registry.CAST5_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacDESImpl.java b/gnu/javax/crypto/jce/mac/OMacDESImpl.java
index 3fb23bdef..a01c0ac87 100644
--- a/gnu/javax/crypto/jce/mac/OMacDESImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacDESImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacDESImpl extends MacAdapter
+public class OMacDESImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacDESImpl()
{
super(Registry.OMAC_PREFIX + Registry.DES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacImpl.java b/gnu/javax/crypto/jce/mac/OMacImpl.java
index bf30d8e13..960c68aaf 100644
--- a/gnu/javax/crypto/jce/mac/OMacImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacImpl.java
@@ -40,21 +40,16 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public abstract class OMacImpl extends MacAdapter
+public abstract class OMacImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
protected OMacImpl(String name)
{
super(Registry.OMAC_PREFIX + name);
}
- // Inner classes.
- // -------------------------------------------------------------------------
-
- public class Anubis extends OMacImpl
+ public class Anubis
+ extends OMacImpl
{
public Anubis()
{
@@ -62,7 +57,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Blowfish extends OMacImpl
+ public class Blowfish
+ extends OMacImpl
{
public Blowfish()
{
@@ -70,7 +66,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Cast5 extends OMacImpl
+ public class Cast5
+ extends OMacImpl
{
public Cast5()
{
@@ -78,7 +75,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class DES extends OMacImpl
+ public class DES
+ extends OMacImpl
{
public DES()
{
@@ -86,7 +84,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Khazad extends OMacImpl
+ public class Khazad
+ extends OMacImpl
{
public Khazad()
{
@@ -94,7 +93,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Rijndael extends OMacImpl
+ public class Rijndael
+ extends OMacImpl
{
public Rijndael()
{
@@ -102,7 +102,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Serpent extends OMacImpl
+ public class Serpent
+ extends OMacImpl
{
public Serpent()
{
@@ -110,7 +111,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Square extends OMacImpl
+ public class Square
+ extends OMacImpl
{
public Square()
{
@@ -118,7 +120,8 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class TripleDES extends OMacImpl
+ public class TripleDES
+ extends OMacImpl
{
public TripleDES()
{
@@ -126,11 +129,12 @@ public abstract class OMacImpl extends MacAdapter
}
}
- public class Twofish extends OMacImpl
+ public class Twofish
+ extends OMacImpl
{
public Twofish()
{
super(Registry.TWOFISH_CIPHER);
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacKhazadImpl.java b/gnu/javax/crypto/jce/mac/OMacKhazadImpl.java
index 82c047c25..c349f9f5e 100644
--- a/gnu/javax/crypto/jce/mac/OMacKhazadImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacKhazadImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacKhazadImpl extends MacAdapter
+public class OMacKhazadImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacKhazadImpl()
{
super(Registry.OMAC_PREFIX + Registry.KHAZAD_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java b/gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java
index 47d3f6aae..d63b777a3 100644
--- a/gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacRijndaelImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacRijndaelImpl extends MacAdapter
+public class OMacRijndaelImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacRijndaelImpl()
{
super(Registry.OMAC_PREFIX + Registry.RIJNDAEL_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacSerpentImpl.java b/gnu/javax/crypto/jce/mac/OMacSerpentImpl.java
index bec2c1f5c..5c1b8a9b9 100644
--- a/gnu/javax/crypto/jce/mac/OMacSerpentImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacSerpentImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacSerpentImpl extends MacAdapter
+public class OMacSerpentImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacSerpentImpl()
{
super(Registry.OMAC_PREFIX + Registry.SERPENT_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacSquareImpl.java b/gnu/javax/crypto/jce/mac/OMacSquareImpl.java
index 0442b7caf..c9d1b1aca 100644
--- a/gnu/javax/crypto/jce/mac/OMacSquareImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacSquareImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacSquareImpl extends MacAdapter
+public class OMacSquareImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacSquareImpl()
{
super(Registry.OMAC_PREFIX + Registry.SQUARE_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java b/gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java
index 0defdd1fd..4f58723d3 100644
--- a/gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacTripleDESImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacTripleDESImpl extends MacAdapter
+public class OMacTripleDESImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacTripleDESImpl()
{
super(Registry.OMAC_PREFIX + Registry.TRIPLEDES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/OMacTwofishImpl.java b/gnu/javax/crypto/jce/mac/OMacTwofishImpl.java
index a12f9f30e..4c816a096 100644
--- a/gnu/javax/crypto/jce/mac/OMacTwofishImpl.java
+++ b/gnu/javax/crypto/jce/mac/OMacTwofishImpl.java
@@ -40,14 +40,11 @@ package gnu.javax.crypto.jce.mac;
import gnu.java.security.Registry;
-public class OMacTwofishImpl extends MacAdapter
+public class OMacTwofishImpl
+ extends MacAdapter
{
-
- // Constructor.
- // -------------------------------------------------------------------------
-
public OMacTwofishImpl()
{
super(Registry.OMAC_PREFIX + Registry.TWOFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/mac/TMMH16Spi.java b/gnu/javax/crypto/jce/mac/TMMH16Spi.java
index 1734e1e69..8a40f6e70 100644
--- a/gnu/javax/crypto/jce/mac/TMMH16Spi.java
+++ b/gnu/javax/crypto/jce/mac/TMMH16Spi.java
@@ -51,27 +51,19 @@ import java.security.spec.AlgorithmParameterSpec;
* The implementation of the TMMH16 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class TMMH16Spi extends MacAdapter
+public final class TMMH16Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public TMMH16Spi()
{
super(Registry.TMMH16);
}
- // Instance methods overriding MacAdapter.
- // -----------------------------------------------------------------------
-
protected void engineInit(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
- if (!(params instanceof TMMHParameterSpec))
- {
- throw new InvalidAlgorithmParameterException();
- }
+ if (! (params instanceof TMMHParameterSpec))
+ throw new InvalidAlgorithmParameterException();
TMMHParameterSpec spec = (TMMHParameterSpec) params;
attributes.put(TMMH16.TAG_LENGTH, spec.getTagLength());
attributes.put(TMMH16.KEYSTREAM, spec.getKeystream());
diff --git a/gnu/javax/crypto/jce/mac/UHash32Spi.java b/gnu/javax/crypto/jce/mac/UHash32Spi.java
index af678c0fa..825edc173 100644
--- a/gnu/javax/crypto/jce/mac/UHash32Spi.java
+++ b/gnu/javax/crypto/jce/mac/UHash32Spi.java
@@ -44,12 +44,9 @@ import gnu.java.security.Registry;
* The implementation of the UHash-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class UHash32Spi extends MacAdapter
+public final class UHash32Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public UHash32Spi()
{
super(Registry.UHASH32);
diff --git a/gnu/javax/crypto/jce/mac/UMac32Spi.java b/gnu/javax/crypto/jce/mac/UMac32Spi.java
index 4e90468b1..fc05e5321 100644
--- a/gnu/javax/crypto/jce/mac/UMac32Spi.java
+++ b/gnu/javax/crypto/jce/mac/UMac32Spi.java
@@ -51,32 +51,22 @@ import java.security.spec.AlgorithmParameterSpec;
* The implementation of the UMAC-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
*/
-public final class UMac32Spi extends MacAdapter
+public final class UMac32Spi
+ extends MacAdapter
{
-
- // Constructors.
- // -----------------------------------------------------------------------
-
public UMac32Spi()
{
super(Registry.UMAC32);
}
- // Instance methods overriding MacAdapter.
- // -----------------------------------------------------------------------
-
protected void engineInit(Key key, AlgorithmParameterSpec params)
throws InvalidKeyException, InvalidAlgorithmParameterException
{
- if (!(params instanceof UMac32ParameterSpec))
- {
- throw new InvalidAlgorithmParameterException();
- }
+ if (! (params instanceof UMac32ParameterSpec))
+ throw new InvalidAlgorithmParameterException();
if (params != null)
- {
- attributes.put(UMac32.NONCE_MATERIAL,
- ((UMac32ParameterSpec) params).getNonce());
- }
+ attributes.put(UMac32.NONCE_MATERIAL,
+ ((UMac32ParameterSpec) params).getNonce());
try
{
super.engineInit(key, null);
diff --git a/gnu/javax/crypto/jce/params/BlockCipherParameters.java b/gnu/javax/crypto/jce/params/BlockCipherParameters.java
index bae7cbf88..2292678d6 100644
--- a/gnu/javax/crypto/jce/params/BlockCipherParameters.java
+++ b/gnu/javax/crypto/jce/params/BlockCipherParameters.java
@@ -48,38 +48,28 @@ import java.security.spec.AlgorithmParameterSpec;
import java.security.spec.InvalidParameterSpecException;
/**
- * An implementation of algorithm parameters for the GNU Crypto block
- * ciphers. This encompasses the cipher's block size, its key size, and
- * an optional initialization vector (IV).
+ * An implementation of algorithm parameters for the GNU block ciphers. This
+ * encompasses the cipher's block size, its key size, and an optional
+ * initialization vector (IV).
*/
-public class BlockCipherParameters extends AlgorithmParametersSpi
+public class BlockCipherParameters
+ extends AlgorithmParametersSpi
{
-
- // Constants and variables.
- // -----------------------------------------------------------------------
-
- /**
- * The underlying block cipher specification.
- */
+ /** The underlying block cipher specification. */
protected BlockCipherParameterSpec cipherSpec;
-
private static final String DEFAULT_FORMAT = "ASN.1";
- // Instance methods implementing AlgorithmParametersSpi.
- // -----------------------------------------------------------------------
-
/**
* Return these parameters encoded in ASN.1 (DER).
- *
- * <p>For GNU Crypto block ciphers we will define these parameters as
- *
- * <blockquote>
- * <pre>BlockCipherParameters ::= SEQUENCE {
- * blockSize INTEGER,
- * keySize INTEGER,
- * initializationVector OCTET STRING OPTIONAL }</pre>
- * </blockquote>
- *
+ * <p>
+ * For GNU block ciphers we will define these parameters as
+ * <pre>
+ * BlockCipherParameters ::= SEQUENCE {
+ * blockSize INTEGER,
+ * keySize INTEGER,
+ * initializationVector OCTET STRING OPTIONAL }
+ * </pre>
+ *
* @return The parameters, encoded an an ASN.1 DER sequence.
* @throws java.io.IOException If encoding these parameters fails.
*/
@@ -90,104 +80,45 @@ public class BlockCipherParameters extends AlgorithmParametersSpi
protected byte[] engineGetEncoded(String format) throws IOException
{
- if (!format.equalsIgnoreCase(DEFAULT_FORMAT)
- && !format.equalsIgnoreCase("asn1"))
- {
- throw new IOException("unknown format \"" + format + "\"");
- }
- // This is probably a bad idea.
- /*
- int len = 12 + ((cipherSpec.getIV() != null)
- ? cipherSpec.getIV().length + 2 : 0);
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- out.write(0x30);
- out.write(len);
- out.write(0x02);
- out.write(4);
- out.write(cipherSpec.getBlockSize() >>> 24 & 0xff);
- out.write(cipherSpec.getBlockSize() >>> 16 & 0xff);
- out.write(cipherSpec.getBlockSize() >>> 8 & 0xff);
- out.write(cipherSpec.getBlockSize() & 0xff);
- out.write(0x02);
- out.write(4);
- out.write(cipherSpec.getKeySize() >>> 24 & 0xff);
- out.write(cipherSpec.getKeySize() >>> 16 & 0xff);
- out.write(cipherSpec.getKeySize() >>> 8 & 0xff);
- out.write(cipherSpec.getKeySize() & 0xff);
- if (cipherSpec.getIV() != null) {
- out.write(0x04);
- len = cipherSpec.getIV().length;
- out.write(len & 0xff);
- out.write(cipherSpec.getIV());
- }
- out.write(0); out.write(0);
- return out.toByteArray();*/
+ if (! format.equalsIgnoreCase(DEFAULT_FORMAT)
+ && ! format.equalsIgnoreCase("asn1"))
+ throw new IOException("unknown format \"" + format + "\"");
DERWriter writer = new DERWriter();
+ int cipherBlockSize = cipherSpec.getBlockSize();
+ int cipherKeySize = cipherSpec.getKeySize();
+ byte[] iv = cipherSpec.getIV();
return writer.joinarrays(
- writer.writeBigInteger(BigInteger.valueOf(cipherSpec.getBlockSize())),
- writer.writeBigInteger(BigInteger.valueOf(cipherSpec.getKeySize())),
- (cipherSpec.getIV() != null) ? writer.writeBigInteger(new BigInteger(
- cipherSpec.getIV()))
- : new byte[0]);
+ writer.writeBigInteger(BigInteger.valueOf(cipherBlockSize)),
+ writer.writeBigInteger(BigInteger.valueOf(cipherKeySize)),
+ (iv != null) ? writer.writeBigInteger(new BigInteger(iv))
+ : new byte[0]);
}
protected void engineInit(AlgorithmParameterSpec spec)
throws InvalidParameterSpecException
{
if (spec instanceof BlockCipherParameterSpec)
- {
- cipherSpec = (BlockCipherParameterSpec) spec;
- }
+ cipherSpec = (BlockCipherParameterSpec) spec;
else
- {
- throw new InvalidParameterSpecException();
- }
+ throw new InvalidParameterSpecException();
}
protected void engineInit(byte[] encoded, String format) throws IOException
{
- if (!format.equalsIgnoreCase(DEFAULT_FORMAT)
- && !format.equalsIgnoreCase("ASN1"))
- {
- throw new IOException("invalid format: only accepts ASN.1");
- }
+ if (! format.equalsIgnoreCase(DEFAULT_FORMAT)
+ && ! format.equalsIgnoreCase("ASN1"))
+ throw new IOException("invalid format: only accepts ASN.1");
engineInit(encoded);
}
protected void engineInit(byte[] encoded) throws IOException
{
- // This is probably an equally bad idea.
- /*if (encoded[0] != 0x30) {
- throw new IOException("malformed ASN.1 sequence");
- }
- if (encoded[2] != 0x02 || encoded[3] != 4) {
- throw new IOException("malformed ASN.1 sequence");
- }
- int blockSize = encoded[4] << 24 | encoded[5] << 16
- | encoded[6] << 8 | encoded[7];
- if (encoded[8] != 0x02 || encoded[9] != 4) {
- throw new IOException("malformed ASN.1 sequence");
- }
- int keySize = encoded[10] << 24 | encoded[11] << 16
- | encoded[12] << 8 | encoded[13];
- if (encoded[14] == 0x04) {
- int len = encoded[15] & 0xff;
- byte[] iv = new byte[len];
- System.arraycopy(encoded, 16, iv, 0, len);
- cipherSpec = new BlockCipherParameterSpec(iv, blockSize, keySize);
- } else if (encoded[14] == 0) {
- cipherSpec = new BlockCipherParameterSpec(blockSize, keySize);
- } else {
- throw new IOException("malformed ASN.1 sequence");
- }*/
DERReader reader = new DERReader(encoded);
int bs = reader.getBigInteger().intValue();
int ks = reader.getBigInteger().intValue();
byte[] iv = null;
if (reader.hasMorePrimitives())
- {
- iv = reader.getBigInteger().toByteArray();
- }
+ iv = reader.getBigInteger().toByteArray();
cipherSpec = new BlockCipherParameterSpec(iv, bs, ks);
System.out.println(cipherSpec);
}
@@ -196,9 +127,7 @@ public class BlockCipherParameters extends AlgorithmParametersSpi
throws InvalidParameterSpecException
{
if (c.isInstance(cipherSpec))
- {
- return cipherSpec;
- }
+ return cipherSpec;
throw new InvalidParameterSpecException();
}
@@ -206,4 +135,4 @@ public class BlockCipherParameters extends AlgorithmParametersSpi
{
return cipherSpec.toString();
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/params/DEREncodingException.java b/gnu/javax/crypto/jce/params/DEREncodingException.java
index ddfa6e1de..b89ceda9f 100644
--- a/gnu/javax/crypto/jce/params/DEREncodingException.java
+++ b/gnu/javax/crypto/jce/params/DEREncodingException.java
@@ -38,7 +38,8 @@ exception statement from your version. */
package gnu.javax.crypto.jce.params;
-class DEREncodingException extends java.io.IOException
+class DEREncodingException
+ extends java.io.IOException
{
public DEREncodingException()
@@ -50,4 +51,4 @@ class DEREncodingException extends java.io.IOException
{
super(msg);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/params/DERReader.java b/gnu/javax/crypto/jce/params/DERReader.java
index f61423255..68c680279 100644
--- a/gnu/javax/crypto/jce/params/DERReader.java
+++ b/gnu/javax/crypto/jce/params/DERReader.java
@@ -43,15 +43,10 @@ import java.math.BigInteger;
class DERReader
{
byte source[];
-
int pos;
-
static final int UNIVERSAL = 1;
-
static final int APPLICATION = 2;
-
static final int CONTEXT_SPECIFIC = 3;
-
static final int PRIVATE = 4;
public DERReader()
@@ -86,53 +81,37 @@ class DERReader
return new BigInteger(getPrimitive());
}
- //Reads Primitive, definite-length method
+ // Reads Primitive, definite-length method
private byte[] getPrimitive() throws DEREncodingException
{
int tmp = pos;
-
- //Read Identifier
+ // Read Identifier
byte identifier = source[tmp++];
if ((0x20 & identifier) != 0)
throw new DEREncodingException();
int type = translateLeadIdentifierByte(identifier);
- //System.out.println("Type: " + type);
-
- //get tag
+ // get tag
int tag = (0x1f & identifier);
- //if( tag == 0x1f)
- // tag = getIdentifier(tmp);
- //System.out.println("Tag: " + tag);
-
- //get length
- byte len = source[tmp]; //may be length of length parameter
+ // get length
+ byte len = source[tmp]; // may be length of length parameter
long length = 0x7f & len;
int i;
if ((0x80 & len) != 0)
{
- //System.out.println("Extra Long Length");
len &= 0x7f;
- //System.out.println("Length of Length: " + len);
- //get length here
+ // get length here
length = 0;
for (i = 0; i < len; i++)
{
tmp++;
length <<= 8;
length += (source[tmp] < 0) ? (256 + source[tmp]) : source[tmp];
- //System.out.println("Length of Length: " + length);
}
tmp++;
}
else
tmp++;
- /*System.out.println("Position: " + tmp);
- System.out.println("Length: " + length);
- for( i = 0; i < 10; i++)
- System.out.print(source[tmp + i] + " ");
- System.out.println();*/
-
byte tmpb[] = new byte[(int) length];
System.arraycopy(source, tmp, tmpb, 0, (int) length);
pos = (int) (tmp + length);
@@ -157,4 +136,4 @@ class DERReader
tpos++;
return tpos;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/params/DERWriter.java b/gnu/javax/crypto/jce/params/DERWriter.java
index 876c2cd6c..7bdea10c5 100644
--- a/gnu/javax/crypto/jce/params/DERWriter.java
+++ b/gnu/javax/crypto/jce/params/DERWriter.java
@@ -43,11 +43,8 @@ import java.math.BigInteger;
class DERWriter
{
static final int UNIVERSAL = 1;
-
static final int APPLICATION = 2;
-
static final int CONTEXT_SPECIFIC = 3;
-
static final int PRIVATE = 4;
public DERWriter()
@@ -56,7 +53,8 @@ class DERWriter
public byte[] writeBigInteger(BigInteger i)
{
- return writePrimitive(0x02, UNIVERSAL,
+ return writePrimitive(0x02,
+ UNIVERSAL,
(int) Math.ceil((double) i.bitLength() / 8),
i.toByteArray());
}
@@ -71,7 +69,7 @@ class DERWriter
public byte[] joinarrays(byte a[], byte b[])
{
byte d[] = new byte[a.length + b.length];
- System.arraycopy(a, 0, d, 0, a.length);
+ System.arraycopy(a, 0, d, 0, a.length);
System.arraycopy(b, 0, d, a.length, b.length);
return d;
}
@@ -92,7 +90,7 @@ class DERWriter
{
int count = (int) (Math.log(identifier) / Math.log(256));
b = new byte[count + 1];
- b[0] = (byte) (translateLeadIdentifierByte(identifierencoding) | 0x1f);
+ b[0] = (byte)(translateLeadIdentifierByte(identifierencoding) | 0x1f);
int i;
for (i = 1; i < (count + 1); i++)
{
@@ -100,14 +98,13 @@ class DERWriter
b[i] |= 0x80;
}
b[i - 1] ^= 0x80;
- //System.out.println("Identifier1: " + b[0]);
return b;
}
else
{
b = new byte[1];
- b[0] = (byte) ((translateLeadIdentifierByte(identifierencoding) | (byte) (identifier & 0x1f)) & 0xdf);
- //System.out.println("Identifier2: " + b[0]);
+ b[0] = (byte)((translateLeadIdentifierByte(identifierencoding)
+ | (byte)(identifier & 0x1f)) & 0xdf);
return b;
}
}
@@ -130,25 +127,17 @@ class DERWriter
if (length > 127)
{
int count = (int) Math.ceil(Math.log(length) / Math.log(256));
- //System.out.println("Length byte count: " + count);
b = new byte[count + 1];
- b[0] = (byte) ((count & 0x7f) | 0x80);
+ b[0] = (byte)((count & 0x7f) | 0x80);
for (int i = 1; i < (count + 1); i++)
- {
- b[i] = (byte) (length >>> (8 * (count - i)));
- //System.out.println("Length1 byte1: " + (length >>> (8 * ( count - i) )));
- //System.out.println("Length1 byte2: " + b[i]);
- }
-
- //System.out.println("Length1: " + length);
+ b[i] = (byte) (length >>> (8 * (count - i)));
return b;
}
else
{
b = new byte[1];
b[0] = (byte) (length & 0x7f);
- //System.out.println("Length2: " + length);
return b;
}
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java b/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java
index 0c071561b..652793b04 100644
--- a/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java
+++ b/gnu/javax/crypto/jce/prng/ARCFourRandomSpi.java
@@ -48,24 +48,17 @@ import java.security.SecureRandomSpi;
import java.util.HashMap;
/**
- * Implementation of the <i>Service Provider Interface</i> (<b>SPI</b>)
- * for the ARCFOUR keystream generator.
+ * Implementation of the <i>Service Provider Interface</i> (<b>SPI</b>) for
+ * the ARCFOUR keystream generator.
*/
-public class ARCFourRandomSpi extends SecureRandomSpi
+public class ARCFourRandomSpi
+ extends SecureRandomSpi
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
/** Our underlying prng instance. */
private IRandom adaptee;
-
/** Have we been initialized? */
private boolean virgin;
- // Constructor(s)
- // -------------------------------------------------------------------------
-
/**
* Default 0-arguments constructor.
*/
@@ -76,20 +69,10 @@ public class ARCFourRandomSpi extends SecureRandomSpi
virgin = true;
}
- // Class methods
- // -------------------------------------------------------------------------
-
- // Instance methods
- // -------------------------------------------------------------------------
-
- // java.security.SecureRandomSpi interface implementation ------------------
-
public byte[] engineGenerateSeed(int numBytes)
{
if (numBytes < 1)
- {
- return new byte[0];
- }
+ return new byte[0];
byte[] result = new byte[numBytes];
this.engineNextBytes(result);
return result;
@@ -98,9 +81,7 @@ public class ARCFourRandomSpi extends SecureRandomSpi
public void engineNextBytes(byte[] bytes)
{
if (virgin)
- {
- this.engineSetSeed(new byte[0]);
- }
+ this.engineSetSeed(new byte[0]);
try
{
adaptee.nextBytes(bytes, 0, bytes.length);
@@ -117,4 +98,4 @@ public class ARCFourRandomSpi extends SecureRandomSpi
adaptee.init(attributes);
virgin = false;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/prng/CSPRNGSpi.java b/gnu/javax/crypto/jce/prng/CSPRNGSpi.java
index acc0c8e84..6ded636aa 100644
--- a/gnu/javax/crypto/jce/prng/CSPRNGSpi.java
+++ b/gnu/javax/crypto/jce/prng/CSPRNGSpi.java
@@ -46,20 +46,14 @@ import java.net.MalformedURLException;
import java.security.SecureRandomSpi;
/**
- * The implementation of the continuously-seeded SecureRandom
- * <i>Service Provider Interface</i> (<b>SPI</b>) adapter.<p>
+ * The implementation of the continuously-seeded SecureRandom <i>Service
+ * Provider Interface</i> (<b>SPI</b>) adapter.
*/
-public class CSPRNGSpi extends SecureRandomSpi
+public class CSPRNGSpi
+ extends SecureRandomSpi
{
-
- // Constants and variables
- // -------------------------------------------------------------------------
-
private final IRandom adaptee;
- // Constructor(s)
- // -------------------------------------------------------------------------
-
public CSPRNGSpi() throws ClassNotFoundException, MalformedURLException,
NumberFormatException
{
@@ -68,20 +62,13 @@ public class CSPRNGSpi extends SecureRandomSpi
adaptee = CSPRNG.getSystemInstance();
}
- // Instance methods
- // -------------------------------------------------------------------------
-
protected byte[] engineGenerateSeed(final int count)
{
if (count < 0)
- {
- throw new IllegalArgumentException("count must be nonnegative");
- }
+ throw new IllegalArgumentException("count must be nonnegative");
byte[] buf = new byte[count];
if (count == 0)
- {
- return buf;
- }
+ return buf;
engineNextBytes(buf);
return buf;
}
@@ -89,9 +76,7 @@ public class CSPRNGSpi extends SecureRandomSpi
protected void engineNextBytes(final byte[] buffer)
{
if (buffer == null)
- {
- throw new NullPointerException();
- }
+ throw new NullPointerException();
try
{
adaptee.nextBytes(buffer, 0, buffer.length);
@@ -105,9 +90,7 @@ public class CSPRNGSpi extends SecureRandomSpi
protected void engineSetSeed(final byte[] seed)
{
if (seed == null)
- {
- throw new NullPointerException();
- }
+ throw new NullPointerException();
adaptee.addRandomBytes(seed, 0, seed.length);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/prng/FortunaImpl.java b/gnu/javax/crypto/jce/prng/FortunaImpl.java
index 7006bbbad..8e3782ef0 100644
--- a/gnu/javax/crypto/jce/prng/FortunaImpl.java
+++ b/gnu/javax/crypto/jce/prng/FortunaImpl.java
@@ -40,24 +40,26 @@ package gnu.javax.crypto.jce.prng;
import gnu.java.security.prng.LimitReachedException;
import gnu.javax.crypto.prng.Fortuna;
+
import java.security.SecureRandomSpi;
import java.util.Collections;
-public final class FortunaImpl extends SecureRandomSpi
+public final class FortunaImpl
+ extends SecureRandomSpi
{
private final Fortuna adaptee;
- public FortunaImpl ()
+ public FortunaImpl()
{
- adaptee = new Fortuna ();
- adaptee.init (Collections.singletonMap (Fortuna.SEED, new byte[0]));
+ adaptee = new Fortuna();
+ adaptee.init(Collections.singletonMap(Fortuna.SEED, new byte[0]));
}
-
- protected void engineSetSeed (byte[] seed)
+
+ protected void engineSetSeed(byte[] seed)
{
synchronized (adaptee)
{
- adaptee.addRandomBytes (seed);
+ adaptee.addRandomBytes(seed);
}
}
@@ -67,19 +69,19 @@ public final class FortunaImpl extends SecureRandomSpi
{
try
{
- adaptee.nextBytes (buffer);
+ adaptee.nextBytes(buffer);
}
catch (LimitReachedException shouldNotHappen)
{
- throw new Error (shouldNotHappen);
+ throw new Error(shouldNotHappen);
}
}
}
- protected byte[] engineGenerateSeed (int numbytes)
+ protected byte[] engineGenerateSeed(int numbytes)
{
byte[] seed = new byte[numbytes];
- engineNextBytes (seed);
+ engineNextBytes(seed);
return seed;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/prng/ICMRandomSpi.java b/gnu/javax/crypto/jce/prng/ICMRandomSpi.java
index bee8be6f1..9855f95bd 100644
--- a/gnu/javax/crypto/jce/prng/ICMRandomSpi.java
+++ b/gnu/javax/crypto/jce/prng/ICMRandomSpi.java
@@ -51,13 +51,14 @@ import java.util.Random;
import java.util.logging.Logger;
/**
- * <p>An <em>Adapter</em> class around {@link ICMGenerator} to allow using this
- * algorithm as a JCE {@link java.security.SecureRandom}.</p>
+ * An <em>Adapter</em> class around {@link ICMGenerator} to allow using this
+ * algorithm as a JCE {@link java.security.SecureRandom}.
*/
-public class ICMRandomSpi extends SecureRandomSpi
+public class ICMRandomSpi
+ extends SecureRandomSpi
{
private static final Logger log = Logger.getLogger(ICMRandomSpi.class.getName());
- /** Class-wide prng to generate random material for the underlying prng.*/
+ /** Class-wide prng to generate random material for the underlying prng. */
private static final ICMGenerator prng; // blank final
static
{
@@ -68,24 +69,14 @@ public class ICMRandomSpi extends SecureRandomSpi
// error messages
private static final String MSG = "Exception while setting up an "
+ Registry.ICM_PRNG + " SPI: ";
-
private static final String RETRY = "Retry...";
-
private static final String LIMIT_REACHED_MSG = "Limit reached: ";
-
private static final String RESEED = "Re-seed...";
-
/** Our underlying prng instance. */
private ICMGenerator adaptee = new ICMGenerator();
- // Constructor(s)
- // -------------------------------------------------------------------------
-
// default 0-arguments constructor
- // Class methods
- // -------------------------------------------------------------------------
-
private static void resetLocalPRNG()
{
if (Configuration.DEBUG)
@@ -104,24 +95,16 @@ public class ICMRandomSpi extends SecureRandomSpi
// choose a random value between 1 and aesBlockSize / 2
int limit = aesBlockSize / 2;
while (ndxLen < 1 || ndxLen > limit)
- {
- ndxLen = rand.nextInt(limit + 1);
- }
+ ndxLen = rand.nextInt(limit + 1);
attributes.put(ICMGenerator.SEGMENT_INDEX_LENGTH, Integer.valueOf(ndxLen));
byte[] index = new byte[ndxLen];
rand.nextBytes(index);
attributes.put(ICMGenerator.SEGMENT_INDEX, new BigInteger(1, index));
-
prng.setup(attributes);
if (Configuration.DEBUG)
log.exiting(ICMRandomSpi.class.getName(), "resetLocalPRNG");
}
- // Instance methods
- // -------------------------------------------------------------------------
-
- // java.security.SecureRandomSpi interface implementation ------------------
-
public byte[] engineGenerateSeed(int numBytes)
{
if (Configuration.DEBUG)
@@ -143,11 +126,8 @@ public class ICMRandomSpi extends SecureRandomSpi
{
if (Configuration.DEBUG)
log.entering(this.getClass().getName(), "engineNextBytes");
- if (!adaptee.isInitialised())
- {
- this.engineSetSeed(new byte[0]);
- }
-
+ if (! adaptee.isInitialised())
+ this.engineSetSeed(new byte[0]);
while (true)
{
try
@@ -179,7 +159,6 @@ public class ICMRandomSpi extends SecureRandomSpi
materialLength += 16; // offset size
materialLength += 8; // index size == half of an AES block
byte[] material = new byte[materialLength];
-
// use as much as possible bytes from the seed
int materialOffset = 0;
int materialLeft = material.length;
@@ -190,8 +169,8 @@ public class ICMRandomSpi extends SecureRandomSpi
materialOffset += lenToCopy;
materialLeft -= lenToCopy;
}
- if (materialOffset > 0)
- { // generate the rest
+ if (materialOffset > 0) // generate the rest
+ {
while (true)
{
try
@@ -213,10 +192,8 @@ public class ICMRandomSpi extends SecureRandomSpi
}
}
}
-
// setup the underlying adaptee instance
HashMap attributes = new HashMap();
-
// use AES cipher with 128-bit block size
attributes.put(ICMGenerator.CIPHER, Registry.AES_CIPHER);
// use an index the size of quarter of an AES block
@@ -233,9 +210,8 @@ public class ICMRandomSpi extends SecureRandomSpi
byte[] index = new byte[8];
System.arraycopy(material, 32, index, 0, 8);
attributes.put(ICMGenerator.SEGMENT_INDEX, new BigInteger(1, index));
-
adaptee.init(attributes);
if (Configuration.DEBUG)
log.exiting(this.getClass().getName(), "engineSetSeed");
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/prng/UMacRandomSpi.java b/gnu/javax/crypto/jce/prng/UMacRandomSpi.java
index 702e20b9c..f6949dd8d 100644
--- a/gnu/javax/crypto/jce/prng/UMacRandomSpi.java
+++ b/gnu/javax/crypto/jce/prng/UMacRandomSpi.java
@@ -50,37 +50,29 @@ import java.util.Random;
import java.util.logging.Logger;
/**
- * <p>An <em>Adapter</em> class around {@link UMacGenerator} to allow using this
- * algorithm as a JCE {@link java.security.SecureRandom}.</p>
+ * An <em>Adapter</em> class around {@link UMacGenerator} to allow using this
+ * algorithm as a JCE {@link java.security.SecureRandom}.
*/
-public class UMacRandomSpi extends SecureRandomSpi
+public class UMacRandomSpi
+ extends SecureRandomSpi
{
private static final Logger log = Logger.getLogger(UMacRandomSpi.class.getName());
- /** Class-wide prng to generate random material for the underlying prng.*/
+ /** Class-wide prng to generate random material for the underlying prng. */
private static final UMacGenerator prng; // blank final
static
{
prng = new UMacGenerator();
resetLocalPRNG();
}
-
// error messages
private static final String MSG = "Exception while setting up a "
+ Registry.UMAC_PRNG + " SPI: ";
-
private static final String RETRY = "Retry...";
-
/** Our underlying prng instance. */
private UMacGenerator adaptee = new UMacGenerator();
- // Constructor(s)
- // -------------------------------------------------------------------------
-
// default 0-arguments constructor
- // Class methods
- // -------------------------------------------------------------------------
-
private static void resetLocalPRNG()
{
HashMap attributes = new HashMap();
@@ -91,21 +83,13 @@ public class UMacRandomSpi extends SecureRandomSpi
attributes.put(IBlockCipher.KEY_MATERIAL, key);
int index = rand.nextInt() & 0xFF;
attributes.put(UMacGenerator.INDEX, Integer.valueOf(index));
-
prng.setup(attributes);
}
- // Instance methods
- // -------------------------------------------------------------------------
-
- // java.security.SecureRandomSpi interface implementation ------------------
-
public byte[] engineGenerateSeed(int numBytes)
{
if (numBytes < 1)
- {
- return new byte[0];
- }
+ return new byte[0];
byte[] result = new byte[numBytes];
this.engineNextBytes(result);
return result;
@@ -113,11 +97,8 @@ public class UMacRandomSpi extends SecureRandomSpi
public void engineNextBytes(byte[] bytes)
{
- if (!adaptee.isInitialised())
- {
- this.engineSetSeed(new byte[0]);
- }
-
+ if (! adaptee.isInitialised())
+ this.engineSetSeed(new byte[0]);
while (true)
{
try
@@ -139,7 +120,6 @@ public class UMacRandomSpi extends SecureRandomSpi
materialLength += 16; // key material size
materialLength++; // index size
byte[] material = new byte[materialLength];
-
// use as much as possible bytes from the seed
int materialOffset = 0;
int materialLeft = material.length;
@@ -150,8 +130,8 @@ public class UMacRandomSpi extends SecureRandomSpi
materialOffset += lenToCopy;
materialLeft -= lenToCopy;
}
- if (materialOffset > 0)
- { // generate the rest
+ if (materialOffset > 0) // generate the rest
+ {
while (true)
{
try
@@ -159,8 +139,8 @@ public class UMacRandomSpi extends SecureRandomSpi
prng.nextBytes(material, materialOffset, materialLeft);
break;
}
- catch (IllegalStateException x)
- { // should not happen
+ catch (IllegalStateException x) // should not happen
+ {
throw new InternalError(MSG + String.valueOf(x));
}
catch (LimitReachedException x)
@@ -173,10 +153,8 @@ public class UMacRandomSpi extends SecureRandomSpi
}
}
}
-
// setup the underlying adaptee instance
HashMap attributes = new HashMap();
-
// use AES cipher with 128-bit block size
attributes.put(UMacGenerator.CIPHER, Registry.AES_CIPHER);
// specify the key
@@ -185,7 +163,6 @@ public class UMacRandomSpi extends SecureRandomSpi
attributes.put(IBlockCipher.KEY_MATERIAL, key);
// use a 1-byte index
attributes.put(UMacGenerator.INDEX, Integer.valueOf(material[16] & 0xFF));
-
adaptee.init(attributes);
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/sig/DHKeyFactory.java b/gnu/javax/crypto/jce/sig/DHKeyFactory.java
index 701191adc..98b265dd3 100644
--- a/gnu/javax/crypto/jce/sig/DHKeyFactory.java
+++ b/gnu/javax/crypto/jce/sig/DHKeyFactory.java
@@ -79,7 +79,6 @@ public class DHKeyFactory
BigInteger y = spec.getY();
return new GnuDHPublicKey(Registry.X509_ENCODING_ID, null, p, g, y);
}
-
if (keySpec instanceof X509EncodedKeySpec)
{
X509EncodedKeySpec spec = (X509EncodedKeySpec) keySpec;
@@ -97,7 +96,6 @@ public class DHKeyFactory
throw y;
}
}
-
throw new InvalidKeySpecException("Unsupported (public) key specification");
}
@@ -112,7 +110,6 @@ public class DHKeyFactory
BigInteger x = spec.getX();
return new GnuDHPrivateKey(Registry.PKCS8_ENCODING_ID, null, p, g, x);
}
-
if (keySpec instanceof PKCS8EncodedKeySpec)
{
PKCS8EncodedKeySpec spec = (PKCS8EncodedKeySpec) keySpec;
@@ -130,7 +127,6 @@ public class DHKeyFactory
throw y;
}
}
-
throw new InvalidKeySpecException("Unsupported (private) key specification");
}
@@ -147,7 +143,6 @@ public class DHKeyFactory
BigInteger y = dssKey.getY();
return new DHPublicKeySpec(y, p, g);
}
-
if (keySpec.isAssignableFrom(X509EncodedKeySpec.class))
{
if (key instanceof GnuDHPublicKey)
@@ -156,19 +151,16 @@ public class DHKeyFactory
byte[] encoded = dhKey.getEncoded(Registry.X509_ENCODING_ID);
return new X509EncodedKeySpec(encoded);
}
-
if (Registry.X509_ENCODING_SORT_NAME.equalsIgnoreCase(key.getFormat()))
{
byte[] encoded = key.getEncoded();
return new X509EncodedKeySpec(encoded);
}
-
- throw new InvalidKeySpecException("Wrong key type or unsupported (public) key specification");
+ throw new InvalidKeySpecException(
+ "Wrong key type or unsupported (public) key specification");
}
-
throw new InvalidKeySpecException("Unsupported (public) key specification");
}
-
if (key instanceof DHPrivateKey)
{
if (keySpec.isAssignableFrom(DHPrivateKeySpec.class))
@@ -179,7 +171,6 @@ public class DHKeyFactory
BigInteger x = dhKey.getX();
return new DHPrivateKeySpec(x, p, g);
}
-
if (keySpec.isAssignableFrom(PKCS8EncodedKeySpec.class))
{
if (key instanceof GnuDHPrivateKey)
@@ -188,27 +179,25 @@ public class DHKeyFactory
byte[] encoded = dhKey.getEncoded(Registry.PKCS8_ENCODING_ID);
return new PKCS8EncodedKeySpec(encoded);
}
-
if (Registry.PKCS8_ENCODING_SHORT_NAME.equalsIgnoreCase(key.getFormat()))
{
byte[] encoded = key.getEncoded();
return new PKCS8EncodedKeySpec(encoded);
}
-
- throw new InvalidKeySpecException("Wrong key type or unsupported (private) key specification");
+ throw new InvalidKeySpecException(
+ "Wrong key type or unsupported (private) key specification");
}
-
- throw new InvalidKeySpecException("Unsupported (private) key specification");
+ throw new InvalidKeySpecException(
+ "Unsupported (private) key specification");
}
-
- throw new InvalidKeySpecException("Wrong key type or unsupported key specification");
+ throw new InvalidKeySpecException(
+ "Wrong key type or unsupported key specification");
}
protected Key engineTranslateKey(Key key) throws InvalidKeyException
{
if ((key instanceof GnuDHPublicKey) || (key instanceof GnuDHPrivateKey))
return key;
-
if (key instanceof DHPublicKey)
{
DHPublicKey dsaKey = (DHPublicKey) key;
@@ -217,7 +206,6 @@ public class DHKeyFactory
BigInteger y = dsaKey.getY();
return new GnuDHPublicKey(Registry.X509_ENCODING_ID, null, p, g, y);
}
-
if (key instanceof DHPrivateKey)
{
DHPrivateKey dsaKey = (DHPrivateKey) key;
@@ -226,7 +214,6 @@ public class DHKeyFactory
BigInteger x = dsaKey.getX();
return new GnuDHPrivateKey(Registry.PKCS8_ENCODING_ID, null, p, g, x);
}
-
throw new InvalidKeyException("Wrong key type");
}
}
diff --git a/gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java b/gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java
index 63e7740ec..321b47795 100644
--- a/gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java
+++ b/gnu/javax/crypto/jce/spec/BlockCipherParameterSpec.java
@@ -43,40 +43,26 @@ import gnu.java.security.util.Util;
import java.security.spec.AlgorithmParameterSpec;
/**
- * Block cipher parameters in GNU Crypto are the cipher's name, its block
- * and key sizes, and an optional initialization vector.
+ * Block cipher parameters in GNU are the cipher's name, its block and key
+ * sizes, and an optional initialization vector.
*/
-public class BlockCipherParameterSpec implements AlgorithmParameterSpec
+public class BlockCipherParameterSpec
+ implements AlgorithmParameterSpec
{
-
- // Constants and variables.
- // -----------------------------------------------------------------------
-
- /**
- * The initialization vector.
- */
+ /** The initialization vector. */
protected byte[] iv;
-
- /**
- * The cipher's block size, in bytes.
- */
+ /** The cipher's block size, in bytes. */
protected int blockSize;
-
- /**
- * The cipher's key size, in bytes.
- */
+ /** The cipher's key size, in bytes. */
protected int keySize;
- // Constructors.
- // -----------------------------------------------------------------------
-
/**
* Create a new parameter specification.
- *
- * @param iv The initialization vector, or <code>null</code> if
- * there is no IV.
+ *
+ * @param iv The initialization vector, or <code>null</code> if there is no
+ * IV.
* @param blockSize The cipher's block size, in bytes.
- * @param keySize The cipher's key size, in bytes.
+ * @param keySize The cipher's key size, in bytes.
*/
public BlockCipherParameterSpec(byte[] iv, int blockSize, int keySize)
{
@@ -87,22 +73,19 @@ public class BlockCipherParameterSpec implements AlgorithmParameterSpec
/**
* Create a new parameter specification with no IV.
- *
+ *
* @param blockSize The cipher's block size, in bytes.
- * @param keySize The cipher's key size, in bytes.
+ * @param keySize The cipher's key size, in bytes.
*/
public BlockCipherParameterSpec(int blockSize, int keySize)
{
this(null, blockSize, keySize);
}
- // Instance methods.
- // -----------------------------------------------------------------------
-
/**
- * Get the initialization vector for the cipher, or <code>null</code>
- * if there is no IV.
- *
+ * Get the initialization vector for the cipher, or <code>null</code> if
+ * there is no IV.
+ *
* @return The IV.
*/
public byte[] getIV()
@@ -112,7 +95,7 @@ public class BlockCipherParameterSpec implements AlgorithmParameterSpec
/**
* Get the block size of the cipher these parameters are for.
- *
+ *
* @return The block size.
*/
public int getBlockSize()
@@ -122,7 +105,7 @@ public class BlockCipherParameterSpec implements AlgorithmParameterSpec
/**
* Get the key size of the cipher these parameters are for.
- *
+ *
* @return The block size.
*/
public int getKeySize()
@@ -133,7 +116,7 @@ public class BlockCipherParameterSpec implements AlgorithmParameterSpec
public String toString()
{
return getClass().getName() + " { "
- + ((iv != null) ? ("IV=" + Util.toString(iv)) + ", " : "") + "BS="
- + blockSize + ", KS=" + keySize + " }";
+ + ((iv != null) ? ("IV=" + Util.toString(iv)) + ", " : "")
+ + "BS=" + blockSize + ", KS=" + keySize + " }";
}
}
diff --git a/gnu/javax/crypto/jce/spec/TMMHParameterSpec.java b/gnu/javax/crypto/jce/spec/TMMHParameterSpec.java
index a3b5f26e8..356437288 100644
--- a/gnu/javax/crypto/jce/spec/TMMHParameterSpec.java
+++ b/gnu/javax/crypto/jce/spec/TMMHParameterSpec.java
@@ -46,34 +46,26 @@ import java.security.spec.AlgorithmParameterSpec;
* This class represents the algorithm parameters for the Truncated
* Multi-Modular Hash function for use with JCE-derived instances of
* {@link gnu.javax.crypto.mac.TMMH16}.
- *
- * <p>This class is little more than a container for the key stream, tag
- * length, and prefix parameters for the TMMH algorithm.
+ * <p>
+ * This class is little more than a container for the key stream, tag length,
+ * and prefix parameters for the TMMH algorithm.
*/
-public class TMMHParameterSpec implements AlgorithmParameterSpec
+public class TMMHParameterSpec
+ implements AlgorithmParameterSpec
{
-
- // Constants and variables.
- // -----------------------------------------------------------------------
-
/** The keystream. */
protected IRandom keystream;
-
/** The tag length. */
protected Integer tagLength;
-
/** The prefix. */
protected byte[] prefix;
- // Constructors.
- // -----------------------------------------------------------------------
-
/**
* Create a new parameter specification.
- *
+ *
* @param keystream The (PRNG) key stream.
* @param tagLength The tag length.
- * @param prefix The prefix.
+ * @param prefix The prefix.
*/
public TMMHParameterSpec(IRandom keystream, Integer tagLength, byte[] prefix)
{
@@ -84,7 +76,7 @@ public class TMMHParameterSpec implements AlgorithmParameterSpec
/**
* Create a new parameter specification with no prefix.
- *
+ *
* @param keystream The (PRNG) key stream.
* @param tagLength The tag length.
*/
@@ -93,12 +85,9 @@ public class TMMHParameterSpec implements AlgorithmParameterSpec
this(keystream, tagLength, null);
}
- // Instance methods.
- // -----------------------------------------------------------------------
-
/**
* Return the key stream this specification was initialized with.
- *
+ *
* @return The key stream.
*/
public IRandom getKeystream()
@@ -108,7 +97,7 @@ public class TMMHParameterSpec implements AlgorithmParameterSpec
/**
* Return the tag length this specification was initialized with.
- *
+ *
* @return The tag length.
*/
public Integer getTagLength()
@@ -117,13 +106,12 @@ public class TMMHParameterSpec implements AlgorithmParameterSpec
}
/**
- * Return the prefix, or <code>null</code> if no prefix was
- * specified.
- *
+ * Return the prefix, or <code>null</code> if no prefix was specified.
+ *
* @return The prefix.
*/
public byte[] getPrefix()
{
return prefix;
}
-} \ No newline at end of file
+}
diff --git a/gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java b/gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java
index 47d807d49..0990cc6d4 100644
--- a/gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java
+++ b/gnu/javax/crypto/jce/spec/UMac32ParameterSpec.java
@@ -41,25 +41,19 @@ package gnu.javax.crypto.jce.spec;
import java.security.spec.AlgorithmParameterSpec;
/**
- * This class represents the parameters for the UMAC-32 message
- * authentication code algorithm. In practice this means the
- * <i>Nonce</i> material used to initialize the algorithm.
+ * This class represents the parameters for the UMAC-32 message authentication
+ * code algorithm. In practice this means the <i>Nonce</i> material used to
+ * initialize the algorithm.
*/
-public class UMac32ParameterSpec implements AlgorithmParameterSpec
+public class UMac32ParameterSpec
+ implements AlgorithmParameterSpec
{
-
- // Constants and variables.
- // -----------------------------------------------------------------------
-
/** The <i>Nonce</i> material. */
protected byte[] nonce;
- // Constructors.
- // -----------------------------------------------------------------------
-
/**
* Create a new parameter instance.
- *
+ *
* @param nonce The nonce material.
*/
public UMac32ParameterSpec(byte[] nonce)
@@ -67,16 +61,13 @@ public class UMac32ParameterSpec implements AlgorithmParameterSpec
this.nonce = nonce;
}
- // Instance methods.
- // -----------------------------------------------------------------------
-
/**
* Return the nonce material.
- *
+ *
* @return The nonce material.
*/
public byte[] getNonce()
{
return nonce;
}
-} \ No newline at end of file
+}