abstract class TlsPrfGenerator extends KeyGeneratorSpi
This class duplicates the HMAC functionality (RFC 2104) with performance optimizations (e.g. XOR'ing keys with padding doesn't need to be redone for each HMAC operation).
| 限定符和类型 | 类和说明 |
|---|---|
static class |
TlsPrfGenerator.V10
A KeyGenerator implementation that supports TLS 1.0/1.1.
|
static class |
TlsPrfGenerator.V12
A KeyGenerator implementation that supports TLS 1.2.
|
| 限定符和类型 | 字段和说明 |
|---|---|
private static byte[] |
B0 |
private static byte[] |
HMAC_ipad128 |
private static byte[] |
HMAC_ipad64 |
private static byte[] |
HMAC_opad128 |
private static byte[] |
HMAC_opad64 |
(专用程序包) static byte[] |
LABEL_CLIENT_WRITE_KEY |
(专用程序包) static byte[] |
LABEL_EXTENDED_MASTER_SECRET |
(专用程序包) static byte[] |
LABEL_IV_BLOCK |
(专用程序包) static byte[] |
LABEL_KEY_EXPANSION |
(专用程序包) static byte[] |
LABEL_MASTER_SECRET |
(专用程序包) static byte[] |
LABEL_SERVER_WRITE_KEY |
private static String |
MSG |
private TlsPrfParameterSpec |
spec |
(专用程序包) static byte[][] |
SSL3_CONST |
| 构造器和说明 |
|---|
TlsPrfGenerator() |
| 限定符和类型 | 方法和说明 |
|---|---|
(专用程序包) static byte[] |
concat(byte[] b1,
byte[] b2) |
(专用程序包) static byte[] |
doTLS10PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength) |
(专用程序包) static byte[] |
doTLS10PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
MessageDigest md5,
MessageDigest sha) |
(专用程序包) static byte[] |
doTLS12PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
MessageDigest mdPRF,
int mdPRFLen,
int mdPRFBlockSize) |
(专用程序包) static byte[] |
doTLS12PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
String prfHash,
int prfHashLength,
int prfBlockSize) |
(专用程序包) SecretKey |
engineGenerateKey0(boolean tls12) |
protected void |
engineInit(AlgorithmParameterSpec params,
SecureRandom random) |
protected void |
engineInit(int keysize,
SecureRandom random) |
protected void |
engineInit(SecureRandom random) |
private static void |
expand(MessageDigest digest,
int hmacSize,
byte[] secret,
int secOff,
int secLen,
byte[] label,
byte[] seed,
byte[] output,
byte[] pad1,
byte[] pad2) |
private static byte[][] |
genConst() |
(专用程序包) static byte[] |
genPad(byte b,
int count) |
engineGenerateKeyprivate static final byte[] B0
static final byte[] LABEL_MASTER_SECRET
static final byte[] LABEL_EXTENDED_MASTER_SECRET
static final byte[] LABEL_KEY_EXPANSION
static final byte[] LABEL_CLIENT_WRITE_KEY
static final byte[] LABEL_SERVER_WRITE_KEY
static final byte[] LABEL_IV_BLOCK
private static final byte[] HMAC_ipad64
private static final byte[] HMAC_ipad128
private static final byte[] HMAC_opad64
private static final byte[] HMAC_opad128
static final byte[][] SSL3_CONST
private TlsPrfParameterSpec spec
static byte[] genPad(byte b,
int count)
static byte[] concat(byte[] b1,
byte[] b2)
private static byte[][] genConst()
protected void engineInit(SecureRandom random)
engineInit 在类中 KeyGeneratorSpiprotected void engineInit(AlgorithmParameterSpec params, SecureRandom random) throws InvalidAlgorithmParameterException
engineInit 在类中 KeyGeneratorSpiInvalidAlgorithmParameterExceptionprotected void engineInit(int keysize,
SecureRandom random)
engineInit 在类中 KeyGeneratorSpiSecretKey engineGenerateKey0(boolean tls12)
static byte[] doTLS12PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
String prfHash,
int prfHashLength,
int prfBlockSize)
throws NoSuchAlgorithmException,
DigestException
static byte[] doTLS12PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
MessageDigest mdPRF,
int mdPRFLen,
int mdPRFBlockSize)
throws DigestException
DigestExceptionstatic byte[] doTLS10PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength)
throws NoSuchAlgorithmException,
DigestException
static byte[] doTLS10PRF(byte[] secret,
byte[] labelBytes,
byte[] seed,
int outputLength,
MessageDigest md5,
MessageDigest sha)
throws DigestException
DigestExceptionprivate static void expand(MessageDigest digest, int hmacSize, byte[] secret, int secOff, int secLen, byte[] label, byte[] seed, byte[] output, byte[] pad1, byte[] pad2) throws DigestException
DigestExceptionCopyright © 2023. All rights reserved.