com.ibm.security.krb5

Class EncryptionKey

  1. java.lang.Object
  2. extended bycom.ibm.security.krb5.EncryptionKey
All implemented interfaces:
java.lang.Cloneable

  1. public class EncryptionKey
  2. extends java.lang.Object
  3. implements java.lang.Cloneable
This class encapsulates the concept of an EncryptionKey.

Field Summary

Modifier and Type Field and Description
  1. static
  2. int
KEYTYPE_DEFAULT
The default key type is the first key type listed in the default_tkt_enctypes entry of the Kerberos config file.
  1. static
  2. EncryptionKey
NULL_KEY

Constructor Summary

Constructor and Description
EncryptionKey(byte[] new_keyValue)
EncryptionKey(byte[] new_keyValue,int new_keyType,java.lang.Integer new_kvno)
EncryptionKey(com.ibm.security.util.DerValue encoding)
Constructs an instance of EncryptionKey type.
EncryptionKey(EncryptionKey key)
Generates a sub-sessionkey from a given session key.
EncryptionKey(int new_keyType,byte[] new_keyValue)
Constructs an EncryptionKey by using the specified key type and key value.
EncryptionKey(java.lang.String password)
EncryptionKey(java.lang.String password,int keyType,java.lang.Integer kvno)
Creates an encryption key of the specified type.
EncryptionKey(java.lang.String password,int keyType,java.lang.String salt,java.lang.Integer kvno)
EncryptionKey(java.lang.String password,java.lang.String salt)
EncryptionKey(java.lang.String password,java.lang.String salt,int encType)
EncryptionKey(java.lang.String password,java.lang.String salt,int encType,byte[] params)

Method Summary

Modifier and Type Method and Description
  1. static
  2. EncryptionKey
acquireSecretKey(PrincipalName princ,java.lang.String keytab)
Obtains the latest version of the secret key of the principal from a keytab.
  1. static
  2. EncryptionKey[]
acquireSecretKeys(java.lang.String password,java.lang.String salt,boolean pa_exists,int pa_etype,byte[] pa_s2kparams)
Generates a list of keys using the given principal, password, and the pre-authentication values.
  1. byte[]
asn1Encode()
Returns the ASN.1 encoding of this EncryptionKey.
  1. java.lang.Object
clone()
  1. void
destroy()
  1. boolean
equals(java.lang.Object other)
  1. static
  2. EncryptionKey
findKey(int etype,EncryptionKey[] keys)
  1. byte[]
getBytes()
Returns the raw key bytes, not ASN.1 encoded.
  1. int
getEType()
Returns the key type.
  1. int
getKeyType()
Returns the key type.
  1. java.lang.Integer
getKeyVersionNumber()
  1. int
hashCode()
  1. static
  2. EncryptionKey
parse(com.ibm.security.util.DerInputStream data,byte explicitTag,boolean optional)
Parse (unmarshal) an Encryption key from a DER input stream.
  1. void
writeKey(CCacheOutputStream cos)
Writes key value in FCC format to a CCacheOutputStream.
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait

Field Detail

NULL_KEY

  1. public static EncryptionKey NULL_KEY

KEYTYPE_DEFAULT

  1. public static final int KEYTYPE_DEFAULT
The default key type is the first key type listed in the default_tkt_enctypes entry of the Kerberos config file. If there is not such entry or the entry cannot be read or the entry is not supported, DES-CBC-MD5 is set as the default.

Constructor Detail

EncryptionKey

  1. public EncryptionKey(byte[] new_keyValue,
  2. int new_keyType,
  3. java.lang.Integer new_kvno)

EncryptionKey

  1. public EncryptionKey(int new_keyType,
  2. byte[] new_keyValue)
Constructs an EncryptionKey by using the specified key type and key value. It is used to recover the key when retrieving data from credential cache file.

EncryptionKey

  1. public EncryptionKey(byte[] new_keyValue)

EncryptionKey

  1. public EncryptionKey(java.lang.String password)
  2. throws KrbCryptoException
Throws:

EncryptionKey

  1. public EncryptionKey(java.lang.String password,
  2. java.lang.String salt)
  3. throws KrbCryptoException
Throws:

