From ce57ab760f69de6db452def7ffbf5b114a2d8694 Mon Sep 17 00:00:00 2001 From: mark Date: Fri, 10 Mar 2006 21:46:48 +0000 Subject: Imported GNU Classpath 0.90 * scripts/makemake.tcl: Set gnu/java/awt/peer/swing to ignore. * gnu/classpath/jdwp/VMFrame.java (SIZE): New constant. * java/lang/VMCompiler.java: Use gnu.java.security.hash.MD5. * java/lang/Math.java: New override file. * java/lang/Character.java: Merged from Classpath. (start, end): Now 'int's. (canonicalName): New field. (CANONICAL_NAME, NO_SPACES_NAME, CONSTANT_NAME): New constants. (UnicodeBlock): Added argument. (of): New overload. (forName): New method. Updated unicode blocks. (sets): Updated. * sources.am: Regenerated. * Makefile.in: Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@111942 138bc75d-0d04-0410-961f-82ee72b054a4 --- .../security/spec/InvalidKeySpecException.java | 26 +++++++- .../java/security/spec/PSSParameterSpec.java | 25 +++---- .../spec/RSAMultiPrimePrivateCrtKeySpec.java | 78 ++++++++++++---------- .../java/security/spec/RSAOtherPrimeInfo.java | 35 ++++------ 4 files changed, 91 insertions(+), 73 deletions(-) (limited to 'libjava/classpath/java/security/spec') diff --git a/libjava/classpath/java/security/spec/InvalidKeySpecException.java b/libjava/classpath/java/security/spec/InvalidKeySpecException.java index c2ec6b03b5a..bbbbcc6d720 100644 --- a/libjava/classpath/java/security/spec/InvalidKeySpecException.java +++ b/libjava/classpath/java/security/spec/InvalidKeySpecException.java @@ -1,5 +1,5 @@ /* InvalidKeySpecException.java -- invalid KeySpec Exception - Copyright (C) 1999, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2006 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,7 +46,7 @@ import java.security.GeneralSecurityException; * @author Mark Benvenuto * @see KeySpec * @since 1.2 - * @status updated to 1.4 + * @status updated to 1.5 */ public class InvalidKeySpecException extends GeneralSecurityException { @@ -71,4 +71,26 @@ public class InvalidKeySpecException extends GeneralSecurityException { super(msg); } + + /** + * Create a new instance with a descriptive error message and + * a cause. + * @param s the descriptive error message + * @param cause the cause + * @since 1.5 + */ + public InvalidKeySpecException(String s, Throwable cause) + { + super(s, cause); + } + + /** + * Create a new instance with a cause. + * @param cause the cause + * @since 1.5 + */ + public InvalidKeySpecException(Throwable cause) + { + super(cause); + } } diff --git a/libjava/classpath/java/security/spec/PSSParameterSpec.java b/libjava/classpath/java/security/spec/PSSParameterSpec.java index 7a14a24fbe4..f2a83d96718 100644 --- a/libjava/classpath/java/security/spec/PSSParameterSpec.java +++ b/libjava/classpath/java/security/spec/PSSParameterSpec.java @@ -38,9 +38,9 @@ exception statement from your version. */ package java.security.spec; /** - * This class specifies a parameter spec for RSA PSS encoding scheme, as - * defined in the PKCS#1 v2.1. - * + * An implementation of {@link AlgorithmParameterSpec} for the RSA PSS encoding + * scheme. + * * @since 1.4 * @see AlgorithmParameterSpec * @see java.security.Signature @@ -56,12 +56,13 @@ public class PSSParameterSpec implements AlgorithmParameterSpec // -------------------------------------------------------------------------- /** - * Creates a new PSSParameterSpec given the salt length as - * defined in PKCS#1. - * - * @param saltLen the length of salt in bits to be used in PKCS#1 PSS encoding. - * @throws IllegalArgumentException if saltLen is less than - * 0. + * Construct a new instance of PSSParameterSpec given a salt + * length. + * + * @param saltLen + * the length in bits of the salt. + * @throws IllegalArgumentException + * if saltLen is less than 0. */ public PSSParameterSpec(int saltLen) { @@ -78,11 +79,7 @@ public class PSSParameterSpec implements AlgorithmParameterSpec // Instance methods // -------------------------------------------------------------------------- - /** - * Returns the salt length in bits. - * - * @return the salt length. - */ + /** @return the length (in bits) of the salt. */ public int getSaltLength() { return this.saltLen; diff --git a/libjava/classpath/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java b/libjava/classpath/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java index 519a0291373..9e8ad0da776 100644 --- a/libjava/classpath/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java +++ b/libjava/classpath/java/security/spec/RSAMultiPrimePrivateCrtKeySpec.java @@ -40,9 +40,9 @@ package java.security.spec; import java.math.BigInteger; /** - * This class specifies an RSA multi-prime private key, as defined in the + * This class represents an RSA multi-prime private key, as defined in the * PKCS#1 v2.1, using the Chinese Remainder Theorem (CRT) information - * values for efficiency. + * values. * * @since 1.4 * @see java.security.Key @@ -70,29 +70,35 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec // -------------------------------------------------------------------------- /** - *

Creates a new RSAMultiPrimePrivateCrtKeySpec given the - * modulus, publicExponent, privateExponent, primeP, primeQ, primeExponentP, - * primeExponentQ, crtCoefficient, and otherPrimeInfo as defined in PKCS#1 - * v2.1.

- * + * Constructs a new instance of RSAMultiPrimePrivateCrtKeySpec + * given the various PKCS#1 v2.1 parameters. + * *

Note that otherPrimeInfo is cloned when constructing this * object.

- * - * @param modulus the modulus n. - * @param publicExponent the public exponent e. - * @param privateExponent the private exponent d. - * @param primeP the prime factor p of n. - * @param primeQ the prime factor q of n. - * @param primeExponentP this is d mod (p-1). - * @param primeExponentQ this is d mod (q-1). - * @param crtCoefficient the Chinese Remainder Theorem coefficient q-1 mod p. - * @param otherPrimeInfo triplets of the rest of primes, null - * can be specified if there are only two prime factors (p and q). - * @throws NullPointerException if any of the parameters, i.e. modulus, - * publicExponent, privateExponent, primeP, primeQ, primeExponentP, - * primeExponentQ, crtCoefficient, is null. - * @throws IllegalArgumentException if an empty, i.e. 0-length, - * otherPrimeInfo is specified. + * + * @param modulus + * the modulus n. + * @param publicExponent + * the public exponent e. + * @param privateExponent + * the private exponent d. + * @param primeP + * the prime factor p of n. + * @param primeQ + * the prime factor q of n. + * @param primeExponentP + * this is d mod (p-1). + * @param primeExponentQ + * this is d mod (q-1). + * @param crtCoefficient + * the Chinese Remainder Theorem coefficient q-1 mod p. + * @param otherPrimeInfo + * triplets of the rest of primes, null can be + * specified if there are only two prime factors (p and q). + * @throws NullPointerException + * if any of the parameters is null. + * @throws IllegalArgumentException + * if an empty otherPrimeInfo is specified. */ public RSAMultiPrimePrivateCrtKeySpec(BigInteger modulus, BigInteger publicExponent, @@ -153,9 +159,9 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns the primeP. + * Returns the prime p. * - * @return the primeP. + * @return the prime p. */ public BigInteger getPrimeP() { @@ -163,9 +169,9 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns the primeQ. + * Returns the prime q. * - * @return the primeQ. + * @return the prime q. */ public BigInteger getPrimeQ() { @@ -173,9 +179,9 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns the primeExponentP. + * Returns d mod (p-1). * - * @return the primeExponentP. + * @return d mod (p-1). */ public BigInteger getPrimeExponentP() { @@ -183,9 +189,9 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns the primeExponentQ. + * Returns d mod (q-1). * - * @return the primeExponentQ. + * @return d mod (q-1). */ public BigInteger getPrimeExponentQ() { @@ -193,9 +199,9 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns the crtCoefficient. + * Returns the CRT Coefficient q-1 mod p. * - * @return the crtCoefficient. + * @return the CRT Coefficient q-1 mod p. */ public BigInteger getCrtCoefficient() { @@ -203,10 +209,10 @@ public class RSAMultiPrimePrivateCrtKeySpec extends RSAPrivateKeySpec } /** - * Returns a copy of the otherPrimeInfo or null if there are - * only two prime factors (p and q). + * Returns a clone of otherPrimeInfo or null if + * it was null at construction time. * - * @return the otherPrimeInfo. + * @return a cloned copy of otherPrimeInfo. */ public RSAOtherPrimeInfo[] getOtherPrimeInfo() { diff --git a/libjava/classpath/java/security/spec/RSAOtherPrimeInfo.java b/libjava/classpath/java/security/spec/RSAOtherPrimeInfo.java index 654bcb574d8..03cdca227ed 100644 --- a/libjava/classpath/java/security/spec/RSAOtherPrimeInfo.java +++ b/libjava/classpath/java/security/spec/RSAOtherPrimeInfo.java @@ -40,17 +40,8 @@ package java.security.spec; import java.math.BigInteger; /** - * This class represents the triplet (prime, exponent, and coefficient) inside - * RSA's OtherPrimeInfo structure, as defined in the PKCS#1 v2.1. The ASN.1 - * syntax of RSA's OtherPrimeInfo is as follows: - * - *
- *  OtherPrimeInfo ::= SEQUENCE {
- *    prime INTEGER,
- *    exponent INTEGER,
- *    coefficient INTEGER
- *  }
- * 
+ * An in-memory representation of the RSA triplet (prime, exponent, and + * coefficient) inside a PKCS#1 v2.1 OtherPrimeInfo structure. * * @since 1.4 * @see RSAPrivateCrtKeySpec @@ -69,14 +60,16 @@ public class RSAOtherPrimeInfo // -------------------------------------------------------------------------- /** - * Creates a new RSAOtherPrimeInfo given the prime, - * primeExponent, and crtCoefficient as defined in PKCS#1. - * - * @param prime the prime factor of n. - * @param primeExponent the exponent. - * @param crtCoefficient the Chinese Remainder Theorem coefficient. - * @throws NullPointerException if any of the parameters, i.e. prime, - * primeExponent, crtCoefficient, is null. + * Constructs a new RSAOtherPrimeInfo given the PKCS#1 MPIs. + * + * @param prime + * the prime factor of n. + * @param primeExponent + * the exponent. + * @param crtCoefficient + * the Chinese Remainder Theorem coefficient. + * @throws NullPointerException + * if any of the parameters is null. */ public RSAOtherPrimeInfo(BigInteger prime, BigInteger primeExponent, BigInteger crtCoefficient) @@ -122,9 +115,9 @@ public class RSAOtherPrimeInfo } /** - * Returns the prime's crtCoefficient. + * Returns the CRT Coefficient. * - * @return the crtCoefficient. + * @return the CRT Coefficient. */ public final BigInteger getCrtCoefficient() { -- cgit v1.2.3