Top Description Fields Constructors Methods
org.bouncycastle.est

public Class ESTService

extends Object
Class Inheritance
Imports
java.io.ByteArrayOutputStream, .IOException, .InputStream, .PrintWriter, .StringWriter, java.net.URL, java.text.SimpleDateFormat, java.util.Collection, .HashSet, .Locale, .Set, .TimeZone, java.util.regex.Pattern, org.bouncycastle.asn1.ASN1InputStream, .ASN1Sequence, .DERPrintableString, org.bouncycastle.asn1.cms.ContentInfo, org.bouncycastle.asn1.est.CsrAttrs, org.bouncycastle.asn1.pkcs.PKCSObjectIdentifiers, .PrivateKeyInfo, org.bouncycastle.cert.X509CRLHolder, .X509CertificateHolder, org.bouncycastle.cmc.CMCException, .SimplePKIResponse, org.bouncycastle.mime.BasicMimeParser, .ConstantMimeContext, .Headers, .MimeContext, .MimeParser, .MimeParserContext, .MimeParserListener, org.bouncycastle.operator.ContentSigner, org.bouncycastle.pkcs.PKCS10CertificationRequest, .PKCS10CertificationRequestBuilder, org.bouncycastle.util.Selector, .Store, org.bouncycastle.util.encoders.Base64

ESTService provides unified access to an EST server which is defined as implementing RFC7030.

Field Summary

Modifier and TypeField and Description
protected static final String
private final ESTClientProvider
protected static final String
protected static final String
protected static final Set<String>
private static final Pattern
private final String
protected static final String
protected static final String
protected static final String

Constructor Summary

AccessConstructor and Description
pack-priv
ESTService(String serverAuthority, String label, ESTClientProvider clientProvider)

Method Summary

Modifier and TypeMethod and Description
private String
annotateRequest(byte[] data)

protected EnrollmentResponse

Returns:

The enrolled certificate.
enroll
(boolean reenroll, PKCS10CertificationRequest
The certification request.
certificationRequest
,
ESTAuth
The http auth provider, basic auth or digest auth, can be null.
auth
,
boolean
if true, request server key generation
certGen
)

Perform a simple enrollment operation.

public EnrollmentResponse

Returns:

Enrollment response.
enrollPop
(boolean
True = re enroll.
reEnroll
,
final PKCS10CertificationRequestBuilder
The request builder.
builder
,
final ContentSigner
The content signer.
contentSigner
,
ESTAuth
Auth modes.
auth
,
boolean
if true will request server key generation.
certGen
)

Implements Enroll with PoP.

private ASN1InputStream
getASN1InputStream(InputStream respStream, Long contentLength)

public CACertsResponse

Returns:

A store of X509Certificates.
getCACerts
()

Query the EST server for ca certificates.

public CSRRequestResponse

Returns:

A CSRRequestResponse with the attributes.
getCSRAttributes
()

Fetch he CSR Attributes from the server.

protected EnrollmentResponse

Returns:

An EnrollmentResponse.
handleEnrollResponse
(ESTResponse
The response.
resp
)

Handles an enrollment response, deals with status codes and setting of delays.

public EnrollmentResponse

Returns:

A new ESTEnrollmentResponse
simpleEnroll
(EnrollmentResponse
The prior response.
priorResponse
)

Reissue an existing request where the server had previously returned a 202.

public EnrollmentResponse

Returns:

The enrolled certificate.
simpleEnroll
(boolean
true for enrollment.
reenroll
,
PKCS10CertificationRequest
The certification request.
certificationRequest
,
ESTAuth
The http auth provider, basic auth or digest auth, can be null.
auth
)

Perform a simple enrollment operation.

public EnrollmentResponse

Returns:

Enrollment response.
simpleEnrollPoP
(boolean
True = re enroll.
reEnroll
,
final PKCS10CertificationRequestBuilder
The request builder.
builder
,
final ContentSigner
The content signer.
contentSigner
,
ESTAuth
Auth modes.
auth
)

