public abstract class

DkCrypto

extends Object
java.lang.Object
   ↳ sun.security.mule.krb5.internal.crypto.dk.DkCrypto
Known Direct Subclasses

Class Overview

Implements Derive Key cryptography functionality as defined in RFC 3961. http://www.ietf.org/rfc/rfc3961.txt This is an abstract class. Concrete subclasses need to implement the abstract methods.

Summary

Constants
boolean debug
Fields
static final byte[] KERBEROS_CONSTANT
Public Constructors
DkCrypto()
Public Methods
byte[] calculateChecksum(byte[] baseKey, int usage, byte[] input, int start, int len)
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)
From RFC 3961.
byte[] encryptRaw(byte[] baseKey, int usage, byte[] ivec, byte[] plaintext, int start, int len)
Performs encryption using given key only; does not add confounder, padding, or checksum.
abstract int getChecksumLength()
Protected Methods
abstract Cipher getCipher(byte[] key, byte[] ivec, int mode)
abstract byte[] getHmac(byte[] key, byte[] plaintext)
abstract int getKeySeedLength()
abstract byte[] randomToKey(byte[] in)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

protected static final boolean debug

Constant Value: false

Fields

static final byte[] KERBEROS_CONSTANT

Public Constructors

public DkCrypto ()

Public Methods

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

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)

From RFC 3961. encryption function conf = random string of length c pad = shortest string to bring confounder and plaintext to a length that's a multiple of m (C1, newIV) = E(Ke, conf | plaintext | pad, oldstate.ivec) H1 = HMAC(Ki, conf | plaintext | pad) ciphertext = C1 | H1[1..h] newstate.ivec = newIV

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 given key only; does not add confounder, padding, or checksum. Incoming data to be encrypted assumed to have the correct blocksize. Ignore key usage.

Parameters
baseKey
usage
ivec
plaintext
start
len
Throws
GeneralSecurityException
KrbCryptoException

public abstract int getChecksumLength ()

Protected Methods

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

Parameters
key
ivec
mode
Throws
GeneralSecurityException

protected abstract byte[] getHmac (byte[] key, byte[] plaintext)

Parameters
key
plaintext
Throws
GeneralSecurityException

protected abstract int getKeySeedLength ()

protected abstract byte[] randomToKey (byte[] in)

Parameters
in