public static class PKCS12StoreParameter.PBMAC1WithPBKDF2Builder
extends java.lang.Object
PKCS12StoreParameter.Builder.setMacAlgorithm(AlgorithmIdentifier).
The defaults are 16384 iterations, a 64-octet derived key, HMAC-SHA-256 as the PBKDF2 PRF and HMAC-SHA-512 as the message-authentication scheme. A salt has no default and must be supplied.
| Modifier and Type | Method and Description |
|---|---|
AlgorithmIdentifier |
build()
Build the PBMAC1 algorithm identifier.
|
PKCS12StoreParameter.PBMAC1WithPBKDF2Builder |
setIterationCount(int iterationCount)
Set the PBKDF2 iteration count.
|
PKCS12StoreParameter.PBMAC1WithPBKDF2Builder |
setKeySize(int keySizeInOctets)
Set the length of the MAC key PBKDF2 derives, in octets - this is the PBKDF2-params
keyLength field, which RFC 8018 app.
|
PKCS12StoreParameter.PBMAC1WithPBKDF2Builder |
setMac(ASN1ObjectIdentifier mac)
Set the message-authentication scheme the derived key is used with.
|
PKCS12StoreParameter.PBMAC1WithPBKDF2Builder |
setPrf(ASN1ObjectIdentifier prf)
Set the PBKDF2 pseudo-random function.
|
PKCS12StoreParameter.PBMAC1WithPBKDF2Builder |
setSalt(byte[] salt)
Set the PBKDF2 salt.
|
public PKCS12StoreParameter.PBMAC1WithPBKDF2Builder setIterationCount(int iterationCount)
iterationCount - the iteration count to derive the MAC key with.public PKCS12StoreParameter.PBMAC1WithPBKDF2Builder setSalt(byte[] salt)
build() fails without one.salt - the salt to derive the MAC key with; the array is copied.public PKCS12StoreParameter.PBMAC1WithPBKDF2Builder setKeySize(int keySizeInOctets)
RFC 9579 sec. 5 has it match the output size of the message-authentication scheme set by
setMac(ASN1ObjectIdentifier): 64 for the default HMAC-SHA-512, 32 for HMAC-SHA-256.
Sec. 9 of the same document asks that a length below 20 octets be rejected, and BC does so
when the MAC is derived. The default is 64.
keySizeInOctets - the length in octets of the key to derive.public PKCS12StoreParameter.PBMAC1WithPBKDF2Builder setPrf(ASN1ObjectIdentifier prf)
prf - OID of the PRF to derive the MAC key with.public PKCS12StoreParameter.PBMAC1WithPBKDF2Builder setMac(ASN1ObjectIdentifier mac)
setKeySize(int) to match its output size.mac - OID of the HMAC to authenticate the file with.public AlgorithmIdentifier build()
java.lang.IllegalStateException - if no salt has been set.