com.ibm.security.krb5
Class EncryptionKey
- java.lang.Object
com.ibm.security.krb5.EncryptionKey
All implemented interfaces:
java.lang.Cloneable
- public class EncryptionKey
- extends java.lang.Object
- implements java.lang.Cloneable
Field Summary
Modifier and Type | Field and Description |
---|---|
|
KEYTYPE_DEFAULT
The default key type is the first key type listed in the
default_tkt_enctypes entry of the Kerberos config file.
|
|
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 |
---|---|
|
acquireSecretKey(PrincipalName princ,java.lang.String keytab)
Obtains the latest version of the secret key of
the principal from a keytab.
|
|
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.
|
|
asn1Encode()
Returns the ASN.1 encoding of this EncryptionKey.
|
|
clone()
|
|
destroy()
|
|
equals(java.lang.Object other)
|
|
findKey(int etype,EncryptionKey[] keys)
|
|
getBytes()
Returns the raw key bytes, not ASN.1 encoded.
|
|
getEType()
Returns the key type.
|
|
getKeyType()
Returns the key type.
|
|
getKeyVersionNumber()
|
|
hashCode()
|
|
parse(com.ibm.security.util.DerInputStream data,byte explicitTag,boolean optional)
Parse (unmarshal) an Encryption key from a DER input stream.
|
|
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
- public static EncryptionKey NULL_KEY
KEYTYPE_DEFAULT
- public static final int KEYTYPE_DEFAULT
Constructor Detail
EncryptionKey
- public EncryptionKey(byte[] new_keyValue,
- int new_keyType,
- java.lang.Integer new_kvno)
EncryptionKey
- public EncryptionKey(int new_keyType,
- 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
- public EncryptionKey(byte[] new_keyValue)
EncryptionKey
- public EncryptionKey(java.lang.String password)
- throws KrbCryptoException
Throws:
EncryptionKey
- public EncryptionKey(java.lang.String password,
- java.lang.String salt)
- throws KrbCryptoException
Throws:
EncryptionKey
- public EncryptionKey(java.lang.String password,
- java.lang.String salt,
- int encType)
- throws KrbCryptoException
Throws:
EncryptionKey
- public EncryptionKey(java.lang.String password,
- java.lang.String salt,
- int encType,
- byte[] params)
- throws KrbCryptoException
Throws:
EncryptionKey
- public EncryptionKey(java.lang.String password,
- int keyType,
- java.lang.Integer kvno)
- throws KrbCryptoException
Creates an encryption key of the specified type.
The specified
password
is converted to a DES key.
Throws:
EncryptionKey
- public EncryptionKey(java.lang.String password,
- int keyType,
- java.lang.String salt,
- java.lang.Integer kvno)
- throws KrbCryptoException
Throws:
EncryptionKey
- public EncryptionKey(EncryptionKey key)
- throws KrbCryptoException
Generates a sub-sessionkey from a given session key.
Throws:
EncryptionKey
- public EncryptionKey(com.ibm.security.util.DerValue encoding)
- throws Asn1Exception
- 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
- public int getEType()
Returns the key type.
The recommended method is #getKeyType.
getKeyVersionNumber
- public final java.lang.Integer getKeyVersionNumber( )
getBytes
- public final byte[] getBytes()
Returns the raw key bytes, not ASN.1 encoded.
getKeyType
- public int getKeyType()
Returns the key type.
clone
- public java.lang.Object clone()
Overrides:
clone
in class java.lang.Object
acquireSecretKey
- public static EncryptionKey acquireSecretKey( PrincipalName princ,
- java.lang.String keytab)
- throws KrbException
- 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
- public byte[] asn1Encode()
- throws Asn1Exception
- 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.
destroy
- public void destroy()
parse
- public static EncryptionKey parse( com.ibm.security.util.DerInputStream data,
- byte explicitTag,
- boolean optional)
- throws Asn1Exception
- 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
- public void writeKey(CCacheOutputStream cos)
- 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
- public static EncryptionKey[] acquireSecretKeys( java.lang.String password,
- java.lang.String salt,
- boolean pa_exists,
- int pa_etype,
- byte[] pa_s2kparams)
- throws KrbException
Generates a list of keys using the given principal, password,
and the pre-authentication values.
Throws:
findKey
- public static EncryptionKey findKey( int etype,
- EncryptionKey[] keys)
- throws KrbException
Throws:
hashCode
- public int hashCode()
Overrides:
hashCode
in class java.lang.Object
equals
- public boolean equals(java.lang.Object other)
Overrides:
equals
in class java.lang.Object
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.