Class PKCS12SafeBagBuilder

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      PKCS12SafeBagBuilder addBagAttribute​(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType, org.bouncycastle.asn1.ASN1Encodable attrValue)
      Add a bag attribute (e.g. friendlyName or localKeyId) to the bag being built.
      PKCS12SafeBag build()
      Assemble the SafeBag and return it.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo,
                                    OutputEncryptor encryptor)
        Build a pkcs8ShroudedKeyBag by encrypting the supplied private key.
        Parameters:
        privateKeyInfo - the private key to wrap.
        encryptor - the password-based output encryptor used to protect the key.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo)
        Build a keyBag carrying the supplied private key unencrypted.
        Parameters:
        privateKeyInfo - the private key payload.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(X509CertificateHolder certificate)
                             throws java.io.IOException
        Build a certBag holding an X.509 certificate.
        Parameters:
        certificate - the certificate to wrap.
        Throws:
        java.io.IOException - if the certificate cannot be encoded.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(X509CRLHolder crl)
                             throws java.io.IOException
        Build a crlBag holding an X.509 CRL.
        Parameters:
        crl - the CRL to wrap.
        Throws:
        java.io.IOException - if the CRL cannot be encoded.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(org.bouncycastle.asn1.x509.Certificate certificate)
                             throws java.io.IOException
        Build a certBag holding an X.509 certificate (low-level ASN.1 form).
        Parameters:
        certificate - the certificate to wrap.
        Throws:
        java.io.IOException - if the certificate cannot be encoded.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(org.bouncycastle.asn1.x509.CertificateList crl)
                             throws java.io.IOException
        Build a crlBag holding an X.509 CRL (low-level ASN.1 form).
        Parameters:
        crl - the CRL to wrap.
        Throws:
        java.io.IOException - if the CRL cannot be encoded.
      • PKCS12SafeBagBuilder

        public PKCS12SafeBagBuilder​(PKCS12SecretBag secretBag)
        Build a secretBag carrying an arbitrary secret value.
        Parameters:
        secretBag - the secret bag payload to wrap.
    • Method Detail

      • addBagAttribute

        public PKCS12SafeBagBuilder addBagAttribute​(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType,
                                                    org.bouncycastle.asn1.ASN1Encodable attrValue)
        Add a bag attribute (e.g. friendlyName or localKeyId) to the bag being built.
        Parameters:
        attrType - the attribute OID.
        attrValue - the attribute value.
        Returns:
        this builder.