com.ibm.security.krb5
Class Checksum
- java.lang.Object
com.ibm.security.krb5.Checksum
- public class Checksum
- extends java.lang.Object
Field Summary
Modifier and Type | Field and Description |
---|---|
|
CKSUMTYPE_CRC32
|
|
CKSUMTYPE_DEFAULT
The default checksum type.
|
|
CKSUMTYPE_DES_MAC
|
|
CKSUMTYPE_DES_MAC_K
|
|
CKSUMTYPE_HMAC_MD5
Checksum type used in the RC4-HMAC encryption system.
|
|
CKSUMTYPE_HMAC_SHA1_96_AES128
|
|
CKSUMTYPE_HMAC_SHA1_96_AES256
|
|
CKSUMTYPE_HMAC_SHA1_DES3
|
|
CKSUMTYPE_NULL
|
|
CKSUMTYPE_RSA_MD4
|
|
CKSUMTYPE_RSA_MD4_DES
|
|
CKSUMTYPE_RSA_MD4_DES_K
|
|
CKSUMTYPE_RSA_MD5
|
|
CKSUMTYPE_RSA_MD5_DES
|
|
SAFECKSUMTYPE_DEFAULT
The default safe checksum type.
|
Constructor Summary
Constructor and Description |
---|
Checksum(byte[] data,int new_cksumType)
Constructs a new Checksum using the raw data and type.
|
Checksum(com.ibm.security.util.DerValue encoding)
Constructs an instance of Checksum from an ASN.1 encoded representation.
|
Checksum(int new_cksumType,byte[] data)
Constructs a new Checksum by calculating the checksum over the data using
specified checksum type.
|
Checksum(int new_cksumType,byte[] data,EncryptionKey key)
Constructs a new Checksum by calculating the keyed checksum
over the data using specified checksum type.
|
Checksum(int cksumType,byte[] data,EncryptionKey key,int usage)
Creates a new HMAC MD5 or SHA1 checksum
calculated over the specified data using the specified key
and message type.
|
Method Summary
Modifier and Type | Method and Description |
---|---|
|
asn1Encode()
Encodes a Checksum object.
|
|
checksumTypeToString(int type)
Returns a string representation of the specified checksum type.
|
|
getBytes()
Returns the raw bytes of the checksum, not in ASN.1 encoded form.
|
|
getSupportedTypes()
|
|
getType()
|
|
isCollisionProofType()
|
|
isCollisionProofType(int type)
|
|
isEqual(Checksum cksum)
|
|
isSafeType()
|
|
isSafeType(int type)
|
|
isSupportedType(int type)
|
|
isValidType(int type)
|
|
parse(com.ibm.security.util.DerInputStream data,byte explicitTag,boolean optional)
Parse (unmarshal) a checksum object from a DER input stream.
|
|
stringToChecksumType(java.lang.String checksumTypeString)
Converts the specified checksum type string to its
integer representation.
|
|
verifyKeyedChecksum(byte[] data,EncryptionKey key)
Verifies the keyed checksum over the data passed in.
|
|
verifyKeyedChecksum(byte[] data,EncryptionKey key,int usage)
Verifies the RC4 HMAC and DES3 keyed checksum over the data passed in.
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail
CKSUMTYPE_NULL
- public static final int CKSUMTYPE_NULL
See Also:
CKSUMTYPE_CRC32
- public static final int CKSUMTYPE_CRC32
See Also:
CKSUMTYPE_RSA_MD4
- public static final int CKSUMTYPE_RSA_MD4
See Also:
CKSUMTYPE_RSA_MD4_DES
- public static final int CKSUMTYPE_RSA_MD4_DES
See Also:
CKSUMTYPE_DES_MAC
- public static final int CKSUMTYPE_DES_MAC
See Also:
CKSUMTYPE_DES_MAC_K
- public static final int CKSUMTYPE_DES_MAC_K
See Also:
CKSUMTYPE_RSA_MD4_DES_K
- public static final int CKSUMTYPE_RSA_MD4_DES_K
See Also:
CKSUMTYPE_RSA_MD5
- public static final int CKSUMTYPE_RSA_MD5
See Also:
CKSUMTYPE_RSA_MD5_DES
- public static final int CKSUMTYPE_RSA_MD5_DES
See Also:
CKSUMTYPE_HMAC_SHA1_DES3
- public static final int CKSUMTYPE_HMAC_SHA1_DES3
See Also:
CKSUMTYPE_HMAC_SHA1_96_AES128
- public static final int CKSUMTYPE_HMAC_SHA1_96_AES128
See Also:
CKSUMTYPE_HMAC_SHA1_96_AES256
- public static final int CKSUMTYPE_HMAC_SHA1_96_AES256
See Also:
CKSUMTYPE_HMAC_MD5
- public static final int CKSUMTYPE_HMAC_MD5
Checksum type used in the RC4-HMAC encryption system.
See Also:
CKSUMTYPE_DEFAULT
- public static int CKSUMTYPE_DEFAULT
The default checksum type. It is read from the
default_checksum
entry in the Kerberos configuration
file. If the entry cannot be read or an error occurs when reading it,
the default checksum type is set to CHECKSUMTYPE_RSA_MD5
.
SAFECKSUMTYPE_DEFAULT
- public static int SAFECKSUMTYPE_DEFAULT
The default safe checksum type. It is read from the
default_safe_checksum
entry in the Kerberos configuration
file. If the entry cannot be read or an error occurs when reading it,
the default checksum type is set to
CHECKSUMTYPE_RSA_MD5_DES
.
Constructor Detail
Checksum
- public Checksum(byte[] data,
- int new_cksumType)
Constructs a new Checksum using the raw data and type.
Checksum
- public Checksum(int new_cksumType,
- byte[] data)
- throws KdcErrException
- KrbCryptoException
Constructs a new Checksum by calculating the checksum over the data using
specified checksum type.
Checksum
- public Checksum(int new_cksumType,
- byte[] data,
- EncryptionKey key)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
Constructs a new Checksum by calculating the keyed checksum
over the data using specified checksum type.
Checksum
- public Checksum(int cksumType,
- byte[] data,
- EncryptionKey key,
- int usage)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
Creates a new HMAC MD5 or SHA1 checksum
calculated over the specified data using the specified key
and message type.
Parameters:
key
- the encryption key. usage
- the key derivation message type/usage constant. data
- the data over which the checksum is to be calculated. Throws:
Checksum
- public Checksum(com.ibm.security.util.DerValue encoding)
- throws Asn1Exception
- java.io.IOException
Constructs an instance of Checksum from an ASN.1 encoded representation.
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
verifyKeyedChecksum
- public boolean verifyKeyedChecksum( byte[] data,
- EncryptionKey key)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
Verifies the keyed checksum over the data passed in.
verifyKeyedChecksum
- public boolean verifyKeyedChecksum( byte[] data,
- EncryptionKey key,
- int usage)
- throws KdcErrException
- KrbApErrException
- KrbCryptoException
Verifies the RC4 HMAC and DES3 keyed checksum over the data passed in.
isEqual
- public boolean isEqual(Checksum cksum)
- throws KdcErrException
Throws:
asn1Encode
- public byte[] asn1Encode()
- throws Asn1Exception
- java.io.IOException
Encodes a Checksum object.
Checksum ::= SEQUENCE {
cksumtype[0] INTEGER,
checksum[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.
Returns:
byte array of enocded Checksum.
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 Checksum parse(com.ibm.security.util.DerInputStream data,
- byte explicitTag,
- boolean optional)
- throws Asn1Exception
- java.io.IOException
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. java.io.IOException
- if an I/O error occurs while reading encoded data. getBytes
- public final byte[] getBytes()
Returns the raw bytes of the checksum, not in ASN.1 encoded form.
getType
- public final int getType()
isSupportedType
- public static boolean isSupportedType( int type)
isValidType
- public static boolean isValidType( int type)
isCollisionProofType
- public boolean isCollisionProofType( )
isCollisionProofType
- public static boolean isCollisionProofType( int type)
getSupportedTypes
- public static int[] getSupportedTypes( )
isSafeType
- public boolean isSafeType()
isSafeType
- public static boolean isSafeType( int type)
stringToChecksumType
- public static int stringToChecksumType( java.lang.String checksumTypeString)
- throws java.lang.Exception
Converts the specified checksum type string to its
integer representation.
Throws exception if the input is null or is not a
valid checksum type.
Throws:
java.lang.Exception
checksumTypeToString
- public static java.lang.String checksumTypeToString( int type)
Returns a string representation of the specified checksum type.
For recognized types, the string returned is one of those used
in kerberos configuration and is not internationalized.
For an unrecognixed type, an internationalized error message
is returned.