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

public Class CertificateRequestMessage

extends Object
implements Encodable
Class Inheritance
All Implemented Interfaces
org.bouncycastle.util.Encodable
Known Direct Subclasses
org.bouncycastle.cert.crmf.jcajce.JcaCertificateRequestMessage
Imports
java.io.IOException, org.bouncycastle.asn1.ASN1Integer, .ASN1Object, .ASN1ObjectIdentifier, .ASN1Primitive, .ASN1UTF8String, org.bouncycastle.asn1.crmf.AttributeTypeAndValue, .CRMFObjectIdentifiers, .CertReqMsg, .CertTemplate, .Controls, .PKIArchiveOptions, .PKMACValue, .POPOSigningKey, .ProofOfPossession, org.bouncycastle.cert.CertIOException, org.bouncycastle.operator.ContentVerifier, .ContentVerifierProvider, .OperatorCreationException, org.bouncycastle.util.Encodable

Carrier for a CRMF CertReqMsg.

Field Summary

Modifier and TypeField and Description
private final CertReqMsg
private final Controls
public static final int
public static final int
public static final int
public static final int

Constructor Summary

AccessConstructor and Description
public
CertificateRequestMessage(byte[]
BER/DER encoding of the CertReqMsg structure.
certReqMsg
)

Create a CertificateRequestMessage from the passed in bytes.

public

Method Summary

Modifier and TypeMethod and Description
private AttributeTypeAndValue
public ASN1Integer

Returns:

the certificate request ID.
getCertReqId
()

Return the certificate request ID for this message.

public CertTemplate

Returns:

a CertTemplate structure.
getCertTemplate
()

Return the certificate template contained in this message.

public Control

Returns:

the control value if present, null otherwise.
getControl
(ASN1ObjectIdentifier
the type OID for the control value we are checking for.
type
)

Return a control value of the specified type.

public byte[]

Returns:

a byte array containing the binary encoding of the certReqMsg.
getEncoded
()

Implements org.bouncycastle.util.Encodable.getEncoded.

Return the ASN.1 encoding of the certReqMsg we wrap.

public int

Returns:

one of: popRaVerified, popSigningKey, popKeyEncipherment, popKeyAgreement
getProofOfPossessionType
()

Return the type of the proof-of-possession this request message provides.

public boolean

Returns:

true if a control value of type is present, false otherwise.
hasControl
(ASN1ObjectIdentifier
the type OID for the control value we are checking for.
type
)

Return whether or not this request has a specific type of control value.

public boolean

Returns:

true if there are control values present, false otherwise.
hasControls
()

Return whether or not this request has control values associated with it.

public boolean

Returns:

true if proof-of-possession is present, false otherwise.
hasProofOfPossession
()

Return whether or not this request message has a proof-of-possession field in it.

public boolean

Returns:

true if POP is popSigningKey and a PKMAC is present, false otherwise.
hasSigningKeyProofOfPossessionWithPKMAC
()

Return whether or not the proof-of-possession (POP) is of the type popSigningKey and it has a public key MAC associated with it.

public boolean

Returns:

true if the POP is valid, false otherwise.
isValidSigningKeyPOP
(ContentVerifierProvider
a provider that can produce content verifiers for the signature contained in this POP.
verifierProvider
)

Return whether or not a signing key proof-of-possession (POP) is valid.

public boolean

Returns:

true if the POP is valid, false otherwise.
isValidSigningKeyPOP
(ContentVerifierProvider
a provider that can produce content verifiers for the signature contained in this POP.
verifierProvider
,
PKMACBuilder
a suitable PKMACBuilder to create the MAC verifier.
macBuilder
,
char[]
the password used to key the MAC calculation.
password
)

Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.

private static CertReqMsg
parseBytes(byte[] encoding)

public CertReqMsg

Returns:

a CertReqMsg.
toASN1Structure
()

Return the underlying ASN.1 object defining this CertificateRequestMessage object.

private boolean
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

certReqMsgback to summary
private final CertReqMsg certReqMsg
controlsback to summary
private final Controls controls
popKeyAgreementback to summary
public static final int popKeyAgreement
popKeyEnciphermentback to summary
public static final int popKeyEncipherment
popRaVerifiedback to summary
public static final int popRaVerified
popSigningKeyback to summary
public static final int popSigningKey

