Top Description Fields Constructors Methods
org.bouncycastle.cert.cmp

public Class ProtectedPKIMessage

extends Object
Class Inheritance
Imports
java.io.IOException, .OutputStream, org.bouncycastle.asn1.ASN1EncodableVector, .ASN1Encoding, .ASN1ObjectIdentifier, .DERSequence, org.bouncycastle.asn1.cmp.CMPCertificate, .CMPObjectIdentifiers, .PKIBody, .PKIHeader, .PKIMessage, org.bouncycastle.asn1.x509.AlgorithmIdentifier, org.bouncycastle.cert.X509CertificateHolder, org.bouncycastle.operator.ContentVerifier, .ContentVerifierProvider, .MacCalculator, .PBEMacCalculatorProvider, org.bouncycastle.util.Arrays

Wrapper for a PKIMessage with protection attached to it.

Field Summary

Modifier and TypeField and Description
private PKIMessage

Constructor Summary

AccessConstructor and Description
public
ProtectedPKIMessage(GeneralPKIMessage
a GeneralPKIMessage with
pkiMessage
)

Base constructor.

pack-priv

Method Summary

Modifier and TypeMethod and Description
private DERSequence
public PKIBody

Returns:

the message's PKIBody structure.
getBody
()

Return the message body.

public X509CertificateHolder[]

Returns:

an array of extra certificates, zero length if none present.
getCertificates
()

Return the extra certificates associated with this message.

public PKIHeader

Returns:

the message's PKIHeader structure.
getHeader
()

Return the message header.

public AlgorithmIdentifier

Returns:

the algorithm ID for the message's protection algorithm.
getProtectionAlgorithm
()

Return the message's protection algorithm.

public boolean

Returns:

true if protection MAC PBE based, false otherwise.
hasPasswordBasedMacProtection
()

Determine whether the message is protected by a CMP password based MAC.

public PKIMessage

Returns:

a PKIMessage structure.
toASN1Structure
()

Return the underlying ASN.1 structure contained in this object.

public boolean

Returns:

true if the provider is able to create a verifier that validates the signature, false otherwise.
verify
(ContentVerifierProvider
a provider of signature verifiers.
verifierProvider
)

Verify a message with a public key based signature attached.

public boolean

Returns:

true if the passed in password and MAC builder verify the message, false otherwise.
verify
(PBEMacCalculatorProvider
MAC builder that can be used to construct the appropriate MacCalculator
pbeMacCalculatorProvider
,
char[]
the MAC password
password
)

Verify a message with password based MAC protection.

private boolean
verifySignature(byte[] signature, ContentVerifier verifier)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

pkiMessageback to summary
private PKIMessage pkiMessage

Constructor Detail

ProtectedPKIMessageback to summary
public ProtectedPKIMessage(GeneralPKIMessage pkiMessage)

Base constructor.

Parameters
pkiMessage:GeneralPKIMessage

a GeneralPKIMessage with

ProtectedPKIMessageback to summary
pack-priv ProtectedPKIMessage(PKIMessage pkiMessage)

Method Detail

createProtectedback to summary
private DERSequence createProtected()
getBodyback to summary
public PKIBody getBody()

Return the message body.

Returns:PKIBody

the message's PKIBody structure.

getCertificatesback to summary
public X509CertificateHolder[] getCertificates()

Return the extra certificates associated with this message.

Returns:X509CertificateHolder[]

an array of extra certificates, zero length if none present.

getHeaderback to summary
public PKIHeader getHeader()

Return the message header.

Returns:PKIHeader

the message's PKIHeader structure.

getProtectionAlgorithmback to summary
public AlgorithmIdentifier getProtectionAlgorithm()

Return the message's protection algorithm.

Returns:AlgorithmIdentifier

the algorithm ID for the message's protection algorithm.

hasPasswordBasedMacProtectionback to summary
public boolean hasPasswordBasedMacProtection()

Determine whether the message is protected by a CMP password based MAC. Use verify(PBEMacCalculatorProvider, char[]) to verify the message if this method returns true.

Returns:boolean

true if protection MAC PBE based, false otherwise.

toASN1Structureback to summary
public PKIMessage toASN1Structure()

Return the underlying ASN.1 structure contained in this object.

Returns:PKIMessage

a PKIMessage structure.

verifyback to summary
public boolean verify(ContentVerifierProvider verifierProvider) throws CMPException

Verify a message with a public key based signature attached.

Parameters
verifierProvider:ContentVerifierProvider

a provider of signature verifiers.

Returns:boolean

true if the provider is able to create a verifier that validates the signature, false otherwise.

Exceptions
CMPException:
if an exception is thrown trying to verify the signature.
verifyback to summary
public boolean verify(PBEMacCalculatorProvider pbeMacCalculatorProvider, char[] password) throws CMPException

Verify a message with password based MAC protection.

Parameters
pbeMacCalculatorProvider:PBEMacCalculatorProvider

MAC builder that can be used to construct the appropriate MacCalculator

password:char[]

the MAC password

Returns:boolean

true if the passed in password and MAC builder verify the message, false otherwise.

Exceptions
CMPException:
if algorithm not MAC based, or an exception is thrown verifying the MAC.
verifySignatureback to summary
private boolean verifySignature(byte[] signature, ContentVerifier verifier)