public class

AesDkCrypto

extends DkCrypto
java.lang.Object
   ↳ sun.security.mule.krb5.internal.crypto.dk.DkCrypto
     ↳ sun.security.mule.krb5.internal.crypto.dk.AesDkCrypto

Class Overview

This class provides the implementation of AES Encryption for Kerberos as defined RFC 3962. http://www.ietf.org/rfc/rfc3962.txt Algorithm profile described in [KCRYPTO]: +--------------------------------------------------------------------+ | protocol key format 128- or 256-bit string | | | | string-to-key function PBKDF2+DK with variable | | iteration count (see | | above) | | | | default string-to-key parameters 00 00 10 00 | | | | key-generation seed length key size | | | | random-to-key function identity function | | | | hash function, H SHA-1 | | | | HMAC output size, h 12 octets (96 bits) | | | | message block size, m 1 octet | | | | encryption/decryption functions, AES in CBC-CTS mode | | E and D (cipher block size 16 | | octets), with next to | | last block as CBC-style | | ivec | +--------------------------------------------------------------------+ Supports AES128 and AES256

Summary

Constants
int BLOCK_SIZE
int DEFAULT_ITERATION_COUNT
boolean debug
int hashSize
[Expand]
Inherited Constants
From class sun.security.mule.krb5.internal.crypto.dk.DkCrypto
Fields
private static final byte[] ZERO_IV
private final int keyLength
[Expand]
Inherited Fields
From class sun.security.mule.krb5.internal.crypto.dk.DkCrypto
Public Constructors
AesDkCrypto(int length)
Public Methods
byte[] calculateChecksum(byte[] baseKey, int usage, byte[] input, int start, int len)
Calculate the checksum
byte[] decrypt(byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len)
byte[] decryptRaw(byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len)
Decrypts data using specified key and initial vector.
byte[] encrypt(byte[] baseKey, int usage, byte[] ivec, byte[] new_ivec, byte[] plaintext, int start, int len)
Performs encryption using derived key; adds confounder.
byte[] encryptRaw(byte[] baseKey, int usage, byte[] ivec, byte[] plaintext, int start, int len)
Performs encryption using derived key; does not add confounder.
int getChecksumLength()
final static int readBigEndian(byte[] data, int pos, int size)
byte[] stringToKey(char[] password, String salt, byte[] s2kparams)
Protected Methods
Cipher getCipher(byte[] key, byte[] ivec, int mode)
byte[] getHmac(byte[] key, byte[] msg)
Get the truncated HMAC
int getKeySeedLength()
byte[] randomToKey(byte[] in)
[Expand]
Inherited Methods
From class sun.security.mule.krb5.internal.crypto.dk.DkCrypto
From class java.lang.Object

Constants

private static final int BLOCK_SIZE

Constant Value: 16 (0x00000010)

private static final int DEFAULT_ITERATION_COUNT

Constant Value: 4096 (0x00001000)

private static final boolean debug

Constant Value: false

private static final int hashSize

Constant Value: 12 (0x0000000c)

Fields

private static final byte[] ZERO_IV

private final int keyLength

Public Constructors

public AesDkCrypto (int length)

Parameters
length

Public Methods

public byte[] calculateChecksum (byte[] baseKey, int usage, byte[] input, int start, int len)

Calculate the checksum

Parameters
baseKey
usage
input
start
len
Throws
GeneralSecurityException

public byte[] decrypt (byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len)

Parameters
baseKey Key from which keys are to be derived using usage
usage
ivec
ciphertext E(Ke, conf | plaintext | padding, ivec) | H1[1..h]
start
len
Throws
GeneralSecurityException

public byte[] decryptRaw (byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len)

Decrypts data using specified key and initial vector.

Parameters
baseKey Encryption key to use
usage Ignored
ivec
ciphertext Encrypted data to be decrypted
start
len
Throws
GeneralSecurityException

public byte[] encrypt (byte[] baseKey, int usage, byte[] ivec, byte[] new_ivec, byte[] plaintext, int start, int len)

Performs encryption using derived key; adds confounder.

Parameters
baseKey
usage
ivec Initial vector to use when initializing the cipher; if null, then blocksize number of zeros are used,
new_ivec If non-null, it is updated upon return to be the new ivec to use when calling encrypt next time
plaintext
start
len
Throws
GeneralSecurityException
KrbCryptoException

public byte[] encryptRaw (byte[] baseKey, int usage, byte[] ivec, byte[] plaintext, int start, int len)

Performs encryption using derived key; does not add confounder.

Parameters
baseKey
usage
ivec
plaintext
start
len
Throws
GeneralSecurityException
KrbCryptoException

public int getChecksumLength ()

public static final int readBigEndian (byte[] data, int pos, int size)

Parameters
data
pos
size

public byte[] stringToKey (char[] password, String salt, byte[] s2kparams)

Parameters
password
salt
s2kparams
Throws
GeneralSecurityException

Protected Methods

protected Cipher getCipher (byte[] key, byte[] ivec, int mode)

Parameters
key
ivec
mode
Throws
GeneralSecurityException

protected byte[] getHmac (byte[] key, byte[] msg)

Get the truncated HMAC

Parameters
key
msg
Throws
GeneralSecurityException

protected int getKeySeedLength ()

protected byte[] randomToKey (byte[] in)

Parameters
in