public class EncryptionKey extends Object implements org.apache.directory.api.asn1.Asn1Object
EncryptionKey ::= SEQUENCE { keytype [0] Int32 -- actually encryption type --, keyvalue [1] OCTET STRING }
Constructor and Description |
---|
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.
|
Modifier and Type | Method and Description |
---|---|
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.
|
ByteBuffer |
encode(ByteBuffer buffer)
Encode the EncryptionKey message to a PDU.
|
boolean |
equals(Object o) |
EncryptionType |
getKeyType()
Returns the key type.
|
byte[] |
getKeyValue()
Returns the key value.
|
int |
getKeyVersion()
Returns the key version.
|
int |
hashCode() |
void |
setKeyType(EncryptionType keyType)
Set the encryption type
|
void |
setKeyValue(byte[] keyValue)
Set the key value
|
void |
setKeyVersion(int keyVersion)
Set the key value
|
String |
toString() |
public EncryptionKey()
public EncryptionKey(EncryptionType keyType, byte[] keyValue)
keyType
- The encryptionTypekeyValue
- The valuepublic EncryptionKey(EncryptionType keyType, byte[] keyValue, int keyVersion)
keyType
- The encryptionTypekeyValue
- The valuekeyVersion
- ???public void destroy()
public EncryptionType getKeyType()
public void setKeyType(EncryptionType keyType)
keyType
- The encryption typepublic byte[] getKeyValue()
public int getKeyVersion()
public void setKeyVersion(int keyVersion)
keyVersion
- The key versionpublic void setKeyValue(byte[] keyValue)
keyValue
- The key valuepublic boolean equals(Object o)
equals
in class Object
Object.equals(Object)
public int computeLength()
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)
computeLength
in interface org.apache.directory.api.asn1.Asn1Object
public ByteBuffer encode(ByteBuffer buffer) throws org.apache.directory.api.asn1.EncoderException
EncryptionKey : 0x30 LL 0xA0 LL 0x02 0x01 keyType 0xA1 LL 0x04 LL keyValue
encode
in interface org.apache.directory.api.asn1.Asn1Object
buffer
- The buffer where to put the PDU. It should have been allocated
before, with the right size.org.apache.directory.api.asn1.EncoderException
public String toString()
toString
in class Object
Object.toString()
Copyright © 2003–2023 The Apache Software Foundation. All rights reserved.