EncryptionKey

  1. public EncryptionKey(java.lang.String password,
  2. java.lang.String salt,
  3. int encType)
  4. throws KrbCryptoException
Throws:

EncryptionKey

  1. public EncryptionKey(java.lang.String password,
  2. java.lang.String salt,
  3. int encType,
  4. byte[] params)
  5. throws KrbCryptoException
Throws:

EncryptionKey

  1. public EncryptionKey(java.lang.String password,
  2. int keyType,
  3. java.lang.Integer kvno)
  4. throws KrbCryptoException
Creates an encryption key of the specified type. The specified password is converted to a DES key.
Throws:

EncryptionKey

  1. public EncryptionKey(java.lang.String password,
  2. int keyType,
  3. java.lang.String salt,
  4. java.lang.Integer kvno)
  5. throws KrbCryptoException
Throws:

EncryptionKey

  1. public EncryptionKey(EncryptionKey key)
  2. throws KrbCryptoException
Generates a sub-sessionkey from a given session key.
Throws:

EncryptionKey

  1. public EncryptionKey(com.ibm.security.util.DerValue encoding)
  2. throws Asn1Exception
  3. java.io.IOException
Constructs an instance of EncryptionKey type.
Parameters:
encoding - a single DER-encoded value.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
java.io.IOException - if an I/O error occurs while reading encoded data.

Method Detail

getEType

  1. public int getEType()
Returns the key type. The recommended method is #getKeyType.

getKeyVersionNumber

  1. public final java.lang.Integer getKeyVersionNumber( )

getBytes

  1. public final byte[] getBytes()
Returns the raw key bytes, not ASN.1 encoded.

getKeyType

  1. public int getKeyType()
Returns the key type.

clone

  1. public java.lang.Object clone()
Overrides:
clone in class java.lang.Object

acquireSecretKey

  1. public static EncryptionKey acquireSecretKey( PrincipalName princ,
  2. java.lang.String keytab)
  3. throws KrbException
  4. java.io.IOException
Obtains the latest version of the secret key of the principal from a keytab.
Parameters:
princ - the principal whose secret key is desired
keytab - the path to the keytab file. A value of null will be accepted to indicate that the default path should be searched.
Throws:
java.io.IOException

asn1Encode

  1. public byte[] asn1Encode()
  2. throws Asn1Exception
  3. java.io.IOException
Returns the ASN.1 encoding of this EncryptionKey. EncryptionKey ::= SEQUENCE { keytype[0] INTEGER, keyvalue[1] OCTET STRING }

This definition reflects the Network Working Group RFC 1510 specifications dated September 1993 and available at http://www.ietf.org/rfc/rfc1510.txt.

Throws:
java.io.IOException

destroy

  1. public void destroy()

parse

  1. public static EncryptionKey parse( com.ibm.security.util.DerInputStream data,
  2. byte explicitTag,
  3. boolean optional)
  4. throws Asn1Exception
  5. java.io.IOException
Parse (unmarshal) an Encryption key from a DER input stream. This form parsing might be used when expanding a value which is part of a constructed sequence and uses explicitly tagged type.
Parameters:
data - the Der input stream value, which contains one or more marshaled value.
explicitTag - tag number.
optional - indicate if this data field is optional
Returns:
an instance of EncryptionKey.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
java.io.IOException - if an I/O error occurs while reading encoded data.

writeKey

  1. public void writeKey(CCacheOutputStream cos)
  2. throws java.io.IOException
Writes key value in FCC format to a CCacheOutputStream.
Parameters:
cos - a CCacheOutputStream to be written to.
Throws:
java.io.IOException - if an I/O exception occurs.
See Also:

acquireSecretKeys

  1. public static EncryptionKey[] acquireSecretKeys( java.lang.String password,
  2. java.lang.String salt,
  3. boolean pa_exists,
  4. int pa_etype,
  5. byte[] pa_s2kparams)
  6. throws KrbException
Generates a list of keys using the given principal, password, and the pre-authentication values.
Throws:

findKey

  1. public static EncryptionKey findKey( int etype,
  2. EncryptionKey[] keys)
  3. throws KrbException
Throws:

hashCode

  1. public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

  1. public boolean equals(java.lang.Object other)
Overrides:
equals in class java.lang.Object