Class AbstractP12Generator

java.lang.Object
org.cryptacular.generator.AbstractP12Generator
All Implemented Interfaces:
P12Generator
Direct Known Subclasses:
AESP12Generator, LegacyP12Generator

public abstract class AbstractP12Generator extends Object implements P12Generator
Base class for all PKCS12 generation components.
Author:
Marvin S. Addison
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    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.
    org.bouncycastle.pkcs.PKCS12PfxPdu
    generate(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.PKCS12PfxPdu
    generate(char[] password, PrivateKey key, X509Certificate... certificates)
    Generates a PKCS12 container object that contains the given private key and certificates.
    protected abstract org.bouncycastle.asn1.ASN1ObjectIdentifier
     
    protected abstract DigestSpec
     
    abstract int
     
    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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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: P12Generator
      Generates a PKCS12 container object that contains the given private key and certificates with the given alias.
      Specified by:
      generate in interface P12Generator
      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: P12Generator
      Generates a PKCS12 container object that contains the given private key and certificates.
      Specified by:
      generate in interface P12Generator
      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

      protected abstract DigestSpec 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.