com.ibm.security.krb5
Class EncryptedData
- java.lang.Object
com.ibm.security.krb5.EncryptedData
All implemented interfaces:
java.lang.Cloneable
- public class EncryptedData
- extends java.lang.Object
- implements java.lang.Cloneable
Field Summary
Modifier and Type | Field and Description |
---|---|
|
ETYPE_DES_CBC_CRC
|
|
ETYPE_DES_CBC_MD4
|
|
ETYPE_DES_CBC_MD5
|
|
ETYPE_DES3_CBC_SHA1
|
|
ETYPE_NULL
|
|
KERB_ETYPE_AES_HMAC_SHA1_128
|
|
KERB_ETYPE_AES_HMAC_SHA1_256
|
|
KERB_ETYPE_RC4_HMAC
|
|
KERB_ETYPE_RC4_HMAC_EXP
|
Constructor Summary
Constructor and Description |
---|
EncryptedData(com.ibm.security.util.DerValue encoding)
Constructs an instance of EncryptedData type.
|
EncryptedData(EncryptionKey key,byte[] plaintext)
|
EncryptedData(EncryptionKey key,byte[] ivec,byte[] plaintext)
|
EncryptedData(EncryptionKey key,byte[] plaintext,byte[] iv,int usage)
Encrypts the specified plaintext
using the algorithm specified by the key type.
|
EncryptedData(EncryptionKey key,byte[] plaintext,int usage)
Encrypts the specified plaintext
using the algorithm specified by the key type.
|
EncryptedData(int new_eType,java.lang.Integer new_kvno,byte[] new_cipher)
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
asn1Encode()
Returns an ASN.1 encoded EncryptedData type.
|
|
clone()
|
|
decrypt(EncryptionKey key)
|
|
decrypt(EncryptionKey key,byte[] ivec)
|
|
decrypt(EncryptionKey key,int usage)
Deciphers the encrypted text contained in an instance of EncryptedData
using the algorithm specified by the key type.
|
|
decryptedData()
|
|
encTypeToString()
|
|
encTypeToString(int enctype)
Converts the specified integer encryption type
to string.
|
|
getBytes()
Returns the raw cipher text bytes, not in ASN.1 encoding.
|
|
getEType()
|
|
getKeyVersionNumber()
|
|
isAES128EncType()
|
|
isAES128EncType(int encryptionType)
|
|
isAES256EncType()
|
|
isAES256EncType(int encryptionType)
|
|
isDes3EncType(int enctype)
|
|
isDesEncType()
|
|
isDesEncType(int enctype)
|
|
isRc4HMacEncType()
|
|
isRc4HMacEncType(int encryptionType)
|
|
isSupportedEncType()
|
|
isSupportedEncType(int encType)
Returns true if the specified encryption type is supported,
otherwise it returns false.
|
|
parse(com.ibm.security.util.DerInputStream data,byte explicitTag,boolean optional)
Parse (unmarshal) an EncryptedData from a DER input stream.
|
|
reset(byte[] data,boolean encoded)
Reset data stream after decryption, remove redundant bytes.
|
|
stringToEncType(java.lang.String encTypeString)
Converts the specified encryption type string to its
integer representation.
|
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
ETYPE_NULL
- public static final int ETYPE_NULL
See Also:
ETYPE_DES_CBC_CRC
- public static final int ETYPE_DES_CBC_CRC
See Also:
ETYPE_DES_CBC_MD4
- public static final int ETYPE_DES_CBC_MD4
See Also:
ETYPE_DES_CBC_MD5
- public static final int ETYPE_DES_CBC_MD5
See Also:
ETYPE_DES3_CBC_SHA1
- public static final int ETYPE_DES3_CBC_SHA1
See Also:
KERB_ETYPE_AES_HMAC_SHA1_128
- public static final int KERB_ETYPE_AES_HMAC_SHA1_128
See Also:
KERB_ETYPE_AES_HMAC_SHA1_256
- public static final int KERB_ETYPE_AES_HMAC_SHA1_256
See Also:
KERB_ETYPE_RC4_HMAC
- public static final int KERB_ETYPE_RC4_HMAC
See Also:
KERB_ETYPE_RC4_HMAC_EXP
- public static final int KERB_ETYPE_RC4_HMAC_EXP
See Also:
Constructor Detail
EncryptedData
- public EncryptedData(int new_eType,
- java.lang.Integer new_kvno,
- byte[] new_cipher)
EncryptedData
- public EncryptedData(EncryptionKey key,
- byte[] plaintext)
- throws KdcErrException
- KrbCryptoException
EncryptedData
- public EncryptedData(EncryptionKey key,
- byte[] plaintext,
- int usage)
- throws KdcErrException
- KrbCryptoException
Encrypts the specified plaintext
using the algorithm specified by the key type.
The specified key is the base key from which a specific
key is derived with the usage as an input.
The derived specific key is used for the encryption.
Parameters:
key
- the base encryption key plaintext
- the text to be encrypted usage
- the constant to be used as input for key derivation. Throws:
EncryptedData
- public EncryptedData(EncryptionKey key,
- byte[] plaintext,
- byte[] iv,
- int usage)
- throws KdcErrException
- KrbCryptoException
Encrypts the specified plaintext
using the algorithm specified by the key type.
The specified key is the base key from which a specific
key is derived with the usage as an input.
The derived specific key is used for the encryption.
Parameters:
key
- the base encryption key plaintext
- the text to be encrypted iv
- initialization vector usage
- the constant to be used as input for key derivation. Throws:
EncryptedData
- public EncryptedData(EncryptionKey key,
- byte[] ivec,
- byte[] plaintext)
- throws KdcErrException
- KrbCryptoException
EncryptedData
- public EncryptedData(com.ibm.security.util.DerValue encoding)
- throws Asn1Exception
- java.io.IOException
Constructs an instance of EncryptedData 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
clone
- public java.lang.Object clone()
Overrides:
clone
in class java.lang.Object
decrypt
- public byte[] decrypt(EncryptionKey key)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
decrypt
- public byte[] decrypt(EncryptionKey key,
- int usage)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
Deciphers the encrypted text contained in an instance of EncryptedData
using the algorithm specified by the key type.
The specified key is the base key from which a specific
key is derived with the usage as an input.
The derived specific key is used for the encryption.
Parameters:
key
- the base encryption key usage
- the constant to be used as input for key derivation. Throws:
decrypt
- public byte[] decrypt(EncryptionKey key,
- byte[] ivec)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
decryptedData
- public byte[] decryptedData()
- throws KdcErrException
Throws:
asn1Encode
- public byte[] asn1Encode()
- throws Asn1Exception
- java.io.IOException
Returns an ASN.1 encoded EncryptedData type.
EncryptedData ::= SEQUENCE {
etype[0] INTEGER, -- EncryptionType
kvno[1] INTEGER OPTIONAL,
cipher[2] OCTET STRING -- ciphertext
}
This definition reflects the Network Working Group RFC 1510 specifications dated September 1993 and available at http://www.ietf.org/rfc/rfc1510.txt.
Returns:
byte array of encoded EncryptedData object.
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. parse
- public static EncryptedData parse( com.ibm.security.util.DerInputStream data,
- byte explicitTag,
- boolean optional)
- throws Asn1Exception
- java.io.IOException
Parse (unmarshal) an EncryptedData 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 EncryptedData.
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. reset
- public byte[] reset(byte[] data,
- boolean encoded)
Reset data stream after decryption, remove redundant bytes.
Parameters:
data
- the decrypted data from decrypt(). encoded
- true if the encrypted data is ASN1 encoded data, false if the encrypted data is not ASN1 encoded data. Returns:
the reset byte array which holds exactly one asn1 datum including its tag and length.
getEType
- public int getEType()
getKeyVersionNumber
- public java.lang.Integer getKeyVersionNumber( )
getBytes
- public byte[] getBytes()
Returns the raw cipher text bytes, not in ASN.1 encoding.
stringToEncType
- public static int stringToEncType( java.lang.String encTypeString)
- throws java.lang.Exception
Converts the specified encryption type string to its
integer representation.
Throws exception if the input is null or is not a
valid encryption type.
Throws:
java.lang.Exception
isSupportedEncType
- public boolean isSupportedEncType( )
isSupportedEncType
- public static boolean isSupportedEncType( int encType)
Returns true if the specified encryption type is supported,
otherwise it returns false.
encTypeToString
- public java.lang.String encTypeToString( )
encTypeToString
- public static java.lang.String encTypeToString( int enctype)
Converts the specified integer encryption type
to string.
isDesEncType
- public boolean isDesEncType()
isDes3EncType
- public static boolean isDes3EncType( int enctype)
isDesEncType
- public static boolean isDesEncType( int enctype)
isRc4HMacEncType
- public boolean isRc4HMacEncType( )
isRc4HMacEncType
- public static boolean isRc4HMacEncType( int encryptionType)
isAES128EncType
- public boolean isAES128EncType( )
isAES128EncType
- public static boolean isAES128EncType( int encryptionType)
isAES256EncType
- public boolean isAES256EncType( )
isAES256EncType
- public static boolean isAES256EncType( int encryptionType)