APIdia Launch Partner
Top Description Fields Constructors Methods
sun.security.krb5

public Class EncryptedData

extends Object
implements Cloneable
Class Inheritance
All Implemented Interfaces
java.lang.Cloneable
Imports
sun.security.util.*, sun.security.krb5.internal.crypto.*, sun.security.krb5.internal.*, java.io.IOException, java.math.BigInteger

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

Modifier and TypeField and Description
pack-priv byte[]
pack-priv int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
public static final int
pack-priv Integer
pack-priv byte[]

Constructor Summary

AccessConstructor and Description
private
public
EncryptedData(int new_eType, Integer new_kvno, byte[] new_cipher)

public
EncryptedData(EncryptionKey key, byte[] plaintext, int usage)

private
EncryptedData(DerValue
a single DER-encoded value.
encoding
)

Constructs an instance of EncryptedData type.

Method Summary

Modifier and TypeMethod and Description
public byte[]

Returns:

byte array of encoded EncryptedData object.
asn1Encode
()

Returns an ASN.1 encoded EncryptedData type.

public Object
clone()

Overrides java.lang.Object.clone.

Creates and returns a copy of this object.

public byte[]
decrypt(EncryptionKey key, int usage)

private byte[]
public byte[]
getBytes()

Returns the raw cipher text bytes, not in ASN.1 encoding.

public int
public Integer
public static EncryptedData

Returns:

an instance of EncryptedData.
parse
(DerInputStream
the Der input stream value, which contains one or more marshaled value.
data
,
byte
tag number.
explicitTag
,
boolean
indicate if this data field is optional
optional
)

Parse (unmarshal) an EncryptedData from a DER input stream.

public byte[]

Returns:

the reset byte array which holds exactly one asn1 datum including its tag and length.
reset
(byte[]
the decrypted data from decrypt().
data
)

Reset asn.1 data stream after decryption, remove redundant bytes.

Inherited from java.lang.Object:
equalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

cipherback to summary
pack-priv byte[] cipher
eTypeback to summary
pack-priv int eType
ETYPE_AES128_CTS_HMAC_SHA1_96back to summary
public static final int ETYPE_AES128_CTS_HMAC_SHA1_96
ETYPE_AES128_CTS_HMAC_SHA256_128back to summary
public static final int ETYPE_AES128_CTS_HMAC_SHA256_128
ETYPE_AES256_CTS_HMAC_SHA1_96back to summary
public static final int ETYPE_AES256_CTS_HMAC_SHA1_96
ETYPE_AES256_CTS_HMAC_SHA384_192back to summary
public static final int ETYPE_AES256_CTS_HMAC_SHA384_192
ETYPE_ARCFOUR_HMACback to summary
public static final int ETYPE_ARCFOUR_HMAC
ETYPE_ARCFOUR_HMAC_EXPback to summary
public static final int ETYPE_ARCFOUR_HMAC_EXP
ETYPE_DES3_CBC_HMAC_SHA1_KDback to summary
public static final int ETYPE_DES3_CBC_HMAC_SHA1_KD
ETYPE_DES_CBC_CRCback to summary
public static final int ETYPE_DES_CBC_CRC
ETYPE_DES_CBC_MD4back to summary
public static final int ETYPE_DES_CBC_MD4
ETYPE_DES_CBC_MD5back to summary
public static final int ETYPE_DES_CBC_MD5
ETYPE_NULLback to summary
public static final int ETYPE_NULL
kvnoback to summary
pack-priv Integer kvno
plainback to summary
pack-priv byte[] plain

Constructor Detail

EncryptedDataback to summary
private EncryptedData()
EncryptedDataback to summary
public EncryptedData(int new_eType, Integer new_kvno, byte[] new_cipher)
EncryptedDataback to summary
public EncryptedData(EncryptionKey key, byte[] plaintext, int usage) throws KdcErrException, KrbCryptoException
EncryptedDataback to summary
private EncryptedData(DerValue encoding) throws Asn1Exception, IOException

Constructs an instance of EncryptedData type.

Parameters
encoding:DerValue

a single DER-encoded value.

Exceptions
Asn1Exception:
if an error occurs while decoding an ASN1 encoded data.
IOException:
if an I/O error occurs while reading encoded data.

Method Detail

asn1Encodeback to summary
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[]

byte array of encoded EncryptedData object.

Exceptions
Asn1Exception:
if an error occurs while decoding an ASN1 encoded data.
IOException:
if an I/O error occurs while reading encoded data.
cloneback to summary
public Object clone()

Overrides java.lang.Object.clone.

Doc from java.lang.Object.clone.

Creates and returns a copy of this object. The precise meaning of "copy" may depend on the class of the object. The general intent is that, for any object x, the expression:

x.clone() != x
will be true, and that the expression:
x.clone().getClass() == x.getClass()
will be true, but these are not absolute requirements. While it is typically the case that:
x.clone().equals(x)
will be true, this is not an absolute requirement.

By convention, the returned object should be obtained by calling super.clone. If a class and all of its superclasses (except Object) obey this convention, it will be the case that x.clone().getClass() == x.getClass().

By convention, the object returned by this method should be independent of this object (which is being cloned). To achieve this independence, it may be necessary to modify one or more fields of the object returned by super.clone before returning it. Typically, this means copying any mutable objects that comprise the internal "deep structure" of the object being cloned and replacing the references to these objects with references to the copies. If a class contains only primitive fields or references to immutable objects, then it is usually the case that no fields in the object returned by super.clone need to be modified.

decryptback to summary
public byte[] decrypt(EncryptionKey key, int usage) throws KdcErrException, KrbApErrException, KrbCryptoException
decryptedDataback to summary
private byte[] decryptedData() throws KdcErrException
getBytesback to summary
public byte[] getBytes()

Returns the raw cipher text bytes, not in ASN.1 encoding.

getETypeback to summary
public int getEType()
getKeyVersionNumberback to summary
public Integer getKeyVersionNumber()
parseback to summary
public static EncryptedData parse(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:DerInputStream

the Der input stream value, which contains one or more marshaled value.

explicitTag:byte

tag number.

optional:boolean

indicate if this data field is optional

Returns:EncryptedData

an instance of EncryptedData.

Exceptions
Asn1Exception:
if an error occurs while decoding an ASN1 encoded data.
IOException:
if an I/O error occurs while reading encoded data.
resetback to summary
public byte[] reset(byte[] data)

Reset asn.1 data stream after decryption, remove redundant bytes.

Parameters
data:byte[]

the decrypted data from decrypt().

Returns:byte[]

the reset byte array which holds exactly one asn1 datum including its tag and length.