public class PKCS12SafeBagBuilder
extends java.lang.Object
PKCS12SafeBag. Each constructor selects the bag type
(shrouded key, key, cert, CRL or secret); bag attributes such as friendlyName or localKeyId
are layered on with addBagAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.ASN1Encodable) before build().| Constructor and Description |
|---|
PKCS12SafeBagBuilder(org.bouncycastle.asn1.x509.Certificate certificate)
Build a
certBag holding an X.509 certificate (low-level ASN.1 form). |
PKCS12SafeBagBuilder(org.bouncycastle.asn1.x509.CertificateList crl)
Build a
crlBag holding an X.509 CRL (low-level ASN.1 form). |
PKCS12SafeBagBuilder(PKCS12SecretBag secretBag)
Build a
secretBag carrying an arbitrary secret value. |
PKCS12SafeBagBuilder(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo)
Build a
keyBag carrying the supplied private key unencrypted. |
PKCS12SafeBagBuilder(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo,
OutputEncryptor encryptor)
Build a
pkcs8ShroudedKeyBag by encrypting the supplied private key. |
PKCS12SafeBagBuilder(X509CertificateHolder certificate)
Build a
certBag holding an X.509 certificate. |
PKCS12SafeBagBuilder(X509CRLHolder crl)
Build a
crlBag holding an X.509 CRL. |
| Modifier and Type | Method and 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.
|
public PKCS12SafeBagBuilder(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo,
OutputEncryptor encryptor)
pkcs8ShroudedKeyBag by encrypting the supplied private key.privateKeyInfo - the private key to wrap.encryptor - the password-based output encryptor used to protect the key.public PKCS12SafeBagBuilder(org.bouncycastle.asn1.pkcs.PrivateKeyInfo privateKeyInfo)
keyBag carrying the supplied private key unencrypted.privateKeyInfo - the private key payload.public PKCS12SafeBagBuilder(X509CertificateHolder certificate) throws java.io.IOException
certBag holding an X.509 certificate.certificate - the certificate to wrap.java.io.IOException - if the certificate cannot be encoded.public PKCS12SafeBagBuilder(X509CRLHolder crl) throws java.io.IOException
crlBag holding an X.509 CRL.crl - the CRL to wrap.java.io.IOException - if the CRL cannot be encoded.public PKCS12SafeBagBuilder(org.bouncycastle.asn1.x509.Certificate certificate)
throws java.io.IOException
certBag holding an X.509 certificate (low-level ASN.1 form).certificate - the certificate to wrap.java.io.IOException - if the certificate cannot be encoded.public PKCS12SafeBagBuilder(org.bouncycastle.asn1.x509.CertificateList crl)
throws java.io.IOException
crlBag holding an X.509 CRL (low-level ASN.1 form).crl - the CRL to wrap.java.io.IOException - if the CRL cannot be encoded.public PKCS12SafeBagBuilder(PKCS12SecretBag secretBag)
secretBag carrying an arbitrary secret value.secretBag - the secret bag payload to wrap.public PKCS12SafeBagBuilder addBagAttribute(org.bouncycastle.asn1.ASN1ObjectIdentifier attrType, org.bouncycastle.asn1.ASN1Encodable attrValue)
attrType - the attribute OID.attrValue - the attribute value.public PKCS12SafeBag build()
PKCS12SafeBag.