Constructor Detail

CertificateRequestMessageback to summary
public CertificateRequestMessage(byte[] certReqMsg) throws IOException

Create a CertificateRequestMessage from the passed in bytes.

Parameters
certReqMsg:byte[]

BER/DER encoding of the CertReqMsg structure.

Exceptions
IOException:
in the event of corrupted data, or an incorrect structure.
CertificateRequestMessageback to summary
public CertificateRequestMessage(CertReqMsg certReqMsg)

Method Detail

findControlback to summary
private AttributeTypeAndValue findControl(ASN1ObjectIdentifier type)
getCertReqIdback to summary
public ASN1Integer getCertReqId()

Return the certificate request ID for this message.

Returns:ASN1Integer

the certificate request ID.

getCertTemplateback to summary
public CertTemplate getCertTemplate()

Return the certificate template contained in this message.

Returns:CertTemplate

a CertTemplate structure.

getControlback to summary
public Control getControl(ASN1ObjectIdentifier type)

Return a control value of the specified type.

Parameters
type:ASN1ObjectIdentifier

the type OID for the control value we are checking for.

Returns:Control

the control value if present, null otherwise.

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

Implements org.bouncycastle.util.Encodable.getEncoded.

Return the ASN.1 encoding of the certReqMsg we wrap.

Returns:byte[]

a byte array containing the binary encoding of the certReqMsg.

Exceptions
IOException:
if there is an exception creating the encoding.
getProofOfPossessionTypeback to summary
public int getProofOfPossessionType()

Return the type of the proof-of-possession this request message provides.

Returns:int

one of: popRaVerified, popSigningKey, popKeyEncipherment, popKeyAgreement

hasControlback to summary
public boolean hasControl(ASN1ObjectIdentifier type)

Return whether or not this request has a specific type of control value.

Parameters
type:ASN1ObjectIdentifier

the type OID for the control value we are checking for.

Returns:boolean

true if a control value of type is present, false otherwise.

hasControlsback to summary
public boolean hasControls()

Return whether or not this request has control values associated with it.

Returns:boolean

true if there are control values present, false otherwise.

hasProofOfPossessionback to summary
public boolean hasProofOfPossession()

Return whether or not this request message has a proof-of-possession field in it.

Returns:boolean

true if proof-of-possession is present, false otherwise.

hasSigningKeyProofOfPossessionWithPKMACback to summary
public boolean hasSigningKeyProofOfPossessionWithPKMAC()

Return whether or not the proof-of-possession (POP) is of the type popSigningKey and it has a public key MAC associated with it.

Returns:boolean

true if POP is popSigningKey and a PKMAC is present, false otherwise.

isValidSigningKeyPOPback to summary
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider) throws CRMFException, IllegalStateException

Return whether or not a signing key proof-of-possession (POP) is valid.

Parameters
verifierProvider:ContentVerifierProvider

a provider that can produce content verifiers for the signature contained in this POP.

Returns:boolean

true if the POP is valid, false otherwise.

Exceptions
CRMFException:
if there is a problem in verification or content verifier creation.
IllegalStateException:
if POP not appropriate.
isValidSigningKeyPOPback to summary
public boolean isValidSigningKeyPOP(ContentVerifierProvider verifierProvider, PKMACBuilder macBuilder, char[] password) throws CRMFException, IllegalStateException

Return whether or not a signing key proof-of-possession (POP), with an associated PKMAC, is valid.

Parameters
verifierProvider:ContentVerifierProvider

a provider that can produce content verifiers for the signature contained in this POP.

macBuilder:PKMACBuilder

a suitable PKMACBuilder to create the MAC verifier.

password:char[]

the password used to key the MAC calculation.

Returns:boolean

true if the POP is valid, false otherwise.

Exceptions
CRMFException:
if there is a problem in verification or content verifier creation.
IllegalStateException:
if POP not appropriate.
parseBytesback to summary
private static CertReqMsg parseBytes(byte[] encoding) throws IOException
toASN1Structureback to summary
public CertReqMsg toASN1Structure()

Return the underlying ASN.1 object defining this CertificateRequestMessage object.

Returns:CertReqMsg

a CertReqMsg.

verifySignatureback to summary
private boolean verifySignature(ContentVerifierProvider verifierProvider, POPOSigningKey popoSign) throws CRMFException