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

public abstract Class DkCrypto

extends Object
Class Inheritance
Known Direct Subclasses
sun.security.krb5.internal.crypto.dk.AesDkCrypto, sun.security.krb5.internal.crypto.dk.AesSha2DkCrypto, sun.security.krb5.internal.crypto.dk.ArcFourCrypto, sun.security.krb5.internal.crypto.dk.Des3DkCrypto
Imports
javax.crypto.Cipher, java.security.GeneralSecurityException, .InvalidAlgorithmParameterException, java.util.Arrays, java.io.ByteArrayInputStream, .ByteArrayOutputStream, java.nio.CharBuffer, .ByteBuffer, sun.security.util.HexDumpEncoder, sun.security.krb5.Confounder, .KrbCryptoException, sun.security.krb5.internal.crypto.KeyUsage

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.

Field Summary

Modifier and TypeField and Description
public static boolean
protected static final boolean
pack-priv static final byte[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static byte[]
pack-priv static String
bytesToString(byte[] digest)

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

pack-priv static byte[]
charToUtf16(char[] chars)

pack-priv static byte[]
charToUtf8(char[] chars)

public byte[]
decrypt(byte[]
key from which keys are to be derived using usage
baseKey
,
int usage, byte[] ivec, byte[]
E(Ke, conf | plaintext | padding, ivec) | H1[1..h]
ciphertext
,
int start, int len)

public byte[]
decryptRaw(byte[]
encryption key to use
baseKey
,
int
ignored
usage
,
byte[] ivec, byte[]
encrypted data to be decrypted
ciphertext
,
int start, int len)

Decrypts data using specified key and initial vector.

pack-priv byte[]
dk(byte[] key, byte[] constant)

protected byte[]
dr(byte[] key, byte[] constant)

public byte[]
encrypt(byte[] baseKey, int usage, byte[]
initial vector to use when initializing the cipher; if null, then blocksize number of zeros are used,
ivec
,
byte[]
if non-null, it is updated upon return to be the new ivec to use when calling encrypt next time
new_ivec
,
byte[] plaintext, int start, int len)

From RFC 3961.

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.

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

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

protected abstract int
pack-priv static int
iterationCount(byte[] params, int defaultValue)

pack-priv static byte[]
nfold(byte[] in, int outbits)

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

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

pack-priv int
roundup(int n, int blocksize)

pack-priv static void
traceOutput(String traceTag, byte[] output, int offset, int len)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALLOW_WEAK_PBKDF2_ITERATION_COUNTback to summary
public static boolean ALLOW_WEAK_PBKDF2_ITERATION_COUNT
debugback to summary
protected static final boolean debug
KERBEROS_CONSTANTback to summary
pack-priv static final byte[] KERBEROS_CONSTANT

Constructor Detail

DkCryptoback to summary
public DkCrypto()

Method Detail

binaryStringToBytesback to summary
private static byte[] binaryStringToBytes(String str)
bytesToStringback to summary
pack-priv static String bytesToString(byte[] digest)
calculateChecksumback to summary
public byte[] calculateChecksum(byte[] baseKey, int usage, byte[] input, int start, int len) throws GeneralSecurityException
charToUtf16back to summary
pack-priv static byte[] charToUtf16(char[] chars)
charToUtf8back to summary
pack-priv static byte[] charToUtf8(char[] chars)
decryptback to summary
public byte[] decrypt(byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len) throws GeneralSecurityException
Parameters
baseKey:byte[]

key from which keys are to be derived using usage

ciphertext:byte[]

E(Ke, conf | plaintext | padding, ivec) | H1[1..h]

decryptRawback to summary
public byte[] decryptRaw(byte[] baseKey, int usage, byte[] ivec, byte[] ciphertext, int start, int len) throws GeneralSecurityException

Decrypts data using specified key and initial vector.

Parameters
baseKey:byte[]

encryption key to use

usage:int

ignored

ciphertext:byte[]

encrypted data to be decrypted

dkback to summary
pack-priv byte[] dk(byte[] key, byte[] constant) throws GeneralSecurityException
drback to summary
protected byte[] dr(byte[] key, byte[] constant) throws GeneralSecurityException
encryptback to summary
public byte[] encrypt(byte[] baseKey, int usage, byte[] ivec, byte[] new_ivec, byte[] plaintext, int start, int len) throws GeneralSecurityException, KrbCryptoException

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
ivec:byte[]

initial vector to use when initializing the cipher; if null, then blocksize number of zeros are used,

new_ivec:byte[]

if non-null, it is updated upon return to be the new ivec to use when calling encrypt next time

encryptRawback to summary
public byte[] encryptRaw(byte[] baseKey, int usage, byte[] ivec, byte[] plaintext, int start, int len) throws GeneralSecurityException, KrbCryptoException

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.

getChecksumLengthback to summary
public abstract int getChecksumLength()
getCipherback to summary
protected abstract Cipher getCipher(byte[] key, byte[] ivec, int mode) throws GeneralSecurityException
getHmacback to summary
protected abstract byte[] getHmac(byte[] key, byte[] plaintext) throws GeneralSecurityException
getKeySeedLengthback to summary
protected abstract int getKeySeedLength()
iterationCountback to summary
pack-priv static int iterationCount(byte[] params, int defaultValue) throws InvalidAlgorithmParameterException
nfoldback to summary
pack-priv static byte[] nfold(byte[] in, int outbits)
randomToKeyback to summary
protected abstract byte[] randomToKey(byte[] in)
readBigEndianback to summary
public static final int readBigEndian(byte[] data, int pos, int size)
roundupback to summary
pack-priv int roundup(int n, int blocksize)
traceOutputback to summary
pack-priv static void traceOutput(String traceTag, byte[] output, int offset, int len)