summaryrefslogtreecommitdiffstats
path: root/libjava/classpath/gnu/javax/crypto/jce
diff options
context:
space:
mode:
authormark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
committermark <mark@138bc75d-0d04-0410-961f-82ee72b054a4>2006-05-18 17:29:21 +0000
commit64089cc9f030d8ef7972adb5d117e0b23f47d62b (patch)
tree9f9c470de62ee62fba1331a396450d728d2b1fad /libjava/classpath/gnu/javax/crypto/jce
parent96034e28360d660d7a7708807fcbc4b519574d8e (diff)
downloadppe42-gcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.tar.gz
ppe42-gcc-64089cc9f030d8ef7972adb5d117e0b23f47d62b.zip
Imported GNU Classpath 0.90
* scripts/makemake.tcl: LocaleData.java moved to gnu/java/locale. * sources.am: Regenerated. * gcj/javaprims.h: Regenerated. * Makefile.in: Regenerated. * gcj/Makefile.in: Regenerated. * include/Makefile.in: Regenerated. * testsuite/Makefile.in: Regenerated. * gnu/java/lang/VMInstrumentationImpl.java: New override. * gnu/java/net/local/LocalSocketImpl.java: Likewise. * gnu/classpath/jdwp/VMMethod.java: Likewise. * gnu/classpath/jdwp/VMVirtualMachine.java: Update to latest interface. * java/lang/Thread.java: Add UncaughtExceptionHandler. * java/lang/reflect/Method.java: Implements GenericDeclaration and isSynthetic(), * java/lang/reflect/Field.java: Likewise. * java/lang/reflect/Constructor.java * java/lang/Class.java: Implements Type, GenericDeclaration, getSimpleName() and getEnclosing*() methods. * java/lang/Class.h: Add new public methods. * java/lang/Math.java: Add signum(), ulp() and log10(). * java/lang/natMath.cc (log10): New function. * java/security/VMSecureRandom.java: New override. * java/util/logging/Logger.java: Updated to latest classpath version. * java/util/logging/LogManager.java: New override. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@113887 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/classpath/gnu/javax/crypto/jce')
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/AESSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/ARCFourSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/AnubisSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/BlowfishSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/CipherAdapter.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/DESSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/KhazadSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/NullCipherSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/PBES2.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/RijndaelSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/SerpentSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/SquareSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/TripleDESSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/cipher/TwofishSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/keyring/GnuKeyring.java572
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD2Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD4Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD5Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacTigerSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/MacAdapter.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/TMMH16Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/UHash32Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/mac/UMac32Spi.java4
-rw-r--r--libjava/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java4
31 files changed, 336 insertions, 356 deletions
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/AESSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/AESSpi.java
index ba7466fc39c..33de6895613 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/AESSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/AESSpi.java
@@ -52,8 +52,6 @@ import java.security.spec.InvalidParameterSpecException;
/**
* The implementation of the AES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class AESSpi extends CipherAdapter
{
@@ -101,4 +99,4 @@ public final class AESSpi extends CipherAdapter
}
engineInit(opmode, key, spec, random);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/ARCFourSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
index 8fc1fe4cbbf..963fa1c0081 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/ARCFourSpi.java
@@ -64,8 +64,6 @@ import javax.crypto.ShortBufferException;
/**
* The <i>Service Provider Interface</i> (<b>SPI</b>) for the ARCFOUR
* stream cipher.
- *
- * @version $Revision: 1.1 $
*/
public class ARCFourSpi extends CipherSpi
{
@@ -205,4 +203,4 @@ public class ARCFourSpi extends CipherSpi
{
return engineUpdate(in, inOffset, length, out, outOffset);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/AnubisSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/AnubisSpi.java
index ac2f596c863..0fca3b49104 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/AnubisSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/AnubisSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Anubis <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class AnubisSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class AnubisSpi extends CipherAdapter
{
super(Registry.ANUBIS_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/BlowfishSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
index d1a28616d0d..d31d7e19390 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/BlowfishSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Blowfish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class BlowfishSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class BlowfishSpi extends CipherAdapter
{
super(Registry.BLOWFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/CipherAdapter.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/CipherAdapter.java
index 9667a67fff8..5eaa31b779b 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/CipherAdapter.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/CipherAdapter.java
@@ -82,8 +82,6 @@ import javax.crypto.spec.IvParameterSpec;
* 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>
- *
- * @version $Revision: 1.1 $
*/
class CipherAdapter extends CipherSpi
{
@@ -504,4 +502,4 @@ class CipherAdapter extends CipherSpi
partBlock = new byte[blockLen];
partLen = 0;
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/DESSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/DESSpi.java
index f3ec8220a7f..ff86071c4ee 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/DESSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/DESSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the DES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class DESSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class DESSpi extends CipherAdapter
{
super(Registry.DES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/KhazadSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/KhazadSpi.java
index 7f43dd010fa..397c27d2ed7 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/KhazadSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/KhazadSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Khazad <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class KhazadSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class KhazadSpi extends CipherAdapter
{
super(Registry.KHAZAD_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/NullCipherSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
index 0876c9585a3..e6d78ef393e 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/NullCipherSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Null cipher <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class NullCipherSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class NullCipherSpi extends CipherAdapter
{
super(Registry.NULL_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/PBES2.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/PBES2.java
index 28b327d8365..9889ab9fc86 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/PBES2.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/PBES2.java
@@ -56,8 +56,6 @@ import javax.crypto.spec.SecretKeySpec;
/**
* <p>.</p>
- *
- * @version $Revision: 1.1 $
*/
public abstract class PBES2 extends CipherAdapter
{
@@ -1349,4 +1347,4 @@ public abstract class PBES2 extends CipherAdapter
}
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/RijndaelSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
index 1a67f934b9e..137db2c3fa4 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/RijndaelSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Rijndael <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class RijndaelSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class RijndaelSpi extends CipherAdapter
{
super(Registry.RIJNDAEL_CIPHER, 16);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/SerpentSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/SerpentSpi.java
index 394a0ce0a66..9df9685cc38 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/SerpentSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/SerpentSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Serpent <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class SerpentSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class SerpentSpi extends CipherAdapter
{
super(Registry.SERPENT_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/SquareSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/SquareSpi.java
index bb59cd224ce..96e5dee38b1 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/SquareSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/SquareSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Square <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class SquareSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class SquareSpi extends CipherAdapter
{
super(Registry.SQUARE_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/TripleDESSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
index cec30f6537d..5c58ea5515e 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/TripleDESSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Triple-DES <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class TripleDESSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class TripleDESSpi extends CipherAdapter
{
super(Registry.TRIPLEDES_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/cipher/TwofishSpi.java b/libjava/classpath/gnu/javax/crypto/jce/cipher/TwofishSpi.java
index 34f2d95d60a..31df5ea4068 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/cipher/TwofishSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/cipher/TwofishSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Twofish <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class TwofishSpi extends CipherAdapter
{
@@ -56,4 +54,4 @@ public final class TwofishSpi extends CipherAdapter
{
super(Registry.TWOFISH_CIPHER);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/keyring/GnuKeyring.java b/libjava/classpath/gnu/javax/crypto/jce/keyring/GnuKeyring.java
index d74d386b4f0..d2501f89374 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/keyring/GnuKeyring.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/keyring/GnuKeyring.java
@@ -1,4 +1,4 @@
-/* GnuKeyring.java --
+/* GnuKeyring.java -- KeyStore adapter for a pair of private and public Keyrings
Copyright (C) 2003, 2006 Free Software Foundation, Inc.
This file is a part of GNU Classpath.
@@ -38,376 +38,412 @@ exception statement from your version. */
package gnu.javax.crypto.jce.keyring;
+import gnu.java.security.Registry;
+import gnu.javax.crypto.keyring.GnuPrivateKeyring;
+import gnu.javax.crypto.keyring.GnuPublicKeyring;
+import gnu.javax.crypto.keyring.IKeyring;
+import gnu.javax.crypto.keyring.IPrivateKeyring;
+import gnu.javax.crypto.keyring.IPublicKeyring;
+import gnu.javax.crypto.keyring.MalformedKeyringException;
+import gnu.javax.crypto.keyring.PrimitiveEntry;
+
import java.io.BufferedInputStream;
-import java.io.InputStream;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
-
import java.security.Key;
-import java.security.KeyStoreSpi;
import java.security.KeyStoreException;
+import java.security.KeyStoreSpi;
import java.security.PrivateKey;
import java.security.PublicKey;
import java.security.UnrecoverableKeyException;
import java.security.cert.Certificate;
-import java.security.cert.CertificateException;
-import java.security.cert.CertificateFactory;
-
-import java.util.Arrays;
+import java.util.Collections;
import java.util.Date;
import java.util.Enumeration;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.logging.Logger;
import javax.crypto.SecretKey;
-import gnu.java.security.Registry;
-import gnu.javax.crypto.keyring.IKeyring;
-import gnu.javax.crypto.keyring.IPrivateKeyring;
-import gnu.javax.crypto.keyring.IPublicKeyring;
-import gnu.javax.crypto.keyring.GnuPrivateKeyring;
-import gnu.javax.crypto.keyring.GnuPublicKeyring;
-import gnu.javax.crypto.keyring.MalformedKeyringException;
-import gnu.javax.crypto.keyring.PrimitiveEntry;
-
-public class GnuKeyring extends KeyStoreSpi
+/**
+ * An <i>Adapter</i> over a pair of one private, and one public keyrings to
+ * emulate the keystore operations.
+ */
+public class GnuKeyring
+ extends KeyStoreSpi
{
+ private static final Logger log = Logger.getLogger(GnuKeyring.class.getName());
+ private static final String NOT_LOADED = "not loaded";
- // Constants and fields.
- // ------------------------------------------------------------------------
-
+ /** TRUE if the keystore is loaded; FALSE otherwise. */
private boolean loaded;
+ /** our underlying private keyring. */
+ private IPrivateKeyring privateKR;
+ /** our underlying public keyring. */
+ private IPublicKeyring publicKR;
- private IKeyring keyring;
-
- // Constructor.
- // ------------------------------------------------------------------------
-
- public GnuKeyring()
- {
- }
-
- // Instance methods.
- // ------------------------------------------------------------------------
+ // default 0-arguments constructor
public Enumeration engineAliases()
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return new Enumeration()
+ ensureLoaded();
+ Enumeration result;
+ if (privateKR == null)
+ result = Collections.enumeration(Collections.EMPTY_SET);
+ else
{
- public boolean hasMoreElements()
- {
- return false;
- }
-
- public Object nextElement()
- {
- throw new NoSuchElementException();
- }
- };
- }
- return keyring.aliases();
+ Set aliases = new HashSet();
+ for (Enumeration e = privateKR.aliases(); e.hasMoreElements();)
+ {
+ String alias = (String) e.nextElement();
+ if (alias != null)
+ aliases.add(alias);
+ }
+
+ for (Enumeration e = publicKR.aliases(); e.hasMoreElements();)
+ {
+ String alias = (String) e.nextElement();
+ if (alias != null)
+ aliases.add(alias);
+ }
+
+ result = Collections.enumeration(aliases);
+ }
+
+ return result;
}
public boolean engineContainsAlias(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return false;
- }
- return keyring.containsAlias(alias);
+ log.entering(this.getClass().getName(), "engineContainsAlias", alias);
+
+ ensureLoaded();
+ boolean inPrivateKR = privateKR.containsAlias(alias);
+ log.finest("inPrivateKR=" + inPrivateKR);
+ boolean inPublicKR = publicKR.containsAlias(alias);
+ log.finest("inPublicKR=" + inPublicKR);
+ boolean result = inPrivateKR || inPublicKR;
+
+ log.exiting(this.getClass().getName(), "engineContainsAlias",
+ Boolean.valueOf(result));
+ return result;
}
public void engineDeleteEntry(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring != null)
- {
- keyring.remove(alias);
- }
+ log.entering(this.getClass().getName(), "engineDeleteEntry", alias);
+
+ ensureLoaded();
+ if (privateKR.containsAlias(alias))
+ privateKR.remove(alias);
+ else if (publicKR.containsAlias(alias))
+ publicKR.remove(alias);
+ else
+ log.finer("Unknwon alias: " + alias);
+
+ log.exiting(this.getClass().getName(), "engineDeleteEntry");
}
public Certificate engineGetCertificate(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return null;
- }
- if (!(keyring instanceof IPublicKeyring))
- {
- throw new IllegalStateException("not a public keyring");
- }
- return ((IPublicKeyring) keyring).getCertificate(alias);
+ log.entering(this.getClass().getName(), "engineGetCertificate", alias);
+
+ ensureLoaded();
+ Certificate result = publicKR.getCertificate(alias);
+
+ log.exiting(this.getClass().getName(), "engineGetCertificate", result);
+ return result;
}
public String engineGetCertificateAlias(Certificate cert)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return null;
- }
- if (!(keyring instanceof IPublicKeyring))
- {
- throw new IllegalStateException("not a public keyring");
- }
- Enumeration aliases = keyring.aliases();
- while (aliases.hasMoreElements())
+ log.entering(this.getClass().getName(), "engineGetCertificateAlias", cert);
+
+ ensureLoaded();
+ String result = null;
+ for (Enumeration aliases = publicKR.aliases(); aliases.hasMoreElements();)
{
String alias = (String) aliases.nextElement();
- Certificate cert2 = ((IPublicKeyring) keyring).getCertificate(alias);
+ Certificate cert2 = publicKR.getCertificate(alias);
if (cert.equals(cert2))
{
- return alias;
+ result = alias;
+ break;
}
}
- return null;
+
+ log.exiting(this.getClass().getName(), "engineGetCertificateAlias", result);
+ return result;
}
public void engineSetCertificateEntry(String alias, Certificate cert)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- keyring = new GnuPublicKeyring("HMAC-SHA-1", 20);
- }
- if (!(keyring instanceof IPublicKeyring))
- {
- throw new IllegalStateException("not a public keyring");
- }
- ((IPublicKeyring) keyring).putCertificate(alias, cert);
+ log.entering(this.getClass().getName(), "engineSetCertificateEntry",
+ new Object[] { alias, cert });
+
+ ensureLoaded();
+ publicKR.putCertificate(alias, cert);
+
+ log.exiting(this.getClass().getName(), "engineSetCertificateEntry");
}
public Certificate[] engineGetCertificateChain(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return null;
- }
- if (!(keyring instanceof IPrivateKeyring))
- {
- throw new IllegalStateException("not a private keyring");
- }
- return ((IPrivateKeyring) keyring).getCertPath(alias);
+ log.entering(this.getClass().getName(), "engineGetCertificateChain", alias);
+
+ ensureLoaded();
+ Certificate[] result = privateKR.getCertPath(alias);
+
+ log.exiting(this.getClass().getName(), "engineGetCertificateChain", result);
+ return result;
}
public Date engineGetCreationDate(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return null;
- }
- List entries = keyring.get(alias);
- if (entries.size() == 0)
- {
- return null;
- }
- for (Iterator it = entries.iterator(); it.hasNext();)
- {
- Object o = it.next();
- if (o instanceof PrimitiveEntry)
- {
- return ((PrimitiveEntry) o).getCreationDate();
- }
- }
- return null;
+ log.entering(this.getClass().getName(), "engineGetCreationDate", alias);
+
+ ensureLoaded();
+ Date result = getCreationDate(alias, privateKR);
+ if (result == null)
+ result = getCreationDate(alias, publicKR);
+
+ log.exiting(this.getClass().getName(), "engineGetCreationDate", result);
+ return result;
}
public Key engineGetKey(String alias, char[] password)
throws UnrecoverableKeyException
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return null;
- }
- if (!(keyring instanceof IPrivateKeyring))
- {
- throw new IllegalStateException("not a private keyring");
- }
+ log.entering(this.getClass().getName(), "engineGetKey",
+ String.valueOf(password));
+
+ ensureLoaded();
+ Key result = null;
if (password == null)
{
- if (((IPrivateKeyring) keyring).containsPublicKey(alias))
- {
- return ((IPrivateKeyring) keyring).getPublicKey(alias);
- }
- }
- if (((IPrivateKeyring) keyring).containsPrivateKey(alias))
- {
- return ((IPrivateKeyring) keyring).getPrivateKey(alias, password);
+ if (privateKR.containsPublicKey(alias))
+ result = privateKR.getPublicKey(alias);
}
- return null;
+ else if (privateKR.containsPrivateKey(alias))
+ result = privateKR.getPrivateKey(alias, password);
+
+ log.exiting(this.getClass().getName(), "engineGetKey", result);
+ return result;
}
public void engineSetKeyEntry(String alias, Key key, char[] password,
- Certificate[] chain) throws KeyStoreException
+ Certificate[] chain)
+ throws KeyStoreException
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- keyring = new GnuPrivateKeyring("HMAC-SHA-1", 20, "AES", "OFB", 16);
- }
- if (!(keyring instanceof IPrivateKeyring))
- {
- throw new IllegalStateException("not a private keyring");
- }
+ log.entering(this.getClass().getName(), "engineSetKeyEntry",
+ new Object[] { alias, key, password, chain });
+ ensureLoaded();
if (key instanceof PublicKey)
+ privateKR.putPublicKey(alias, (PublicKey) key);
+ else
{
- ((IPrivateKeyring) keyring).putPublicKey(alias, (PublicKey) key);
- return;
+ if (! (key instanceof PrivateKey) && ! (key instanceof SecretKey))
+ throw new KeyStoreException("cannot store keys of type "
+ + key.getClass().getName());
+ privateKR.putCertPath(alias, chain);
+ log.finest("About to put private key in keyring...");
+ privateKR.putPrivateKey(alias, key, password);
}
- if (!(key instanceof PrivateKey) && !(key instanceof SecretKey))
- {
- throw new KeyStoreException("cannot store keys of type "
- + key.getClass().getName());
- }
- try
- {
- CertificateFactory fact = CertificateFactory.getInstance("X.509");
- ((IPrivateKeyring) keyring).putCertPath(alias, chain);
- }
- catch (CertificateException ce)
- {
- throw new KeyStoreException(ce.toString());
- }
- ((IPrivateKeyring) keyring).putPrivateKey(alias, key, password);
+
+ log.exiting(this.getClass().getName(), "engineSetKeyEntry");
}
public void engineSetKeyEntry(String alias, byte[] key, Certificate[] chain)
throws KeyStoreException
{
- throw new KeyStoreException("method not supported");
+ KeyStoreException x = new KeyStoreException("method not supported");
+ log.throwing(this.getClass().getName(), "engineSetKeyEntry(3)", x);
+ throw x;
}
public boolean engineIsCertificateEntry(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return false;
- }
- if (!(keyring instanceof IPublicKeyring))
- {
- return false;
- }
- return ((IPublicKeyring) keyring).containsCertificate(alias);
+ log.entering(this.getClass().getName(), "engineIsCertificateEntry", alias);
+
+ ensureLoaded();
+ boolean result = publicKR.containsCertificate(alias);
+
+ log.exiting(this.getClass().getName(), "engineIsCertificateEntry",
+ Boolean.valueOf(result));
+ return result;
}
public boolean engineIsKeyEntry(String alias)
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return false;
- }
- if (!(keyring instanceof IPrivateKeyring))
- {
- return false;
- }
- return ((IPrivateKeyring) keyring).containsPublicKey(alias)
- || ((IPrivateKeyring) keyring).containsPrivateKey(alias);
+ log.entering(this.getClass().getName(), "engineIsKeyEntry", alias);
+
+ ensureLoaded();
+ boolean result = privateKR.containsPublicKey(alias)
+ || privateKR.containsPrivateKey(alias);
+
+ log.exiting(this.getClass().getName(), "engineIsKeyEntry",
+ Boolean.valueOf(result));
+ return result;
}
public void engineLoad(InputStream in, char[] password) throws IOException
{
+ log.entering(this.getClass().getName(), "engineLoad", String.valueOf(password));
if (in != null)
{
- if (!in.markSupported())
- {
- in = new BufferedInputStream(in);
- }
- in.mark(5);
- for (int i = 0; i < 4; i++)
- if (in.read() != Registry.GKR_MAGIC[i])
- throw new MalformedKeyringException("incorrect magic");
- int usage = in.read();
- in.reset();
- HashMap attr = new HashMap();
- attr.put(IKeyring.KEYRING_DATA_IN, in);
- attr.put(IKeyring.KEYRING_PASSWORD, password);
- switch (usage)
- {
- case GnuPublicKeyring.USAGE:
- keyring = new GnuPublicKeyring();
- break;
- case GnuPrivateKeyring.USAGE:
- keyring = new GnuPrivateKeyring();
- break;
- default:
- throw new MalformedKeyringException("unsupported ring usage: "
- + Integer.toBinaryString(usage));
- }
- keyring.load(attr);
+ if (! in.markSupported())
+ in = new BufferedInputStream(in);
+
+ loadPrivateKeyring(in, password);
+ loadPublicKeyring(in, password);
}
+ else
+ createNewKeyrings();
+
loaded = true;
+
+ log.exiting(this.getClass().getName(), "engineLoad");
}
public void engineStore(OutputStream out, char[] password) throws IOException
{
- if (!loaded || keyring == null)
- {
- throw new IllegalStateException ("not loaded");
- }
+ log.entering(this.getClass().getName(), "engineStore", String.valueOf(password));
+
+ ensureLoaded();
HashMap attr = new HashMap();
attr.put(IKeyring.KEYRING_DATA_OUT, out);
attr.put(IKeyring.KEYRING_PASSWORD, password);
- keyring.store(attr);
+
+ privateKR.store(attr);
+ publicKR.store(attr);
+
+ log.exiting(this.getClass().getName(), "engineStore");
}
public int engineSize()
{
- if (!loaded)
- {
- throw new IllegalStateException ("not loaded");
- }
- if (keyring == null)
- {
- return 0;
- }
- return keyring.size();
+ ensureLoaded();
+ return privateKR.size() + publicKR.size();
+ }
+
+ /**
+ * Ensure that the underlying keyring pair is loaded. Throw an exception if it
+ * isn't; otherwise returns silently.
+ *
+ * @throws IllegalStateException if the keyring is not loaded.
+ */
+ private void ensureLoaded()
+ {
+ if (! loaded)
+ throw new IllegalStateException(NOT_LOADED);
+ }
+
+ /**
+ * Load the private keyring from the designated input stream.
+ *
+ * @param in the input stream to process.
+ * @param password the password protecting the keyring.
+ * @throws MalformedKeyringException if the keyring is not a private one.
+ * @throws IOException if an I/O related exception occurs during the process.
+ */
+ private void loadPrivateKeyring(InputStream in, char[] password)
+ throws MalformedKeyringException, IOException
+ {
+ log.entering(this.getClass().getName(), "loadPrivateKeyring");
+
+ in.mark(5);
+ for (int i = 0; i < 4; i++)
+ if (in.read() != Registry.GKR_MAGIC[i])
+ throw new MalformedKeyringException("incorrect magic");
+
+ 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));
+ HashMap attr = new HashMap();
+ attr.put(IKeyring.KEYRING_DATA_IN, in);
+ attr.put(IKeyring.KEYRING_PASSWORD, password);
+ privateKR = new GnuPrivateKeyring();
+ privateKR.load(attr);
+
+ log.exiting(this.getClass().getName(), "loadPrivateKeyring");
+ }
+
+ /**
+ * Load the public keyring from the designated input stream.
+ *
+ * @param in the input stream to process.
+ * @param password the password protecting the keyring.
+ * @throws MalformedKeyringException if the keyring is not a public one.
+ * @throws IOException if an I/O related exception occurs during the process.
+ */
+ private void loadPublicKeyring(InputStream in, char[] password)
+ throws MalformedKeyringException, IOException
+ {
+ log.entering(this.getClass().getName(), "loadPublicKeyring");
+
+ in.mark(5);
+ for (int i = 0; i < 4; i++)
+ if (in.read() != Registry.GKR_MAGIC[i])
+ throw new MalformedKeyringException("incorrect magic");
+
+ 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));
+ HashMap attr = new HashMap();
+ attr.put(IKeyring.KEYRING_DATA_IN, in);
+ attr.put(IKeyring.KEYRING_PASSWORD, password);
+ publicKR = new GnuPublicKeyring();
+ publicKR.load(attr);
+
+ log.exiting(this.getClass().getName(), "loadPublicKeyring");
+ }
+
+ /**
+ * Return the creation date of a named alias in a designated keyring.
+ *
+ * @param alias the alias to look for.
+ * @param keyring the keyring to search.
+ * @return the creattion date of the entry named <code>alias</code>. Return
+ * <code>null</code> if <code>alias</code> was not found in
+ * <code>keyring</code>.
+ */
+ private Date getCreationDate(String alias, IKeyring keyring)
+ {
+ log.entering(this.getClass().getName(), "getCreationDate",
+ new Object[] { alias, keyring });
+
+ Date result = null;
+ if (keyring != null)
+ for (Iterator it = keyring.get(alias).iterator(); it.hasNext();)
+ {
+ Object o = it.next();
+ if (o instanceof PrimitiveEntry)
+ {
+ result = ((PrimitiveEntry) o).getCreationDate();
+ break;
+ }
+ }
+
+ log.exiting(this.getClass().getName(), "getCreationDate", result);
+ return result;
+ }
+
+ /** Create empty keyrings. */
+ private void createNewKeyrings()
+ {
+ log.entering(this.getClass().getName(), "createNewKeyrings");
+
+ privateKR = new GnuPrivateKeyring("HMAC-SHA-1", 20, "AES", "OFB", 16);
+ publicKR = new GnuPublicKeyring("HMAC-SHA-1", 20);
+
+ log.exiting(this.getClass().getName(), "createNewKeyrings");
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD2Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
index 935f5e5a3e2..dd489639f29 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD2Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD2 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacMD2Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD2Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD2_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD4Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
index 49507a6dd5f..6fadf02621b 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD4Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD4 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacMD4Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD4Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD4_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD5Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
index 3bc0fea6b30..2ef43974f82 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacMD5Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-MD5 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacMD5Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacMD5Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.MD5_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
index 6a57e6c9d4e..ad7a2340eed 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD128Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-RIPEMD-128 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacRipeMD128Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacRipeMD128Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD128_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
index a47e1a5c74b..c14e3b3bf24 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacRipeMD160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-RIPEMD-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacRipeMD160Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacRipeMD160Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.RIPEMD160_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
index e251dc373ab..f102c9ebcde 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA160Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-SHA-160 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacSHA160Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacSHA160Spi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.SHA160_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
index 7caa260415e..cadad1cf5fa 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA256Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-256 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1 $
*/
public final class HMacSHA256Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public final class HMacSHA256Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
index d3e454b54d6..69ef38e50f6 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA384Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-384 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1 $
*/
public class HMacSHA384Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public class HMacSHA384Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
index f02267c847d..abceb4a92c9 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacSHA512Spi.java
@@ -42,8 +42,6 @@ import gnu.java.security.Registry;
/**
* <p>The implementation of the HMAC-SHA-512 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.</p>
- *
- * @version $Revision: 1.1 $
*/
public class HMacSHA512Spi extends MacAdapter
{
@@ -64,4 +62,4 @@ public class HMacSHA512Spi extends MacAdapter
// Instance methods
// -------------------------------------------------------------------------
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacTigerSpi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
index e4eb26ca948..511993ea413 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacTigerSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the Tiger <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacTigerSpi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacTigerSpi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.TIGER_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
index 8e2ef6d2f8d..706e0cd5a6b 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/HMacWhirlpoolSpi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the HMAC-Whirlpool <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class HMacWhirlpoolSpi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class HMacWhirlpoolSpi extends MacAdapter
{
super(Registry.HMAC_NAME_PREFIX + Registry.WHIRLPOOL_HASH);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/MacAdapter.java b/libjava/classpath/gnu/javax/crypto/jce/mac/MacAdapter.java
index c323413a4a8..dc019ca20f4 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/MacAdapter.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/MacAdapter.java
@@ -57,8 +57,6 @@ import javax.crypto.MacSpi;
* 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>
- *
- * @version $Revision: 1.2 $
*/
class MacAdapter extends MacSpi implements Cloneable
{
@@ -153,4 +151,4 @@ class MacAdapter extends MacSpi implements Cloneable
{
mac.update(in, off, len);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/TMMH16Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/TMMH16Spi.java
index 0a4222237ef..1734e1e695b 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/TMMH16Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/TMMH16Spi.java
@@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* The implementation of the TMMH16 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class TMMH16Spi extends MacAdapter
{
@@ -88,4 +86,4 @@ public final class TMMH16Spi extends MacAdapter
throw new InvalidAlgorithmParameterException(iae.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/UHash32Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/UHash32Spi.java
index a24b8e59c9f..af678c0fa8a 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/UHash32Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/UHash32Spi.java
@@ -43,8 +43,6 @@ import gnu.java.security.Registry;
/**
* The implementation of the UHash-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class UHash32Spi extends MacAdapter
{
@@ -56,4 +54,4 @@ public final class UHash32Spi extends MacAdapter
{
super(Registry.UHASH32);
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/mac/UMac32Spi.java b/libjava/classpath/gnu/javax/crypto/jce/mac/UMac32Spi.java
index 52c58f36f75..4e90468b10c 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/mac/UMac32Spi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/mac/UMac32Spi.java
@@ -50,8 +50,6 @@ import java.security.spec.AlgorithmParameterSpec;
/**
* The implementation of the UMAC-32 <i>Service Provider Interface</i>
* (<b>SPI</b>) adapter.
- *
- * @version $Revision: 1.1 $
*/
public final class UMac32Spi extends MacAdapter
{
@@ -88,4 +86,4 @@ public final class UMac32Spi extends MacAdapter
throw new InvalidAlgorithmParameterException(iae.getMessage());
}
}
-} \ No newline at end of file
+}
diff --git a/libjava/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java b/libjava/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java
index 5b3badc8d83..0d09d5cef2c 100644
--- a/libjava/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java
+++ b/libjava/classpath/gnu/javax/crypto/jce/sig/DHKeyPairGeneratorSpi.java
@@ -44,6 +44,7 @@ import java.security.spec.AlgorithmParameterSpec;
import java.util.HashMap;
import javax.crypto.spec.DHGenParameterSpec;
+import javax.crypto.spec.DHParameterSpec;
import gnu.java.security.Registry;
import gnu.java.security.jce.sig.KeyPairGeneratorAdapter;
@@ -75,7 +76,8 @@ public class DHKeyPairGeneratorSpi
HashMap attributes = new HashMap();
if (params != null)
{
- if (! (params instanceof DHGenParameterSpec))
+ if (! (params instanceof DHGenParameterSpec) &&
+ ! (params instanceof DHParameterSpec))
throw new InvalidAlgorithmParameterException("params");
attributes.put(GnuDHKeyPairGenerator.DH_PARAMETERS, params);
OpenPOWER on IntegriCloud