diff options
| author | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-11 12:14:43 +0000 |
|---|---|---|
| committer | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-11 12:14:43 +0000 |
| commit | 8ace3af577b4314374a3cc74fdeae04a0733f7de (patch) | |
| tree | 3849fb63506a60f82f4c1cb244b3181b5cd89931 /gnu/java/security/key/rsa | |
| parent | b911a80084bcdaf3c58728a4b97f8672e4f415c1 (diff) | |
| download | classpath-8ace3af577b4314374a3cc74fdeae04a0733f7de.tar.gz | |
2006-06-11 Raif S. Naffah <raif@swiftdsl.com.au>generics-merge-20060611
PR Classpath/26065
* gnu/javax/security/auth/login/GnuConfiguration.java: Condition all trace/
debug code based on Configuration.DEBUG.
Use logger instead of STDOUT and ot STDERR.
* gnu/javax/security/auth/login/ConfigFileParser.java: Likewise.
* gnu/javax/crypto/sasl/SaslOutputStream.java: Likewise.
* gnu/javax/crypto/sasl/SaslInputStream.java: Likewise.
* gnu/javax/crypto/sasl/srp/SRPServer.java: Likewise.
* gnu/javax/crypto/sasl/srp/SRPClient.java: Likewise.
* gnu/javax/crypto/prng/CSPRNG.java: Likewise.
* gnu/javax/crypto/pad/TBC.java: Likewise.
* gnu/javax/crypto/pad/PKCS7.java: Likewise.
* gnu/javax/crypto/pad/PKCS1_V1_5.java: Likewise.
* gnu/javax/crypto/pad/BasePad.java: Likewise.
* gnu/javax/crypto/mac/OMAC.java: Likewise.
* gnu/javax/crypto/keyring/PasswordEncryptedEntry.java: Likewise.
* gnu/javax/crypto/keyring/PasswordAuthenticatedEntry.java: Likewise.
* gnu/javax/crypto/keyring/GnuPublicKeyring.java: Likewise.
* gnu/javax/crypto/keyring/GnuPrivateKeyring.java: Likewise.
* gnu/javax/crypto/keyring/EnvelopeEntry.java: Likewise.
* gnu/javax/crypto/keyring/Entry.java: Likewise.
* gnu/javax/crypto/key/srp6/SRPKeyPairGenerator.java: Likewise.
* gnu/javax/crypto/key/dh/GnuDHKeyPairGenerator.java: Likewise.
* gnu/javax/crypto/jce/prng/UMacRandomSpi.java: Likewise.
* gnu/javax/crypto/jce/prng/ICMRandomSpi.java: Likewise.
* gnu/javax/crypto/jce/keyring/GnuKeyring.java: Likewise.
* gnu/javax/crypto/cipher/Twofish.java: Likewise.
* gnu/javax/crypto/cipher/Khazad.java: Likewise.
* gnu/javax/crypto/cipher/Rijndael.java: Likewise.
* gnu/javax/crypto/cipher/BaseCipher.java: Likewise.
* gnu/javax/crypto/cipher/Anubis.java: Likewise.
* gnu/java/security/Properties.java: Likewise.
* gnu/java/security/x509/X509CRLEntry.java: Likewise.
* gnu/java/security/x509/X509CRL.java: Likewise.
* gnu/java/security/x509/ext/Extension.java: Likewise.
* gnu/java/security/util/Prime2.java: Likewise.
* gnu/java/security/util/Base64.java: Likewise.
* gnu/java/security/sig/rsa/RSAPSSSignature.java: Likewise.
* gnu/java/security/sig/rsa/EMSA_PSS.java: Likewise.
* gnu/java/security/provider/PKIXCertPathValidatorImpl.java: Likewise.
* gnu/java/security/pkcs/SignerInfo.java: Likewise.
* gnu/java/security/pkcs/PKCS7SignedData.java: Likewise.
* gnu/java/security/key/rsa/RSAKeyPairX509Codec.java: Likewise.
* gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java: Likewise.
* gnu/java/security/key/rsa/RSAKeyPairGenerator.java: Likewise.
* gnu/java/security/key/rsa/GnuRSAPrivateKey.java: Likewise.
* gnu/java/security/key/dss/DSSPrivateKey.java: Likewise.
* gnu/java/security/key/dss/DSSKeyPairPKCS8Codec.java: Likewise.
* gnu/java/security/key/dss/DSSKeyPairGenerator.java: Likewise.
* gnu/java/security/jce/sig/SignatureAdapter.java: Likewise.
* gnu/java/security/jce/sig/EncodedKeyFactory.java: Likewise.
* gnu/java/security/hash/Whirlpool.java: Likewise.
Diffstat (limited to 'gnu/java/security/key/rsa')
| -rw-r--r-- | gnu/java/security/key/rsa/GnuRSAPrivateKey.java | 24 | ||||
| -rw-r--r-- | gnu/java/security/key/rsa/RSAKeyPairGenerator.java | 15 | ||||
| -rw-r--r-- | gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java | 32 | ||||
| -rw-r--r-- | gnu/java/security/key/rsa/RSAKeyPairX509Codec.java | 14 |
4 files changed, 49 insertions, 36 deletions
diff --git a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java index 920534487..bd39ee657 100644 --- a/gnu/java/security/key/rsa/GnuRSAPrivateKey.java +++ b/gnu/java/security/key/rsa/GnuRSAPrivateKey.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.java.security.key.rsa; +import gnu.classpath.Configuration; import gnu.classpath.SystemProperties; import gnu.java.security.Registry; import gnu.java.security.key.IKeyPairCodec; @@ -61,11 +62,6 @@ import java.security.interfaces.RSAPrivateKey; public class GnuRSAPrivateKey extends GnuRSAKey implements PrivateKey, RSAPrivateCrtKey { - // Constants and variables - // ------------------------------------------------------------------------- - - private static final boolean DEBUG = false; - /** The first prime divisor of the modulus. */ private final BigInteger p; @@ -307,12 +303,18 @@ public class GnuRSAPrivateKey extends GnuRSAKey implements PrivateKey, String ls = SystemProperties.getProperty("line.separator"); str = new StringBuilder(this.getClass().getName()).append("(") .append(super.toString()).append(",").append(ls) - .append("d=0x").append(DEBUG ? d.toString(16) : "**...*").append(ls) - .append("p=0x").append(DEBUG ? p.toString(16) : "**...*").append(ls) - .append("q=0x").append(DEBUG ? q.toString(16) : "**...*").append(ls) - .append("dP=0x").append(DEBUG ? dP.toString(16) : "**...*").append(ls) - .append("dQ=0x").append(DEBUG ? dQ.toString(16) : "**...*").append(ls) - .append("qInv=0x").append(DEBUG ? qInv.toString(16) : "**...*").append(ls) + .append("d=0x").append(Configuration.DEBUG ? d.toString(16) + : "**...*").append(ls) + .append("p=0x").append(Configuration.DEBUG ? p.toString(16) + : "**...*").append(ls) + .append("q=0x").append(Configuration.DEBUG ? q.toString(16) + : "**...*").append(ls) + .append("dP=0x").append(Configuration.DEBUG ? dP.toString(16) + : "**...*").append(ls) + .append("dQ=0x").append(Configuration.DEBUG ? dQ.toString(16) + : "**...*").append(ls) + .append("qInv=0x").append(Configuration.DEBUG ? qInv.toString(16) + : "**...*").append(ls) .append(")").toString(); } return str; diff --git a/gnu/java/security/key/rsa/RSAKeyPairGenerator.java b/gnu/java/security/key/rsa/RSAKeyPairGenerator.java index 39063381f..127b3eac4 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairGenerator.java +++ b/gnu/java/security/key/rsa/RSAKeyPairGenerator.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.java.security.key.rsa; +import gnu.classpath.Configuration; import gnu.java.security.Registry; import gnu.java.security.key.IKeyPairGenerator; import gnu.java.security.util.PRNG; @@ -152,8 +153,8 @@ public class RSAKeyPairGenerator implements IKeyPairGenerator */ public void setup(Map attributes) { - log.entering(this.getClass().getName(), "setup", attributes); - + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "setup", attributes); // do we have a SecureRandom, or should we use our own? rnd = (SecureRandom) attributes.get(SOURCE_OF_RANDOMNESS); @@ -181,8 +182,8 @@ public class RSAKeyPairGenerator implements IKeyPairGenerator Integer formatID = (Integer) attributes.get(PREFERRED_ENCODING_FORMAT); preferredFormat = formatID == null ? DEFAULT_ENCODING_FORMAT : formatID.intValue(); - - log.exiting(this.getClass().getName(), "setup"); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "setup"); } /** @@ -193,7 +194,8 @@ public class RSAKeyPairGenerator implements IKeyPairGenerator */ public KeyPair generate() { - log.entering(this.getClass().getName(), "generate"); + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "generate"); BigInteger p, q, n, d; @@ -243,7 +245,8 @@ public class RSAKeyPairGenerator implements IKeyPairGenerator PrivateKey secK = new GnuRSAPrivateKey(preferredFormat, p, q, e, d); KeyPair result = new KeyPair(pubK, secK); - log.exiting(this.getClass().getName(), "generate", result); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "generate", result); return result; } diff --git a/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java b/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java index 0b9809032..14a0a063c 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java +++ b/gnu/java/security/key/rsa/RSAKeyPairPKCS8Codec.java @@ -38,15 +38,7 @@ exception statement from your version. */ package gnu.java.security.key.rsa; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.math.BigInteger; -import java.security.InvalidParameterException; -import java.security.PrivateKey; -import java.security.PublicKey; -import java.util.ArrayList; -import java.util.logging.Logger; - +import gnu.classpath.Configuration; import gnu.java.security.OID; import gnu.java.security.Registry; import gnu.java.security.der.DER; @@ -56,6 +48,15 @@ import gnu.java.security.der.DERWriter; import gnu.java.security.key.IKeyPairCodec; import gnu.java.security.util.DerUtil; +import java.io.ByteArrayOutputStream; +import java.io.IOException; +import java.math.BigInteger; +import java.security.InvalidParameterException; +import java.security.PrivateKey; +import java.security.PublicKey; +import java.util.ArrayList; +import java.util.logging.Logger; + /** * An implementation of an {@link IKeyPairCodec} that knows how to encode / * decode PKCS#8 ASN.1 external representation of RSA private keys. @@ -122,7 +123,8 @@ public class RSAKeyPairPKCS8Codec */ public byte[] encodePrivateKey(PrivateKey key) { - log.entering(this.getClass().getName(), "encodePrivateKey()", key); + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "encodePrivateKey()", key); if (! (key instanceof GnuRSAPrivateKey)) throw new InvalidParameterException("Wrong key type"); @@ -190,8 +192,8 @@ public class RSAKeyPairPKCS8Codec y.initCause(x); throw y; } - - log.exiting(this.getClass().getName(), "encodePrivateKey()", result); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "encodePrivateKey()", result); return result; } @@ -213,7 +215,8 @@ public class RSAKeyPairPKCS8Codec */ public PrivateKey decodePrivateKey(byte[] input) { - log.entering(this.getClass().getName(), "decodePrivateKey()", input); + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "decodePrivateKey()", input); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); @@ -287,7 +290,8 @@ public class RSAKeyPairPKCS8Codec PrivateKey result = new GnuRSAPrivateKey(Registry.PKCS8_ENCODING_ID, n, e, d, p, q, dP, dQ, qInv); - log.exiting(this.getClass().getName(), "decodePrivateKey()", result); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "decodePrivateKey()", result); return result; } } diff --git a/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java b/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java index 882d9c7b2..87c5c3a6d 100644 --- a/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java +++ b/gnu/java/security/key/rsa/RSAKeyPairX509Codec.java @@ -38,6 +38,7 @@ exception statement from your version. */ package gnu.java.security.key.rsa; +import gnu.classpath.Configuration; import gnu.java.security.OID; import gnu.java.security.Registry; import gnu.java.security.der.BitString; @@ -114,7 +115,8 @@ public class RSAKeyPairX509Codec */ public byte[] encodePublicKey(PublicKey key) { - log.entering(this.getClass().getName(), "encodePublicKey()", key); + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "encodePublicKey()", key); if (! (key instanceof GnuRSAPublicKey)) throw new InvalidParameterException("key"); @@ -160,8 +162,8 @@ public class RSAKeyPairX509Codec y.initCause(x); throw y; } - - log.exiting(this.getClass().getName(), "encodePublicKey()", result); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "encodePublicKey()", result); return result; } @@ -183,7 +185,8 @@ public class RSAKeyPairX509Codec */ public PublicKey decodePublicKey(byte[] input) { - log.entering(this.getClass().getName(), "decodePublicKey()", input); + if (Configuration.DEBUG) + log.entering(this.getClass().getName(), "decodePublicKey()", input); if (input == null) throw new InvalidParameterException("Input bytes MUST NOT be null"); @@ -235,7 +238,8 @@ public class RSAKeyPairX509Codec } PublicKey result = new GnuRSAPublicKey(Registry.X509_ENCODING_ID, n, e); - log.exiting(this.getClass().getName(), "decodePublicKey()", result); + if (Configuration.DEBUG) + log.exiting(this.getClass().getName(), "decodePublicKey()", result); return result; } |
