final class HKDF extends Object
| 构造器和说明 |
|---|
HKDF(String hashAlg)
Create an HDKF object, specifying the underlying message digest
algorithm.
|
| 限定符和类型 | 方法和说明 |
|---|---|
(专用程序包) SecretKey |
expand(SecretKey pseudoRandKey,
byte[] info,
int outLen,
String keyAlg)
Perform the HKDF-Expand derivation for a single-key output.
|
(专用程序包) SecretKey |
extract(byte[] salt,
SecretKey inputKey,
String keyAlg)
Perform the HMAC-Extract derivation.
|
(专用程序包) SecretKey |
extract(SecretKey salt,
SecretKey inputKey,
String keyAlg)
Perform the HMAC-Extract derivation.
|
private final String hmacAlg
private final Mac hmacObj
private final int hmacLen
HKDF(String hashAlg) throws NoSuchAlgorithmException
hashAlg - a standard name corresponding to a supported message
digest algorithm.NoSuchAlgorithmException - if that message digest algorithm does
not have an HMAC variant supported on any available provider.SecretKey extract(SecretKey salt, SecretKey inputKey, String keyAlg) throws InvalidKeyException
salt - a salt value, implemented as a SecretKey. A
null value is allowed, which will internally use an array of
zero bytes the same size as the underlying hash output length.inputKey - the input keying material provided as a
SecretKey.keyAlg - the algorithm name assigned to the resulting
SecretKey object.SecretKey that is the result of the HKDF extract
operation.InvalidKeyException - if the salt parameter cannot be
used to initialize the underlying HMAC.SecretKey extract(byte[] salt, SecretKey inputKey, String keyAlg) throws InvalidKeyException
salt - a salt value as cleartext bytes. A null value is
allowed, which will internally use an array of zero bytes the same
size as the underlying hash output length.inputKey - the input keying material provided as a
SecretKey.keyAlg - the algorithm name assigned to the resulting
SecretKey object.SecretKey that is the result of the HKDF extract
operation.InvalidKeyException - if the salt parameter cannot be
used to initialize the underlying HMAC.SecretKey expand(SecretKey pseudoRandKey, byte[] info, int outLen, String keyAlg) throws InvalidKeyException
pseudoRandKey - the pseudo random key (PRK).info - optional context-specific info. A null value is
allowed in which case a zero-length byte array will be used.outLen - the length of the resulting SecretKeykeyAlg - the algorithm name applied to the resulting
SecretKeySecretKey objectInvalidKeyException - if the underlying HMAC operation cannot
be initialized using the provided pseudoRandKey object.Copyright © 2023. All rights reserved.