public class

Checksum

extends Object
java.lang.Object
   ↳ sun.security.mule.krb5.Checksum

Class Overview

This class encapsulates the concept of a Kerberos checksum.

Summary

Constants
int CKSUMTYPE_CRC32
int CKSUMTYPE_DES_MAC
int CKSUMTYPE_DES_MAC_K
int CKSUMTYPE_HMAC_MD5_ARCFOUR
int CKSUMTYPE_HMAC_SHA1_96_AES128
int CKSUMTYPE_HMAC_SHA1_96_AES256
int CKSUMTYPE_HMAC_SHA1_DES3_KD
int CKSUMTYPE_NULL
int CKSUMTYPE_RSA_MD4
int CKSUMTYPE_RSA_MD4_DES
int CKSUMTYPE_RSA_MD4_DES_K
int CKSUMTYPE_RSA_MD5
int CKSUMTYPE_RSA_MD5_DES
int CKSUMTYPE_USE_DEFAULT
Fields
private int CKSUMTYPE_DEFAULT
private static boolean DEBUG
private int SAFECKSUMTYPE_DEFAULT
private byte[] checksum
private int cksumType
private boolean inited
private Config kerberosConfig
Public Constructors
Checksum(byte[] data, int new_cksumType, Config kerberosConfig)
Constructs a new Checksum using the raw data and type.
Checksum(int new_cksumType, byte[] data, Config kerberosConfig)
Constructs a new Checksum by calculating the checksum over the data using specified checksum type.
Checksum(int new_cksumType, byte[] data, EncryptionKey key, int usage, Config kerberosConfig)
Constructs a new Checksum by calculating the keyed checksum over the data using specified checksum type.
Public Methods
byte[] asn1Encode()
Encodes a Checksum object.
boolean equals(Object obj)
final byte[] getBytes()
Returns the raw bytes of the checksum, not in ASN.1 encoded form.
static int getChecksumdefault(Config kerberosConfig)
final int getType()
int hashCode()
static Checksum parse(DerInputStream data, byte explicitTag, boolean optional)
Parse (unmarshal) a checksum object from a DER input stream.
boolean verifyKeyedChecksum(byte[] data, EncryptionKey key, int usage)
Verifies the keyed checksum over the data passed in.
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int CKSUMTYPE_CRC32

Constant Value: 1 (0x00000001)

public static final int CKSUMTYPE_DES_MAC

Constant Value: 4 (0x00000004)

public static final int CKSUMTYPE_DES_MAC_K

Constant Value: 5 (0x00000005)

public static final int CKSUMTYPE_HMAC_MD5_ARCFOUR

Constant Value: -138 (0xffffff76)

public static final int CKSUMTYPE_HMAC_SHA1_96_AES128

Constant Value: 15 (0x0000000f)

public static final int CKSUMTYPE_HMAC_SHA1_96_AES256

Constant Value: 16 (0x00000010)

public static final int CKSUMTYPE_HMAC_SHA1_DES3_KD

Constant Value: 12 (0x0000000c)

public static final int CKSUMTYPE_NULL

Constant Value: 0 (0x00000000)

public static final int CKSUMTYPE_RSA_MD4

Constant Value: 2 (0x00000002)

public static final int CKSUMTYPE_RSA_MD4_DES

Constant Value: 3 (0x00000003)

public static final int CKSUMTYPE_RSA_MD4_DES_K

Constant Value: 6 (0x00000006)

public static final int CKSUMTYPE_RSA_MD5

Constant Value: 7 (0x00000007)

public static final int CKSUMTYPE_RSA_MD5_DES

Constant Value: 8 (0x00000008)

public static final int CKSUMTYPE_USE_DEFAULT

Constant Value: -999 (0xfffffc19)

Fields

private int CKSUMTYPE_DEFAULT

private static boolean DEBUG

private int SAFECKSUMTYPE_DEFAULT

private byte[] checksum

private int cksumType

private boolean inited

private Config kerberosConfig

Public Constructors

public Checksum (byte[] data, int new_cksumType, Config kerberosConfig)

Constructs a new Checksum using the raw data and type.

Parameters
data
new_cksumType
kerberosConfig

public Checksum (int new_cksumType, byte[] data, Config kerberosConfig)

Constructs a new Checksum by calculating the checksum over the data using specified checksum type.

Parameters
new_cksumType
data
kerberosConfig

public Checksum (int new_cksumType, byte[] data, EncryptionKey key, int usage, Config kerberosConfig)

Constructs a new Checksum by calculating the keyed checksum over the data using specified checksum type.

Parameters
new_cksumType
data
key
usage
kerberosConfig

Public Methods

public byte[] asn1Encode ()

Encodes a Checksum object.

Checksum ::= SEQUENCE { cksumtype [0] Int32, checksum [1] OCTET STRING }

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

Returns
  • byte array of enocded Checksum.
Throws
Asn1Exception if an error occurs while decoding an ASN1 encoded data.
IOException if an I/O error occurs while reading encoded data.

public boolean equals (Object obj)

Parameters
obj

public final byte[] getBytes ()

Returns the raw bytes of the checksum, not in ASN.1 encoded form.

public static int getChecksumdefault (Config kerberosConfig)

Parameters
kerberosConfig

public final int getType ()

public int hashCode ()

public static Checksum parse (DerInputStream data, byte explicitTag, boolean optional)

Parse (unmarshal) a checksum object 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 Indicates if this data field is optional
Returns
  • an instance of Checksum.
Throws
Asn1Exception if an error occurs while decoding an ASN1 encoded data.
IOException if an I/O error occurs while reading encoded data.

public boolean verifyKeyedChecksum (byte[] data, EncryptionKey key, int usage)

Verifies the keyed checksum over the data passed in.

Parameters
data
key
usage