diff options
Diffstat (limited to 'libjava/classpath/gnu/java/security/jce/prng')
13 files changed, 58 insertions, 219 deletions
diff --git a/libjava/classpath/gnu/java/security/jce/prng/HavalRandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/HavalRandomSpi.java index 0c39a37fd1b..c3d4b941261 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/HavalRandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/HavalRandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the HAVAL-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) Adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class HavalRandomSpi extends SecureRandomAdapter +public class HavalRandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public HavalRandomSpi() { super(Registry.HAVAL_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/MD2RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/MD2RandomSpi.java index 72a7f4873e4..8ba286804e6 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/MD2RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/MD2RandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the MD2-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class MD2RandomSpi extends SecureRandomAdapter +public class MD2RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public MD2RandomSpi() { super(Registry.MD2_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/MD4RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/MD4RandomSpi.java index f5f98f8f39b..d4d182970c7 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/MD4RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/MD4RandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the MD4-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class MD4RandomSpi extends SecureRandomAdapter +public class MD4RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public MD4RandomSpi() { super(Registry.MD4_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/MD5RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/MD5RandomSpi.java index 0181247bc5e..be38add0a0d 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/MD5RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/MD5RandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the MD5-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class MD5RandomSpi extends SecureRandomAdapter +public class MD5RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public MD5RandomSpi() { super(Registry.MD5_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/RipeMD128RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/RipeMD128RandomSpi.java index 5580716a491..530c3ec2141 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/RipeMD128RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/RipeMD128RandomSpi.java @@ -41,26 +41,14 @@ package gnu.java.security.jce.prng; import gnu.java.security.Registry; /** - * <p>The implementation of the RIPEMD128-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * The implementation of the RIPEMD128-based SecureRandom <i>Service Provider + * Interface</i> (<b>SPI</b>) adapter. */ -public class RipeMD128RandomSpi extends SecureRandomAdapter +public class RipeMD128RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public RipeMD128RandomSpi() { super(Registry.RIPEMD128_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/RipeMD160RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/RipeMD160RandomSpi.java index 734fe824a4c..6875cdfa91a 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/RipeMD160RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/RipeMD160RandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the RIPEMD160-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class RipeMD160RandomSpi extends SecureRandomAdapter +public class RipeMD160RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public RipeMD160RandomSpi() { super(Registry.RIPEMD160_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java b/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java index 70d30f15301..5be402ff005 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java +++ b/libjava/classpath/gnu/java/security/jce/prng/SecureRandomAdapter.java @@ -45,34 +45,28 @@ import java.security.SecureRandomSpi; import java.util.Collections; /** - * <p>The implementation of a generic {@link java.security.SecureRandom} adapter - * class to wrap gnu.crypto prng instances based on Message Digest algorithms.</p> - * - * <p>This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for + * The implementation of a generic {@link java.security.SecureRandom} adapter + * class to wrap GNU PRNG instances based on Message Digest algorithms. + * <p> + * This class defines the <i>Service Provider Interface</i> (<b>SPI</b>) for * the {@link java.security.SecureRandom} class, which provides the - * functionality of a cryptographically strong pseudo-random number generator.</p> - * - * <p>All the abstract methods in the {@link SecureRandomSpi} class are - * implemented by this class and all its sub-classes.</p> + * functionality of a cryptographically strong pseudo-random number generator. + * <p> + * All the abstract methods in the {@link SecureRandomSpi} class are implemented + * by this class and all its sub-classes. */ -abstract class SecureRandomAdapter extends SecureRandomSpi +abstract class SecureRandomAdapter + extends SecureRandomSpi { - - // Constants and variables - // ------------------------------------------------------------------------- - /** Our underlying prng instance. */ private MDGenerator adaptee = new MDGenerator(); /** The name of the message digest algorithm used by the adaptee. */ private String mdName; - // Constructor(s) - // ------------------------------------------------------------------------- - /** - * <p>Trivial protected constructor.</p> - * + * Trivial protected constructor. + * * @param mdName the canonical name of the underlying hash algorithm. */ protected SecureRandomAdapter(String mdName) @@ -80,23 +74,14 @@ abstract class SecureRandomAdapter extends SecureRandomSpi super(); this.mdName = mdName; - adaptee.init (Collections.singletonMap (MDGenerator.MD_NAME, mdName)); + adaptee.init(Collections.singletonMap(MDGenerator.MD_NAME, mdName)); } - // 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; @@ -104,10 +89,8 @@ abstract class SecureRandomAdapter extends SecureRandomSpi public void engineNextBytes(byte[] bytes) { - if (!adaptee.isInitialised()) - { - this.engineSetSeed(new byte[0]); - } + if (! adaptee.isInitialised()) + this.engineSetSeed(new byte[0]); try { adaptee.nextBytes(bytes, 0, bytes.length); @@ -119,6 +102,6 @@ abstract class SecureRandomAdapter extends SecureRandomSpi public void engineSetSeed(byte[] seed) { - adaptee.addRandomBytes (seed); + adaptee.addRandomBytes(seed); } } diff --git a/libjava/classpath/gnu/java/security/jce/prng/Sha160RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/Sha160RandomSpi.java index c93b02d3fb8..9fded67e0ce 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/Sha160RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/Sha160RandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the SHA1-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class Sha160RandomSpi extends SecureRandomAdapter +public class Sha160RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public Sha160RandomSpi() { super(Registry.SHA160_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java index 736996430e1..e3999ffe6e9 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/Sha256RandomSpi.java @@ -41,26 +41,14 @@ package gnu.java.security.jce.prng; import gnu.java.security.Registry; /** - * <p>The implementation of the SHA-256 based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.</p> + * The implementation of the SHA-256 based SecureRandom <i>Service Provider + * Interface</i> (<b>SPI</b>) adapter. */ -public class Sha256RandomSpi extends SecureRandomAdapter +public class Sha256RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public Sha256RandomSpi() { super(Registry.SHA256_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java index afbf19303c8..978c8fe38b2 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/Sha384RandomSpi.java @@ -41,26 +41,14 @@ package gnu.java.security.jce.prng; import gnu.java.security.Registry; /** - * <p>The implementation of the SHA-384 based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.</p> + * The implementation of the SHA-384 based SecureRandom <i>Service Provider + * Interface</i> (<b>SPI</b>) adapter. */ -public class Sha384RandomSpi extends SecureRandomAdapter +public class Sha384RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public Sha384RandomSpi() { super(Registry.SHA384_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java index b2b33776008..a89e26f004e 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/Sha512RandomSpi.java @@ -41,26 +41,14 @@ package gnu.java.security.jce.prng; import gnu.java.security.Registry; /** - * <p>The implementation of the SHA-512 based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.</p> + * The implementation of the SHA-512 based SecureRandom <i>Service Provider + * Interface</i> (<b>SPI</b>) adapter. */ -public class Sha512RandomSpi extends SecureRandomAdapter +public class Sha512RandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public Sha512RandomSpi() { super(Registry.SHA512_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/TigerRandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/TigerRandomSpi.java index b4795b98ecc..ba4b22fb892 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/TigerRandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/TigerRandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the Tiger based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class TigerRandomSpi extends SecureRandomAdapter +public class TigerRandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public TigerRandomSpi() { super(Registry.TIGER_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } diff --git a/libjava/classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java b/libjava/classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java index f327f9df2c7..9d937e65f3e 100644 --- a/libjava/classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java +++ b/libjava/classpath/gnu/java/security/jce/prng/WhirlpoolRandomSpi.java @@ -42,25 +42,13 @@ import gnu.java.security.Registry; /** * The implementation of the Whirlpool-based SecureRandom <i>Service Provider - * Interface</i> (<b>SPI</b>) adapter.<p> + * Interface</i> (<b>SPI</b>) adapter. */ -public class WhirlpoolRandomSpi extends SecureRandomAdapter +public class WhirlpoolRandomSpi + extends SecureRandomAdapter { - - // Constants and variables - // ------------------------------------------------------------------------- - - // Constructor(s) - // ------------------------------------------------------------------------- - public WhirlpoolRandomSpi() { super(Registry.WHIRLPOOL_HASH); } - - // Class methods - // ------------------------------------------------------------------------- - - // Instance methods - // ------------------------------------------------------------------------- } |