Package org.bouncycastle.pkcs.jcajce
Class JcePBMac1CalculatorBuilder
- java.lang.Object
-
- org.bouncycastle.pkcs.jcajce.JcePBMac1CalculatorBuilder
-
public class JcePBMac1CalculatorBuilder extends java.lang.Object
A builder for RFC 8018 PBE based MAC calculators.By default the class uses HMAC-SHA256 as the PRF, with an iteration count of 8192. The default salt length is the output size of the MAC being used.
-
-
Field Summary
Fields Modifier and Type Field Description static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA224
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA256
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA3_224
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA3_256
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA3_384
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA3_512
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA384
static org.bouncycastle.asn1.x509.AlgorithmIdentifier
PRF_SHA512
-
Constructor Summary
Constructors Constructor Description JcePBMac1CalculatorBuilder(java.lang.String macAlgorithm, int keySize)
Base constructor - MAC name and key size.JcePBMac1CalculatorBuilder(java.lang.String macAlgorithm, int keySize, org.bouncycastle.operator.MacAlgorithmIdentifierFinder algIdFinder)
Base constructor - MAC name and key size with a custom AlgorithmIdentifier finder for the MAC algorithm.JcePBMac1CalculatorBuilder(org.bouncycastle.asn1.pkcs.PBMAC1Params pbeMacParams)
Base constructor from an ASN.1 parameter set.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.operator.MacCalculator
build(char[] password)
JcePBMac1CalculatorBuilder
setIterationCount(int iterationCount)
JcePBMac1CalculatorBuilder
setPrf(org.bouncycastle.asn1.x509.AlgorithmIdentifier prf)
JcePBMac1CalculatorBuilder
setProvider(java.lang.String providerName)
JcePBMac1CalculatorBuilder
setProvider(java.security.Provider provider)
JcePBMac1CalculatorBuilder
setRandom(java.security.SecureRandom random)
JcePBMac1CalculatorBuilder
setSalt(byte[] salt)
JcePBMac1CalculatorBuilder
setSaltLength(int saltLength)
Set the length of the salt in bytes.
-
-
-
Field Detail
-
PRF_SHA224
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA224
-
PRF_SHA256
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA256
-
PRF_SHA384
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA384
-
PRF_SHA512
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA512
-
PRF_SHA3_224
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA3_224
-
PRF_SHA3_256
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA3_256
-
PRF_SHA3_384
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA3_384
-
PRF_SHA3_512
public static final org.bouncycastle.asn1.x509.AlgorithmIdentifier PRF_SHA3_512
-
-
Constructor Detail
-
JcePBMac1CalculatorBuilder
public JcePBMac1CalculatorBuilder(java.lang.String macAlgorithm, int keySize)
Base constructor - MAC name and key size.- Parameters:
macAlgorithm
- name of the MAC algorithm.keySize
- the key size in bits.
-
JcePBMac1CalculatorBuilder
public JcePBMac1CalculatorBuilder(java.lang.String macAlgorithm, int keySize, org.bouncycastle.operator.MacAlgorithmIdentifierFinder algIdFinder)
Base constructor - MAC name and key size with a custom AlgorithmIdentifier finder for the MAC algorithm.- Parameters:
macAlgorithm
- name of the MAC algorithm.keySize
- the key size in bits.algIdFinder
- an AlgorithmIdentifier finder containing the specified MAC name.
-
JcePBMac1CalculatorBuilder
public JcePBMac1CalculatorBuilder(org.bouncycastle.asn1.pkcs.PBMAC1Params pbeMacParams)
Base constructor from an ASN.1 parameter set. See RFC 8108 for details.- Parameters:
pbeMacParams
- the ASN.1 parameters for the MAC calculator we want to create.
-
-
Method Detail
-
setProvider
public JcePBMac1CalculatorBuilder setProvider(java.security.Provider provider)
-
setProvider
public JcePBMac1CalculatorBuilder setProvider(java.lang.String providerName)
-
setIterationCount
public JcePBMac1CalculatorBuilder setIterationCount(int iterationCount)
-
setSaltLength
public JcePBMac1CalculatorBuilder setSaltLength(int saltLength)
Set the length of the salt in bytes.- Parameters:
saltLength
-- Returns:
-
setSalt
public JcePBMac1CalculatorBuilder setSalt(byte[] salt)
-
setRandom
public JcePBMac1CalculatorBuilder setRandom(java.security.SecureRandom random)
-
setPrf
public JcePBMac1CalculatorBuilder setPrf(org.bouncycastle.asn1.x509.AlgorithmIdentifier prf)
-
build
public org.bouncycastle.operator.MacCalculator build(char[] password) throws org.bouncycastle.operator.OperatorCreationException
- Throws:
org.bouncycastle.operator.OperatorCreationException
-
-