You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by er...@apache.org on 2007/05/04 05:58:53 UTC
svn commit: r535077 -
/directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java
Author: erodriguez
Date: Thu May 3 20:58:53 2007
New Revision: 535077
URL: http://svn.apache.org/viewvc?view=rev&rev=535077
Log:
Added javadocs to EncryptionKey.
Modified:
directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java
Modified: directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java?view=diff&rev=535077&r1=535076&r2=535077
==============================================================================
--- directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java (original)
+++ directory/apacheds/branches/kerberos-encryption-types/kerberos-shared/src/main/java/org/apache/directory/server/kerberos/shared/messages/value/EncryptionKey.java Thu May 3 20:58:53 2007
@@ -26,6 +26,9 @@
/**
+ * A Kerberos symmetric encryption key, which includes metadata support for
+ * the associated key type and key version number.
+ *
* @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
* @version $Rev$, $Date$
*/
@@ -36,46 +39,41 @@
private int keyVersion;
- public EncryptionKey(EncryptionType keyType, byte[] keyValue)
+ /**
+ * Creates a new instance of EncryptionKey.
+ *
+ * @param keyType
+ * @param keyValue
+ */
+ public EncryptionKey( EncryptionType keyType, byte[] keyValue )
{
this.keyType = keyType;
this.keyValue = keyValue;
}
- public EncryptionKey(EncryptionType keyType, byte[] keyValue, int keyVersion)
+ /**
+ * Creates a new instance of EncryptionKey. This constructor supports 'keyVersion',
+ * which is sent over the wire as part of EncryptedData but makes more sense
+ * in the domain model to have here as part of the key itself. Therefore, the
+ * keyVersion should only be constructor-injected when EncryptionKey's are
+ * retrieved from persisted storage.
+ *
+ * @param keyType
+ * @param keyValue
+ * @param keyVersion
+ */
+ public EncryptionKey( EncryptionType keyType, byte[] keyValue, int keyVersion )
{
this.keyType = keyType;
this.keyValue = keyValue;
- /**
- * keyVersion is sent over the wire as part of EncryptedData but makes more sense
- * in the domain model to have here as part of the key itself. Therefore, the
- * keyVersion should only be constructor-injected when EncryptionKey's are
- * retrieved from persisted storage.
- *
- * TODO - keyVersion may move into persisted user configuration
- */
this.keyVersion = keyVersion;
}
- public boolean equals( Object o )
- {
- if ( this == o )
- {
- return true;
- }
-
- if ( !( o instanceof EncryptionKey ) )
- {
- return false;
- }
-
- EncryptionKey that = ( EncryptionKey ) o;
- return ( this.keyType == that.keyType ) && ( Arrays.equals( this.keyValue, that.keyValue ) );
- }
-
-
+ /**
+ * Destroys this key by overwriting the symmetric key material with zeros.
+ */
public synchronized void destroy()
{
if ( keyValue != null )
@@ -88,26 +86,58 @@
}
- public String toString()
- {
- return keyType.toString() + " (" + keyType.getOrdinal() + ")";
- }
-
-
+ /**
+ * Returns the key type.
+ *
+ * @return The key type.
+ */
public EncryptionType getKeyType()
{
return keyType;
}
+ /**
+ * Returns the key value.
+ *
+ * @return The key value.
+ */
public byte[] getKeyValue()
{
return keyValue;
}
+ /**
+ * Returns the key version.
+ *
+ * @return The key version.
+ */
public int getKeyVersion()
{
return keyVersion;
+ }
+
+
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( !( o instanceof EncryptionKey ) )
+ {
+ return false;
+ }
+
+ EncryptionKey that = ( EncryptionKey ) o;
+ return ( this.keyType == that.keyType ) && ( Arrays.equals( this.keyValue, that.keyValue ) );
+ }
+
+
+ public String toString()
+ {
+ return keyType.toString() + " (" + keyType.getOrdinal() + ")";
}
}