Top Description Fields Constructors Methods
org.bouncycastle.pkcs

public Class PKCS10CertificationRequestBuilder

extends Object
Class Inheritance
Known Direct Subclasses
org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequestBuilder
Imports
java.io.IOException, .OutputStream, java.util.ArrayList, .Iterator, .List, org.bouncycastle.asn1.ASN1Encodable, .ASN1EncodableVector, .ASN1Encoding, .ASN1ObjectIdentifier, .DERBitString, .DERSet, org.bouncycastle.asn1.pkcs.Attribute, .CertificationRequest, .CertificationRequestInfo, org.bouncycastle.asn1.x500.X500Name, org.bouncycastle.asn1.x509.SubjectPublicKeyInfo, org.bouncycastle.operator.ContentSigner

A class for creating PKCS#10 Certification requests.
CertificationRequest ::= SEQUENCE {
  certificationRequestInfo  CertificationRequestInfo,
  signatureAlgorithm        AlgorithmIdentifier{{ SignatureAlgorithms }},
  signature                 BIT STRING
}

CertificationRequestInfo ::= SEQUENCE {
  version             INTEGER { v1(0) } (v1,...),
  subject             Name,
  subjectPKInfo   SubjectPublicKeyInfo{{ PKInfoAlgorithms }},
  attributes          [0] Attributes{{ CRIAttributes }}
 }

 Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }}

 Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE {
   type    ATTRIBUTE.&id({IOSet}),
   values  SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{\@type})
 }

Field Summary

Modifier and TypeField and Description
private List<E>
private boolean
private SubjectPublicKeyInfo
private X500Name

Constructor Summary

AccessConstructor and Description
public
public
PKCS10CertificationRequestBuilder(X500Name
the X.500 Name defining the certificate subject this request is for.
subject
,
SubjectPublicKeyInfo
the info structure for the public key to be associated with this subject.
publicKeyInfo
)

Basic constructor.

Method Summary

Modifier and TypeMethod and Description
public PKCS10CertificationRequestBuilder

Returns:

this builder object.
addAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable
the ASN.1 structure that forms the value of the attribute.
attrValue
)

Add an attribute to the certification request we are building.

public PKCS10CertificationRequestBuilder

Returns:

this builder object.
addAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable[]
an array of ASN.1 structures that form the value of the attribute.
attrValues
)

Add an attribute with multiple values to the certification request we are building.

public PKCS10CertificationRequest

Returns:

a holder containing the resulting PKCS#10 certification request.
build
(ContentSigner
the content signer to be used to generate the signature validating the certificate.
signer
)

Generate an PKCS#10 request based on the past in signer.

public PKCS10CertificationRequestBuilder

Returns:

this builder object.
setAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable
the ASN.1 structure that forms the value of the attribute.
attrValue
)

Set an attribute to the certification request we are building.

public PKCS10CertificationRequestBuilder

Returns:

this builder object.
setAttribute
(ASN1ObjectIdentifier
the OID giving the type of the attribute.
attrType
,
ASN1Encodable[]
the ASN.1 structure that forms the value of the attribute.
attrValue
)

Add an attribute with multiple values to the certification request we are building.

public PKCS10CertificationRequestBuilder

Returns:

this builder object.
setLeaveOffEmptyAttributes
(boolean
true if empty attributes should be left out of the encoding false otherwise.
leaveOffEmpty
)

The attributes field in PKCS10 should encoded to an empty tagged set if there are no attributes.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

attributesback to summary
private List<E> attributes
leaveOffEmptyback to summary
private boolean leaveOffEmpty
publicKeyInfoback to summary
private SubjectPublicKeyInfo publicKeyInfo
subjectback to summary
private X500Name subject

Constructor Detail

PKCS10CertificationRequestBuilderback to summary
public PKCS10CertificationRequestBuilder(PKCS10CertificationRequestBuilder original)
PKCS10CertificationRequestBuilderback to summary
public PKCS10CertificationRequestBuilder(X500Name subject, SubjectPublicKeyInfo publicKeyInfo)

Basic constructor.

Parameters
subject:X500Name

the X.500 Name defining the certificate subject this request is for.

publicKeyInfo:SubjectPublicKeyInfo

the info structure for the public key to be associated with this subject.

Method Detail

addAttributeback to summary
public PKCS10CertificationRequestBuilder addAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable attrValue)

Add an attribute to the certification request we are building.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValue:ASN1Encodable

the ASN.1 structure that forms the value of the attribute.

Returns:PKCS10CertificationRequestBuilder

this builder object.

addAttributeback to summary
public PKCS10CertificationRequestBuilder addAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable[] attrValues)

Add an attribute with multiple values to the certification request we are building.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValues:ASN1Encodable[]

an array of ASN.1 structures that form the value of the attribute.

Returns:PKCS10CertificationRequestBuilder

this builder object.

buildback to summary
public PKCS10CertificationRequest build(ContentSigner signer)

Generate an PKCS#10 request based on the past in signer.

Parameters
signer:ContentSigner

the content signer to be used to generate the signature validating the certificate.

Returns:PKCS10CertificationRequest

a holder containing the resulting PKCS#10 certification request.

setAttributeback to summary
public PKCS10CertificationRequestBuilder setAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable attrValue)

Set an attribute to the certification request we are building. Removed existing attributes with the same attrType.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValue:ASN1Encodable

the ASN.1 structure that forms the value of the attribute.

Returns:PKCS10CertificationRequestBuilder

this builder object.

setAttributeback to summary
public PKCS10CertificationRequestBuilder setAttribute(ASN1ObjectIdentifier attrType, ASN1Encodable[] attrValue)

Add an attribute with multiple values to the certification request we are building. Removed existing attributes with the same attrType.

Parameters
attrType:ASN1ObjectIdentifier

the OID giving the type of the attribute.

attrValue:ASN1Encodable[]

the ASN.1 structure that forms the value of the attribute.

Returns:PKCS10CertificationRequestBuilder

this builder object.

setLeaveOffEmptyAttributesback to summary
public PKCS10CertificationRequestBuilder setLeaveOffEmptyAttributes(boolean leaveOffEmpty)

The attributes field in PKCS10 should encoded to an empty tagged set if there are no attributes. Some CAs will reject requests with the attribute field present.

Parameters
leaveOffEmpty:boolean

true if empty attributes should be left out of the encoding false otherwise.

Returns:PKCS10CertificationRequestBuilder

this builder object.