diff options
author | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-24 00:12:16 +0000 |
---|---|---|
committer | Raif S. Naffah <raif@swiftdsl.com.au> | 2006-06-24 00:12:16 +0000 |
commit | 9ab62316a3ec4084d589a08fb2253743c1dd19fb (patch) | |
tree | ffafd1f1369ff5566aaedf110e9722e39e6bc9e2 | |
parent | c6a7fb5cb0459d9cfdb13834868c4b3c87fa7b7e (diff) | |
download | classpath-9ab62316a3ec4084d589a08fb2253743c1dd19fb.tar.gz |
2006-06-24 Raif S. Naffah <raif@swiftdsl.com.au>
* gnu/java/security/Properties.java: Source formatting.
* gnu/java/security/Registry.java: Likewise.
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | gnu/java/security/Properties.java | 111 | ||||
-rw-r--r-- | gnu/java/security/Registry.java | 54 |
3 files changed, 79 insertions, 91 deletions
@@ -1,5 +1,10 @@ 2006-06-24 Raif S. Naffah <raif@swiftdsl.com.au> + * gnu/java/security/Properties.java: Source formatting. + * gnu/java/security/Registry.java: Likewise. + +2006-06-24 Raif S. Naffah <raif@swiftdsl.com.au> + * gnu/java/security/util/Util.java: Source formatting. * gnu/java/security/util/SimpleList.java: Likewise. * gnu/java/security/util/Sequence.java: Likewise. diff --git a/gnu/java/security/Properties.java b/gnu/java/security/Properties.java index 4e8bc01ea..a6ccfd483 100644 --- a/gnu/java/security/Properties.java +++ b/gnu/java/security/Properties.java @@ -49,12 +49,13 @@ import java.util.PropertyPermission; import java.util.logging.Logger; /** - * <p>A global object containing build-specific properties that affect the - * behaviour of the generated binaries from this library.</p> + * A global object containing build-specific properties that affect the + * behaviour of the generated binaries from this library. */ public final class Properties { private static final Logger log = Logger.getLogger(Properties.class.getName()); + public static final String VERSION = "gnu.crypto.version"; public static final String PROPERTIES_FILE = "gnu.crypto.properties.file"; @@ -79,9 +80,6 @@ public final class Properties private boolean doRSABlinding = true; - // Constructor(s) - // ------------------------------------------------------------------------- - /** Trivial constructor to enforce Singleton pattern. */ private Properties() { @@ -89,18 +87,15 @@ public final class Properties init(); } - // Class methods - // ------------------------------------------------------------------------- - /** - * <p>Returns the string representation of the library global configuration - * property with the designated <code>key</code>.</p> - * + * Returns the string representation of the library global configuration + * property with the designated <code>key</code>. + * * @param key the case-insensitive, non-null and non-empty name of a - * configuration property. + * configuration property. * @return the string representation of the designated property, or - * <code>null</code> if such property is not yet set, or <code>key</code> is - * empty. + * <code>null</code> if such property is not yet set, or + * <code>key</code> is empty. */ public static final synchronized String getProperty(String key) { @@ -116,13 +111,13 @@ public final class Properties } /** - * <p>Sets the value of a designated library global configuration property, - * to a string representation of what should be a legal value.</p> - * + * Sets the value of a designated library global configuration property, to a + * string representation of what should be a legal value. + * * @param key the case-insensitive, non-null and non-empty name of a - * configuration property. - * @param value the non-null, non-empty string representation of a legal - * value of the configuration property named by <code>key</code>. + * configuration property. + * @param value the non-null, non-empty string representation of a legal value + * of the configuration property named by <code>key</code>. */ public static final synchronized void setProperty(String key, String value) { @@ -153,13 +148,14 @@ public final class Properties } /** - * <p>A convenience method that returns, as a boolean, the library global + * A convenience method that returns, as a boolean, the library global * configuration property indicating if the default Pseudo Random Number - * Generator produces, or not, the same bit stream when instantiated.</p> - * - * @return <code>true</code> if the default PRNG produces the same bit stream - * with every VM instance. Returns <code>false</code> if the default PRNG is - * seeded with the time of day of its first invocation. + * Generator produces, or not, the same bit stream when instantiated. + * + * @return <code>true</code> if the default PRNG produces the same bit + * stream with every VM instance. Returns <code>false</code> if the + * default PRNG is seeded with the time of day of its first + * invocation. */ public static final synchronized boolean isReproducible() { @@ -170,15 +166,15 @@ public final class Properties } /** - * <p>A convenience method that returns, as a boolean, the library global - * configuration property indicating if the implementations of symmetric - * key block ciphers check, or not, for possible/potential weak and semi-weak - * keys that may be produced in the course of generating round encryption - * and/or decryption keys.</p> - * - * @return <code>true</code> if the cipher implementations check for weak and - * semi-weak keys. Returns <code>false</code> if the cipher implementations - * do not check for weak or semi-weak keys. + * A convenience method that returns, as a boolean, the library global + * configuration property indicating if the implementations of symmetric key + * block ciphers check, or not, for possible/potential weak and semi-weak keys + * that may be produced in the course of generating round encryption and/or + * decryption keys. + * + * @return <code>true</code> if the cipher implementations check for weak + * and semi-weak keys. Returns <code>false</code> if the cipher + * implementations do not check for weak or semi-weak keys. */ public static final synchronized boolean checkForWeakKeys() { @@ -189,13 +185,14 @@ public final class Properties } /** - * <p>A convenience method that returns, as a boolean, the library global + * A convenience method that returns, as a boolean, the library global * configuration property indicating if RSA decryption (RSADP primitive), - * does, or not, blinding against timing attacks.</p> - * + * does, or not, blinding against timing attacks. + * * @return <code>true</code> if the RSA decryption primitive includes a - * blinding operation. Returns <code>false</code> if the RSA decryption - * primitive does not include the additional blinding operation. + * blinding operation. Returns <code>false</code> if the RSA + * decryption primitive does not include the additional blinding + * operation. */ public static final synchronized boolean doRSABlinding() { @@ -206,11 +203,11 @@ public final class Properties } /** - * <p>A convenience method to set the global property for reproducibility of - * the default PRNG bit stream output.</p> - * + * A convenience method to set the global property for reproducibility of the + * default PRNG bit stream output. + * * @param value if <code>true</code> then the default PRNG bit stream output - * is the same with every invocation of the VM. + * is the same with every invocation of the VM. */ public static final synchronized void setReproducible(final boolean value) { @@ -222,12 +219,12 @@ public final class Properties } /** - * <p>A convenience method to set the global property for checking for weak - * and semi-weak cipher keys.</p> - * + * A convenience method to set the global property for checking for weak and + * semi-weak cipher keys. + * * @param value if <code>true</code> then the cipher implementations will - * invoke additional checks for weak and semi-weak key values that may get - * generated. + * invoke additional checks for weak and semi-weak key values that + * may get generated. */ public static final synchronized void setCheckForWeakKeys(final boolean value) { @@ -239,11 +236,11 @@ public final class Properties } /** - * <p>A convenience method to set the global property fo adding a blinding - * operation when executing the RSA decryption primitive.</p> - * + * A convenience method to set the global property fo adding a blinding + * operation when executing the RSA decryption primitive. + * * @param value if <code>true</code> then the code for performing the RSA - * decryption primitive will include a blinding operation. + * decryption primitive will include a blinding operation. */ public static final synchronized void setDoRSABlinding(final boolean value) { @@ -261,15 +258,12 @@ public final class Properties return singleton; } - // Instance methods - // ------------------------------------------------------------------------- private void init() { // default values props.put(REPRODUCIBLE_PRNG, (reproducible ? "true" : "false")); props.put(CHECK_WEAK_KEYS, (checkForWeakKeys ? "true" : "false")); props.put(DO_RSA_BLINDING, (doRSABlinding ? "true" : "false")); - // 1. allow site-wide override by reading a properties file String propFile = null; try @@ -309,17 +303,14 @@ public final class Properties + se.getMessage()); } } - // 2. allow vm-specific override by allowing -D options in launcher handleBooleanProperty(REPRODUCIBLE_PRNG); handleBooleanProperty(CHECK_WEAK_KEYS); handleBooleanProperty(DO_RSA_BLINDING); - // re-sync the 'known' properties reproducible = Boolean.valueOf((String) props.get(REPRODUCIBLE_PRNG)).booleanValue(); checkForWeakKeys = Boolean.valueOf((String) props.get(CHECK_WEAK_KEYS)).booleanValue(); doRSABlinding = Boolean.valueOf((String) props.get(DO_RSA_BLINDING)).booleanValue(); - // This does not change. props.put(VERSION, Registry.VERSION_STRING); } @@ -339,7 +330,7 @@ public final class Properties if (s != null) { s = s.trim().toLowerCase(); - // we have to test for explicit "true" or "false". anything else may + // we have to test for explicit "true" or "false". anything else may // hide valid value set previously if (s.equals(TRUE) || s.equals(FALSE)) { diff --git a/gnu/java/security/Registry.java b/gnu/java/security/Registry.java index 9d8ceac8d..b3df24c9e 100644 --- a/gnu/java/security/Registry.java +++ b/gnu/java/security/Registry.java @@ -44,10 +44,6 @@ package gnu.java.security; */ public interface Registry { - - // Constants - // ------------------------------------------------------------------------- - /** The name of our Providers. */ String GNU_SECURITY = "GNU"; String GNU_CRYPTO = "GNU-CRYPTO"; @@ -303,38 +299,38 @@ public interface Registry // D (0x44) for DSS, R (0x52) for RSA, H (0x48) for Diffie-Hellman, or S // (0x53) for SRP-6, and finally P (0x50) for Public, p (0x70) for private, // or S (0x53) for signature. - byte[] MAGIC_RAW_DSS_PUBLIC_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x44, - 0x50 }; + byte[] MAGIC_RAW_DSS_PUBLIC_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x44, 0x50 }; - byte[] MAGIC_RAW_DSS_PRIVATE_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x44, - 0x70 }; + byte[] MAGIC_RAW_DSS_PRIVATE_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x44, 0x70 }; - byte[] MAGIC_RAW_DSS_SIGNATURE = new byte[] { 0x47, RAW_ENCODING_ID, 0x44, - 0x53 }; + byte[] MAGIC_RAW_DSS_SIGNATURE = new byte[] { + 0x47, RAW_ENCODING_ID, 0x44, 0x53 }; - byte[] MAGIC_RAW_RSA_PUBLIC_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x52, - 0x50 }; + byte[] MAGIC_RAW_RSA_PUBLIC_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x52, 0x50 }; - byte[] MAGIC_RAW_RSA_PRIVATE_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x52, - 0x70 }; + byte[] MAGIC_RAW_RSA_PRIVATE_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x52, 0x70 }; - byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] { 0x47, RAW_ENCODING_ID, - 0x52, 0x53 }; + byte[] MAGIC_RAW_RSA_PSS_SIGNATURE = new byte[] { + 0x47, RAW_ENCODING_ID, 0x52, 0x53 }; - byte[] MAGIC_RAW_RSA_PKCS1V1_5_SIGNATURE = new byte[] { 0x47, RAW_ENCODING_ID, - 0x52, 0x54 }; + byte[] MAGIC_RAW_RSA_PKCS1V1_5_SIGNATURE = new byte[] { + 0x47, RAW_ENCODING_ID, 0x52, 0x54 }; - byte[] MAGIC_RAW_DH_PUBLIC_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x48, - 0x50 }; + byte[] MAGIC_RAW_DH_PUBLIC_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x48, 0x50 }; - byte[] MAGIC_RAW_DH_PRIVATE_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x48, - 0x70 }; + byte[] MAGIC_RAW_DH_PRIVATE_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x48, 0x70 }; - byte[] MAGIC_RAW_SRP_PUBLIC_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x53, - 0x50 }; + byte[] MAGIC_RAW_SRP_PUBLIC_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x53, 0x50 }; - byte[] MAGIC_RAW_SRP_PRIVATE_KEY = new byte[] { 0x47, RAW_ENCODING_ID, 0x53, - 0x70 }; + byte[] MAGIC_RAW_SRP_PRIVATE_KEY = new byte[] { + 0x47, RAW_ENCODING_ID, 0x53, 0x70 }; // SASL Property names ..................................................... @@ -347,8 +343,7 @@ public interface Registry String SASL_PASSWORD = SASL_PREFIX + ".password"; /** Name of authentication information provider packages. */ - String SASL_AUTH_INFO_PROVIDER_PKGS = SASL_PREFIX - + ".auth.info.provider.pkgs"; + String SASL_AUTH_INFO_PROVIDER_PKGS = SASL_PREFIX + ".auth.info.provider.pkgs"; /** SASL authorization ID. */ String SASL_AUTHORISATION_ID = SASL_PREFIX + ".authorisation.ID"; @@ -455,7 +450,4 @@ public interface Registry int GKR_CIPHER_AES_128_OFB = 0; int GKR_CIPHER_AES_128_CBC = 1; - - // Methods - // ------------------------------------------------------------------------- } |