Package org.cryptacular.generator
Class AbstractP12Generator
java.lang.Object
org.cryptacular.generator.AbstractP12Generator
- All Implemented Interfaces:
P12Generator
- Direct Known Subclasses:
AESP12Generator,LegacyP12Generator
Base class for all PKCS12 generation components.
- Author:
- Marvin S. Addison
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract org.bouncycastle.operator.OutputEncryptordataOutputEncryptor(char[] password) Builds a new output encryptor that performs password-based encryption on encrypted data in the P12 file.org.bouncycastle.pkcs.PKCS12PfxPdugenerate(char[] password, PrivateKey key, String alias, X509Certificate... certificates) Generates a PKCS12 container object that contains the given private key and certificates with the given alias.org.bouncycastle.pkcs.PKCS12PfxPdugenerate(char[] password, PrivateKey key, X509Certificate... certificates) Generates a PKCS12 container object that contains the given private key and certificates.protected abstract org.bouncycastle.asn1.ASN1ObjectIdentifierprotected abstract DigestSpecabstract intprotected abstract org.bouncycastle.operator.OutputEncryptorkeyOutputEncryptor(char[] password) Builds a new output encryptor that performs password-based encryption on keys in the P12 file.
-
Constructor Details
-
AbstractP12Generator
public AbstractP12Generator()
-
-
Method Details
-
generate
public org.bouncycastle.pkcs.PKCS12PfxPdu generate(char[] password, PrivateKey key, String alias, X509Certificate... certificates) Description copied from interface:P12GeneratorGenerates a PKCS12 container object that contains the given private key and certificates with the given alias.- Specified by:
generatein interfaceP12Generator- Parameters:
password- PKCS12 encryption password. This secret is also used to encrypt the inner private key.key- Private key.alias- Keystore alias.certificates- One or more certificates. If more than one certificate is provided, the first is taken as the end-entity certificate.- Returns:
- Bouncy Castle PKCS12 container object.
-
generate
public org.bouncycastle.pkcs.PKCS12PfxPdu generate(char[] password, PrivateKey key, X509Certificate... certificates) Description copied from interface:P12GeneratorGenerates a PKCS12 container object that contains the given private key and certificates.- Specified by:
generatein interfaceP12Generator- Parameters:
password- PKCS12 encryption password. This secret is also used to encrypt the inner private key.key- Private key.certificates- One or more certificates. If more than one certificate is provided, the first is taken as the end-entity certificate.- Returns:
- Bouncy Castle PKCS12 container object.
-
getIterations
public abstract int getIterations()- Returns:
- Number of hashing rounds.
-
getDigestAlgorithmId
protected abstract org.bouncycastle.asn1.ASN1ObjectIdentifier getDigestAlgorithmId()- Returns:
- Digest algorithm object identifier.
-
getDigestSpec
- Returns:
- Digest specification.
-
keyOutputEncryptor
protected abstract org.bouncycastle.operator.OutputEncryptor keyOutputEncryptor(char[] password) Builds a new output encryptor that performs password-based encryption on keys in the P12 file.- Parameters:
password- Password tha will the basis of an encryption key.- Returns:
- Output encryptor.
-
dataOutputEncryptor
protected abstract org.bouncycastle.operator.OutputEncryptor dataOutputEncryptor(char[] password) Builds a new output encryptor that performs password-based encryption on encrypted data in the P12 file.- Parameters:
password- Password tha will the basis of an encryption key.- Returns:
- Output encryptor.
-