Top Description Fields Constructors Methods
org.bouncycastle.pkcs

public Class PKCS12PfxPdu

extends Object
Class Inheritance
Imports
java.io.IOException, org.bouncycastle.asn1.ASN1OctetString, .ASN1Primitive, .ASN1Sequence, org.bouncycastle.asn1.pkcs.ContentInfo, .MacData, .PBMAC1Params, .PKCS12PBEParams, .PKCSObjectIdentifiers, .Pfx, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.util.Arrays

A holding class for the PKCS12 Pfx structure.

Field Summary

Modifier and TypeField and Description
private Pfx

Constructor Summary

AccessConstructor and Description
public
public
PKCS12PfxPdu(byte[] pfx)

Method Summary

Modifier and TypeMethod and Description
public ContentInfo[]

Returns:

an array of ContentInfo.
getContentInfos
()

Return the content infos in the AuthenticatedSafe contained in this Pfx.

public byte[]
public byte[]

Returns:

a byte array containing the encoded object.
getEncoded
(String
encoding style (ASN1Encoding.DER, ASN1Encoding.DL, ASN1Encoding.BER)
encoding
)

Return a Pfx with the outer wrapper encoded as asked for.

public AlgorithmIdentifier

Returns:

the AlgorithmIdentifier representing the MAC algorithm, null if none present.
getMacAlgorithmID
()

Return the algorithm identifier describing the MAC algorithm

public boolean

Returns:

true if there is, false otherwise.
hasMac
()

Return whether or not there is MAC attached to this file.

public boolean

Returns:

true if mac data is valid, false otherwise.
isMacValid
(PKCS12MacCalculatorBuilderProvider
provider builder for the calculator for the MAC
macCalcProviderBuilder
,
char[]
password to use
password
)

Verify the MacData attached to the PFX is consistent with what is expected.

private static Pfx
parseBytes(byte[] pfxEncoding)

public Pfx

Returns:

a Pfx object.
toASN1Structure
()

Return the underlying ASN.1 object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pfxback to summary
private Pfx pfx

Constructor Detail

PKCS12PfxPduback to summary
public PKCS12PfxPdu(Pfx pfx)
PKCS12PfxPduback to summary
public PKCS12PfxPdu(byte[] pfx) throws IOException

Method Detail

getContentInfosback to summary
public ContentInfo[] getContentInfos()

Return the content infos in the AuthenticatedSafe contained in this Pfx.

Returns:ContentInfo[]

an array of ContentInfo.

getEncodedback to summary
public byte[] getEncoded() throws IOException
getEncodedback to summary
public byte[] getEncoded(String encoding) throws IOException

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:String

encoding style (ASN1Encoding.DER, ASN1Encoding.DL, ASN1Encoding.BER)

Returns:byte[]

a byte array containing the encoded object.

getMacAlgorithmIDback to summary
public AlgorithmIdentifier getMacAlgorithmID()

Return the algorithm identifier describing the MAC algorithm

Returns:AlgorithmIdentifier

the AlgorithmIdentifier representing the MAC algorithm, null if none present.

hasMacback to summary
public boolean hasMac()

Return whether or not there is MAC attached to this file.

Returns:boolean

true if there is, false otherwise.

isMacValidback to summary
public boolean isMacValid(PKCS12MacCalculatorBuilderProvider macCalcProviderBuilder, char[] password) throws PKCSException

Verify the MacData attached to the PFX is consistent with what is expected.

Parameters
macCalcProviderBuilder:PKCS12MacCalculatorBuilderProvider

provider builder for the calculator for the MAC

password:char[]

password to use

Returns:boolean

true if mac data is valid, false otherwise.

Exceptions
PKCSException:
if there is a problem evaluating the MAC.
IllegalStateException:
if no MAC is actually present
parseBytesback to summary
private static Pfx parseBytes(byte[] pfxEncoding) throws IOException
toASN1Structureback to summary
public Pfx toASN1Structure()

Return the underlying ASN.1 object.

Returns:Pfx

a Pfx object.