sun.security.mule.krb5
Class EncryptedData

java.lang.Object
  extended by sun.security.mule.krb5.EncryptedData
All Implemented Interfaces:
Cloneable

public class EncryptedData
extends Object
implements Cloneable

This class encapsulates Kerberos encrypted data. It allows callers access to both the ASN.1 encoded form of the EncryptedData type as well as the raw cipher text.


Field Summary
static int ETYPE_AES128_CTS_HMAC_SHA1_96
           
static int ETYPE_AES256_CTS_HMAC_SHA1_96
           
static int ETYPE_ARCFOUR_HMAC
           
static int ETYPE_ARCFOUR_HMAC_EXP
           
static int ETYPE_DES_CBC_CRC
           
static int ETYPE_DES_CBC_MD4
           
static int ETYPE_DES_CBC_MD5
           
static int ETYPE_DES3_CBC_HMAC_SHA1_KD
           
static int ETYPE_NULL
           
 
Constructor Summary
EncryptedData(EncryptionKey key, byte[] plaintext, int usage)
           
EncryptedData(int new_eType, Integer new_kvno, byte[] new_cipher)
           
 
Method Summary
 byte[] asn1Encode()
          Returns an ASN.1 encoded EncryptedData type.
 Object clone()
           
 byte[] decrypt(EncryptionKey key, int usage)
           
 byte[] getBytes()
          Returns the raw cipher text bytes, not in ASN.1 encoding.
 int getEType()
           
 Integer getKeyVersionNumber()
           
static EncryptedData parse(sun.security.util.DerInputStream data, byte explicitTag, boolean optional)
          Parse (unmarshal) an EncryptedData from a DER input stream.
 byte[] reset(byte[] data, boolean encoded)
          Reset data stream after decryption, remove redundant bytes.
 
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:
Constant Field Values

ETYPE_DES_CBC_CRC

public static final int ETYPE_DES_CBC_CRC
See Also:
Constant Field Values

ETYPE_DES_CBC_MD4

public static final int ETYPE_DES_CBC_MD4
See Also:
Constant Field Values

ETYPE_DES_CBC_MD5

public static final int ETYPE_DES_CBC_MD5
See Also:
Constant Field Values

ETYPE_ARCFOUR_HMAC

public static final int ETYPE_ARCFOUR_HMAC
See Also:
Constant Field Values

ETYPE_ARCFOUR_HMAC_EXP

public static final int ETYPE_ARCFOUR_HMAC_EXP
See Also:
Constant Field Values

ETYPE_DES3_CBC_HMAC_SHA1_KD

public static final int ETYPE_DES3_CBC_HMAC_SHA1_KD
See Also:
Constant Field Values

ETYPE_AES128_CTS_HMAC_SHA1_96

public static final int ETYPE_AES128_CTS_HMAC_SHA1_96
See Also:
Constant Field Values

ETYPE_AES256_CTS_HMAC_SHA1_96

public static final int ETYPE_AES256_CTS_HMAC_SHA1_96
See Also:
Constant Field Values
Constructor Detail

EncryptedData

public EncryptedData(int new_eType,
                     Integer new_kvno,
                     byte[] new_cipher)

EncryptedData

public EncryptedData(EncryptionKey key,
                     byte[] plaintext,
                     int usage)
              throws KdcErrException,
                     KrbCryptoException
Throws:
KdcErrException
KrbCryptoException
Method Detail

clone

public Object clone()
Overrides:
clone in class Object

decrypt

public byte[] decrypt(EncryptionKey key,
                      int usage)
               throws KdcErrException,
                      KrbApErrException,
                      KrbCryptoException
Throws:
KdcErrException
KrbApErrException
KrbCryptoException

asn1Encode

public byte[] asn1Encode()
                  throws Asn1Exception,
                         IOException
Returns an ASN.1 encoded EncryptedData type. EncryptedData ::= SEQUENCE { etype [0] Int32 -- EncryptionType --, kvno [1] UInt32 OPTIONAL, cipher [2] OCTET STRING -- ciphertext }

This definition reflects the Network Working Group RFC 4120 specification available at http://www.ietf.org/rfc/rfc4120.txt.

Returns:
byte array of encoded EncryptedData object.
Throws:
Asn1Exception - if an error occurs while decoding an ASN1 encoded data.
IOException - if an I/O error occurs while reading encoded data.

parse

public static EncryptedData parse(sun.security.util.DerInputStream data,
                                  byte explicitTag,
                                  boolean optional)
                           throws Asn1Exception,
                                  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.
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 Integer getKeyVersionNumber()

getBytes

public byte[] getBytes()
Returns the raw cipher text bytes, not in ASN.1 encoding.



Copyright © 2013. All Rights Reserved.