Package org.bouncycastle.pkcs
Class PKCS12PfxPdu
java.lang.Object
org.bouncycastle.pkcs.PKCS12PfxPdu
A holding class for the PKCS12 Pfx structure.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bouncycastle.asn1.pkcs.ContentInfo[]Return the content infos in the AuthenticatedSafe contained in this Pfx.byte[]byte[]getEncoded(String encoding) Return a Pfx with the outer wrapper encoded as asked for.org.bouncycastle.asn1.x509.AlgorithmIdentifierReturn the algorithm identifier describing the MAC algorithmbooleanhasMac()Return whether or not there is MAC attached to this file.booleanisMacValid(PKCS12MacCalculatorBuilderProvider macCalcProviderBuilder, char[] password) Verify the MacData attached to the PFX is consistent with what is expected.org.bouncycastle.asn1.pkcs.PfxReturn the underlying ASN.1 object.
-
Constructor Details
-
PKCS12PfxPdu
public PKCS12PfxPdu(org.bouncycastle.asn1.pkcs.Pfx pfx) -
PKCS12PfxPdu
- Throws:
IOException
-
-
Method Details
-
getContentInfos
public org.bouncycastle.asn1.pkcs.ContentInfo[] getContentInfos()Return the content infos in the AuthenticatedSafe contained in this Pfx.- Returns:
- an array of ContentInfo.
-
hasMac
public boolean hasMac()Return whether or not there is MAC attached to this file.- Returns:
- true if there is, false otherwise.
-
getMacAlgorithmID
public org.bouncycastle.asn1.x509.AlgorithmIdentifier getMacAlgorithmID()Return the algorithm identifier describing the MAC algorithm- Returns:
- the AlgorithmIdentifier representing the MAC algorithm, null if none present.
-
isMacValid
public boolean isMacValid(PKCS12MacCalculatorBuilderProvider macCalcProviderBuilder, char[] password) throws PKCSException Verify the MacData attached to the PFX is consistent with what is expected.- Parameters:
macCalcProviderBuilder- provider builder for the calculator for the MACpassword- password to use- Returns:
- true if mac data is valid, false otherwise.
- Throws:
PKCSException- if there is a problem evaluating the MAC.IllegalStateException- if no MAC is actually present
-
toASN1Structure
public org.bouncycastle.asn1.pkcs.Pfx toASN1Structure()Return the underlying ASN.1 object.- Returns:
- a Pfx object.
-
getEncoded
- Throws:
IOException
-
getEncoded
Return a Pfx with the outer wrapper encoded as asked for. For example, Pfx is a usually a BER encoded object, to get one with DefiniteLength encoding use:getEncoded(ASN1Encoding.DL)
- Parameters:
encoding- encoding style (ASN1Encoding.DER, ASN1Encoding.DL, ASN1Encoding.BER)- Returns:
- a byte array containing the encoded object.
- Throws:
IOException
-