Implements Enroll with PoP.

public EnrollmentResponse

Returns:

Enrollment Response
simpleEnrollPopWithServersideCreation
(final PKCS10CertificationRequestBuilder
The request builder.
builder
,
final ContentSigner
The content signer
contentSigner
,
ESTAuth
Auth modes
auth
)

Simple enrollment with PoP and server side creation of keys.

public EnrollmentResponse

Returns:

The enrolled certificate.
simpleEnrollWithServersideCreation
(PKCS10CertificationRequest
The certification request.
certificationRequest
,
ESTAuth
The http auth provider, basic auth or digest auth, can be null.
auth
)

Perform a simple enrollment operation.

public static X509CertificateHolder[]

Returns:

An arrar of certificates/
storeToArray
(Store<X509CertificateHolder>
The store.
store
)

Utility method to extract all the X509Certificates from a store and return them in an array.

public static X509CertificateHolder[]

Returns:

An array of X509Certificates.
storeToArray
(Store<X509CertificateHolder>
The store.
store
,
Selector<X509CertificateHolder>
The selector.
selector
)

Utility method to extract all the X509Certificates from a store using a filter and to return them as an array.

private String
private String
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CACERTSback to summary
protected static final String CACERTS
clientProviderback to summary
private final ESTClientProvider clientProvider
CSRATTRSback to summary
protected static final String CSRATTRS
FULLCMCback to summary
protected static final String FULLCMC
illegalPartsback to summary
protected static final Set<String> illegalParts
pathInValidback to summary
private static final Pattern pathInValid
serverback to summary
private final String server
SERVERGENback to summary
protected static final String SERVERGEN
SIMPLE_ENROLLback to summary
protected static final String SIMPLE_ENROLL
SIMPLE_REENROLLback to summary
protected static final String SIMPLE_REENROLL

Constructor Detail

ESTServiceback to summary
pack-priv ESTService(String serverAuthority, String label, ESTClientProvider clientProvider)

Method Detail

annotateRequestback to summary
private String annotateRequest(byte[] data)
enrollback to summary
protected EnrollmentResponse enroll(boolean reenroll, PKCS10CertificationRequest certificationRequest, ESTAuth auth, boolean certGen) throws IOException

Perform a simple enrollment operation.

This method accepts an ESPHttpAuth instance to provide basic or digest authentication.

If authentication is to be performed as part of TLS then this instances client keystore and their keystore password need to be specified.

Parameters
certificationRequest:PKCS10CertificationRequest

The certification request.

auth:ESTAuth

The http auth provider, basic auth or digest auth, can be null.

certGen:boolean

if true, request server key generation

Returns:EnrollmentResponse

The enrolled certificate.

enrollPopback to summary
public EnrollmentResponse enrollPop(boolean reEnroll, final PKCS10CertificationRequestBuilder builder, final ContentSigner contentSigner, ESTAuth auth, boolean certGen) throws IOException

Implements Enroll with PoP. Request will have the tls-unique attribute added to it before it is signed and completed.

Parameters
reEnroll:boolean

True = re enroll.

builder:PKCS10CertificationRequestBuilder

The request builder.

contentSigner:ContentSigner

The content signer.

auth:ESTAuth

Auth modes.

certGen:boolean

if true will request server key generation.

Returns:EnrollmentResponse

Enrollment response.

getASN1InputStreamback to summary
private ASN1InputStream getASN1InputStream(InputStream respStream, Long contentLength)
getCACertsback to summary
public CACertsResponse getCACerts() throws ESTException

Query the EST server for ca certificates.

RFC7030 leans heavily on the verification phases of TLS for both client and server verification.

It does however define a bootstrapping mode where if the client does not have the necessary ca certificates to validate the server it can defer to an external source, such as a human, to formally accept the ca certs.

If callers are using bootstrapping they must examine the CACertsResponse and validate it externally.

Returns:CACertsResponse

A store of X509Certificates.

getCSRAttributesback to summary
public CSRRequestResponse getCSRAttributes() throws ESTException

