Class PKCS12SafeBagFactory

java.lang.Object
org.bouncycastle.pkcs.PKCS12SafeBagFactory

public class PKCS12SafeBagFactory extends Object
Factory that materialises the PKCS12SafeBags carried in one ContentInfo of a PFX's AuthenticatedSafe. Use the single-argument constructor for plain data content infos and the two-argument constructor with an InputDecryptorProvider for encryptedData content infos.
  • Constructor Details

    • PKCS12SafeBagFactory

      public PKCS12SafeBagFactory(org.bouncycastle.asn1.pkcs.ContentInfo info)
      Construct a factory over a plain (unencrypted) data ContentInfo.
      Parameters:
      info - the ContentInfo holding the SafeContents.
      Throws:
      IllegalArgumentException - if info is an encryptedData ContentInfo.
    • PKCS12SafeBagFactory

      public PKCS12SafeBagFactory(org.bouncycastle.asn1.pkcs.ContentInfo info, InputDecryptorProvider inputDecryptorProvider) throws PKCSException
      Construct a factory over an encryptedData ContentInfo, decrypting its contents with the supplied provider.
      Parameters:
      info - the encrypted ContentInfo.
      inputDecryptorProvider - provider able to produce a decryptor matching the algorithm identifier carried by info.
      Throws:
      PKCSException - if decryption fails.
      IllegalArgumentException - if info is not an encryptedData ContentInfo.
  • Method Details

    • getSafeBags

      public PKCS12SafeBag[] getSafeBags()
      Return the PKCS12SafeBags contained in the ContentInfo this factory was created over.
      Returns:
      the SafeBags as an array.