diff options
-rw-r--r-- | ChangeLog | 3 | ||||
-rw-r--r-- | gnu/javax/crypto/jce/mac/MacAdapter.java | 18 |
2 files changed, 19 insertions, 2 deletions
@@ -1,5 +1,8 @@ 2006-01-28 Raif S. Naffah <raif@swiftdsl.com.au> + * gnu/javax/crypto/jce/mac/MacAdapter.java (MacAdapter(IMac, Map)): New + constructor for cloning purposes. + (clone): New implementation that ensures cloning. * gnu/javax/crypto/mac/HMac.java (clone): Implement Cloneable. * gnu/java/security/Registry.java: Changed value of GNU_SECURITY to "GNU". diff --git a/gnu/javax/crypto/jce/mac/MacAdapter.java b/gnu/javax/crypto/jce/mac/MacAdapter.java index 86cc29c30..c323413a4 100644 --- a/gnu/javax/crypto/jce/mac/MacAdapter.java +++ b/gnu/javax/crypto/jce/mac/MacAdapter.java @@ -58,7 +58,7 @@ import javax.crypto.MacSpi; * message authentication code algorithm, such as the <i>Hashed Message * Authentication Code</i> (<b>HMAC</b>) algorithms.</p> * - * @version $Revision: 1.1 $ + * @version $Revision: 1.2 $ */ class MacAdapter extends MacSpi implements Cloneable { @@ -86,6 +86,20 @@ class MacAdapter extends MacSpi implements Cloneable attributes = new HashMap(); } + /** + * Private constructor for cloning purposes. + * + * @param mac a clone of the internal {@link IMac} instance. + * @param attributes a clone of the current {@link Map} of attributes. + */ + private MacAdapter(IMac mac, Map attributes) + { + super(); + + this.mac = mac; + this.attributes = attributes; + } + // Class methods // ----------------------------------------------------------------------- @@ -96,7 +110,7 @@ class MacAdapter extends MacSpi implements Cloneable public Object clone() throws CloneNotSupportedException { - return super.clone(); + return new MacAdapter((IMac) mac.clone(), new HashMap(attributes)); } // Instance methods implementing javax.crypto.MacSpi --------------------- |