org.apache.directory.server.kerberos.shared.messages.value
Class EncryptionKey

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.server.kerberos.shared.messages.value.EncryptionKey
All Implemented Interfaces:
org.apache.directory.shared.asn1.Asn1Object

public class EncryptionKey
extends org.apache.directory.shared.asn1.AbstractAsn1Object

A Kerberos symmetric encryption key, which includes metadata support for the associated key type and key version number. The ASN.1 description for this structure is : EncryptionKey ::= SEQUENCE { keytype [0] Int32 -- actually encryption type --, keyvalue [1] OCTET STRING }

Version:
$Rev: 902575 $, $Date: 2010-01-24 15:38:06 +0100 (Sun, 24 Jan 2010) $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
EncryptionKey()
          Creates a new instance of EncryptionKey.
EncryptionKey(EncryptionType keyType, byte[] keyValue)
          Creates a new instance of EncryptionKey.
EncryptionKey(EncryptionType keyType, byte[] keyValue, int keyVersion)
          Creates a new instance of EncryptionKey.
 
Method Summary
 int computeLength()
          Compute the EncryptionKey length EncryptionKey : 0x30 L1 EncryptionKey | +--> 0xA0 L2 keyType tag | | | +--> 0x02 L2-1 keyType (int) | +--> 0xA1 L3 keyValue tag | +--> 0x04 L3-1 keyValue (OCTET STRING) where L1 = L2 + lenght(0xA0) + length(L2) + L3 + lenght(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)
 void destroy()
          Destroys this key by overwriting the symmetric key material with zeros.
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the EncryptionKey message to a PDU.
 boolean equals(java.lang.Object o)
           
 EncryptionType getKeyType()
          Returns the key type.
 byte[] getKeyValue()
          Returns the key value.
 int getKeyVersion()
          Returns the key version.
 void setKeyType(EncryptionType keyType)
          Set the encryption type
 void setKeyValue(byte[] keyValue)
          Set the key value
 void setKeyVersion(int keyVersion)
          Set the key value
 java.lang.String toString()
           
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

EncryptionKey

public EncryptionKey()
Creates a new instance of EncryptionKey.


EncryptionKey

public EncryptionKey(EncryptionType keyType,
                     byte[] keyValue)
Creates a new instance of EncryptionKey.

Parameters:
keyType - The encryptionType
keyValue - The value

EncryptionKey

public EncryptionKey(EncryptionType keyType,
                     byte[] keyValue,
                     int keyVersion)
Creates a new instance of EncryptionKey.

Parameters:
keyType - The encryptionType
keyValue - The value
keyVersion - ???
Method Detail

destroy

public void destroy()
Destroys this key by overwriting the symmetric key material with zeros.


getKeyType

public EncryptionType getKeyType()
Returns the key type.

Returns:
The key type.

setKeyType

public void setKeyType(EncryptionType keyType)
Set the encryption type

Parameters:
keyType - The encryption type

getKeyValue

public byte[] getKeyValue()
Returns the key value.

Returns:
The key value.

getKeyVersion

public int getKeyVersion()
Returns the key version.

Returns:
The key version.

setKeyVersion

public void setKeyVersion(int keyVersion)
Set the key value

Parameters:
keyVersion - The key version

setKeyValue

public void setKeyValue(byte[] keyValue)
Set the key value

Parameters:
keyValue - The key value

equals

public boolean equals(java.lang.Object o)
Overrides:
equals in class java.lang.Object
See Also:
Object.equals(Object)

computeLength

public int computeLength()
Compute the EncryptionKey length EncryptionKey : 0x30 L1 EncryptionKey | +--> 0xA0 L2 keyType tag | | | +--> 0x02 L2-1 keyType (int) | +--> 0xA1 L3 keyValue tag | +--> 0x04 L3-1 keyValue (OCTET STRING) where L1 = L2 + lenght(0xA0) + length(L2) + L3 + lenght(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)

Specified by:
computeLength in interface org.apache.directory.shared.asn1.Asn1Object
Specified by:
computeLength in class org.apache.directory.shared.asn1.AbstractAsn1Object

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws org.apache.directory.shared.asn1.codec.EncoderException
Encode the EncryptionKey message to a PDU. EncryptionKey : 0x30 LL 0xA0 LL 0x02 0x01 keyType 0xA1 LL 0x04 LL keyValue

Specified by:
encode in interface org.apache.directory.shared.asn1.Asn1Object
Overrides:
encode in class org.apache.directory.shared.asn1.AbstractAsn1Object
Parameters:
buffer - The buffer where to put the PDU. It should have been allocated before, with the right size.
Returns:
The constructed PDU.
Throws:
org.apache.directory.shared.asn1.codec.EncoderException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.