Fetch he CSR Attributes from the server.

Returns:CSRRequestResponse

A CSRRequestResponse with the attributes.

handleEnrollResponseback to summary
protected EnrollmentResponse handleEnrollResponse(ESTResponse resp) throws IOException

Handles an enrollment response, deals with status codes and setting of delays.

Parameters
resp:ESTResponse

The response.

Returns:EnrollmentResponse

An EnrollmentResponse.

simpleEnrollback to summary
public EnrollmentResponse simpleEnroll(EnrollmentResponse priorResponse) throws Exception

Reissue an existing request where the server had previously returned a 202.

Parameters
priorResponse:EnrollmentResponse

The prior response.

Returns:EnrollmentResponse

A new ESTEnrollmentResponse

simpleEnrollback to summary
public EnrollmentResponse simpleEnroll(boolean reenroll, PKCS10CertificationRequest certificationRequest, ESTAuth auth) throws IOException

Perform a simple enrollment operation.

This method accepts an ESPHttpAuth instance to provide basic or digest authentication.

If authentication is to be performed as part of TLS then this instances client keystore and their keystore password need to be specified.

Parameters
reenroll:boolean

true for enrollment.

certificationRequest:PKCS10CertificationRequest

The certification request.

auth:ESTAuth

The http auth provider, basic auth or digest auth, can be null.

Returns:EnrollmentResponse

The enrolled certificate.

simpleEnrollPoPback to summary
public EnrollmentResponse simpleEnrollPoP(boolean reEnroll, final PKCS10CertificationRequestBuilder builder, final ContentSigner contentSigner, ESTAuth auth) throws IOException

Implements Enroll with PoP. Request will have the tls-unique attribute added to it before it is signed and completed.

Parameters
reEnroll:boolean

True = re enroll.

builder:PKCS10CertificationRequestBuilder

The request builder.

contentSigner:ContentSigner

The content signer.

auth:ESTAuth

Auth modes.

Returns:EnrollmentResponse

Enrollment response.

simpleEnrollPopWithServersideCreationback to summary
public EnrollmentResponse simpleEnrollPopWithServersideCreation(final PKCS10CertificationRequestBuilder builder, final ContentSigner contentSigner, ESTAuth auth) throws IOException

Simple enrollment with PoP and server side creation of keys.

Parameters
builder:PKCS10CertificationRequestBuilder

The request builder.

contentSigner:ContentSigner

The content signer

auth:ESTAuth

Auth modes

Returns:EnrollmentResponse

Enrollment Response

simpleEnrollWithServersideCreationback to summary
public EnrollmentResponse simpleEnrollWithServersideCreation(PKCS10CertificationRequest certificationRequest, ESTAuth auth) throws IOException

Perform a simple enrollment operation.

This method accepts an ESPHttpAuth instance to provide basic or digest authentication.

If authentication is to be performed as part of TLS then this instances client keystore and their keystore password need to be specified.

Parameters
certificationRequest:PKCS10CertificationRequest

The certification request.

auth:ESTAuth

The http auth provider, basic auth or digest auth, can be null.

Returns:EnrollmentResponse

The enrolled certificate.

storeToArrayback to summary
public static X509CertificateHolder[] storeToArray(Store<X509CertificateHolder> store)

Utility method to extract all the X509Certificates from a store and return them in an array.

Parameters
store:Store<X509CertificateHolder>

The store.

Returns:X509CertificateHolder[]

An arrar of certificates/

storeToArrayback to summary
public static X509CertificateHolder[] storeToArray(Store<X509CertificateHolder> store, Selector<X509CertificateHolder> selector)

Utility method to extract all the X509Certificates from a store using a filter and to return them as an array.

Parameters
store:Store<X509CertificateHolder>

The store.

selector:Selector<X509CertificateHolder>

The selector.

Returns:X509CertificateHolder[]

An array of X509Certificates.

verifyLabelback to summary
private String verifyLabel(String label)
verifyServerback to summary
private String verifyServer(String server)