Package org.bouncycastle.est
Class ESTService
- java.lang.Object
-
- org.bouncycastle.est.ESTService
-
public class ESTService extends java.lang.Object
ESTService provides unified access to an EST server which is defined as implementing RFC7030.
-
-
Field Summary
Fields Modifier and Type Field Description protected static java.lang.String
CACERTS
protected static java.lang.String
CSRATTRS
protected static java.lang.String
FULLCMC
protected static java.util.Set<java.lang.String>
illegalParts
protected static java.lang.String
SERVERGEN
protected static java.lang.String
SIMPLE_ENROLL
protected static java.lang.String
SIMPLE_REENROLL
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description CACertsResponse
getCACerts()
Query the EST server for ca certificates.CSRRequestResponse
getCSRAttributes()
Fetch he CSR Attributes from the server.protected EnrollmentResponse
handleEnrollResponse(ESTResponse resp)
Handles the enroll response, deals with status codes and setting of delays.EnrollmentResponse
simpleEnroll(boolean reenroll, PKCS10CertificationRequest certificationRequest, ESTAuth auth)
Perform a simple enrollment operation.EnrollmentResponse
simpleEnroll(EnrollmentResponse priorResponse)
Reissue an existing request where the server had previously returned a 202.EnrollmentResponse
simpleEnrollPoP(boolean reEnroll, PKCS10CertificationRequestBuilder builder, ContentSigner contentSigner, ESTAuth auth)
Implements Enroll with PoP.static X509CertificateHolder[]
storeToArray(org.bouncycastle.util.Store<X509CertificateHolder> store)
Utility method to extract all the X509Certificates from a store and return them in an array.static X509CertificateHolder[]
storeToArray(org.bouncycastle.util.Store<X509CertificateHolder> store, org.bouncycastle.util.Selector<X509CertificateHolder> selector)
Utility method to extract all the X509Certificates from a store using a filter and to return them as an array.
-
-
-
Field Detail
-
CACERTS
protected static final java.lang.String CACERTS
- See Also:
- Constant Field Values
-
SIMPLE_ENROLL
protected static final java.lang.String SIMPLE_ENROLL
- See Also:
- Constant Field Values
-
SIMPLE_REENROLL
protected static final java.lang.String SIMPLE_REENROLL
- See Also:
- Constant Field Values
-
FULLCMC
protected static final java.lang.String FULLCMC
- See Also:
- Constant Field Values
-
SERVERGEN
protected static final java.lang.String SERVERGEN
- See Also:
- Constant Field Values
-
CSRATTRS
protected static final java.lang.String CSRATTRS
- See Also:
- Constant Field Values
-
illegalParts
protected static final java.util.Set<java.lang.String> illegalParts
-
-
Method Detail
-
storeToArray
public static X509CertificateHolder[] storeToArray(org.bouncycastle.util.Store<X509CertificateHolder> store)
Utility method to extract all the X509Certificates from a store and return them in an array.- Parameters:
store
- The store.- Returns:
- An arrar of certificates/
-
storeToArray
public static X509CertificateHolder[] storeToArray(org.bouncycastle.util.Store<X509CertificateHolder> store, org.bouncycastle.util.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
- The store.selector
- The selector.- Returns:
- An array of X509Certificates.
-
getCACerts
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:
- A store of X509Certificates.
- Throws:
ESTException
-
simpleEnroll
public EnrollmentResponse simpleEnroll(EnrollmentResponse priorResponse) throws java.lang.Exception
Reissue an existing request where the server had previously returned a 202.- Parameters:
priorResponse
- The prior response.- Returns:
- A new ESTEnrollmentResponse
- Throws:
java.lang.Exception
-
simpleEnroll
public EnrollmentResponse simpleEnroll(boolean reenroll, PKCS10CertificationRequest certificationRequest, ESTAuth auth) throws java.io.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
- The certification request.auth
- The http auth provider, basic auth or digest auth, can be null.- Returns:
- The enrolled certificate.
- Throws:
java.io.IOException
-
simpleEnrollPoP
public EnrollmentResponse simpleEnrollPoP(boolean reEnroll, PKCS10CertificationRequestBuilder builder, ContentSigner contentSigner, ESTAuth auth) throws java.io.IOException
Implements Enroll with PoP. Request will have the tls-unique attribute added to it before it is signed and completed.- Parameters:
reEnroll
- True = re enroll.builder
- The request builder.contentSigner
- The content signer.auth
- Auth modes.- Returns:
- Enrollment response.
- Throws:
java.io.IOException
-
handleEnrollResponse
protected EnrollmentResponse handleEnrollResponse(ESTResponse resp) throws java.io.IOException
Handles the enroll response, deals with status codes and setting of delays.- Parameters:
resp
- The response.- Returns:
- An EnrollmentResponse.
- Throws:
java.io.IOException
-
getCSRAttributes
public CSRRequestResponse getCSRAttributes() throws ESTException
Fetch he CSR Attributes from the server.- Returns:
- A CSRRequestResponse with the attributes.
- Throws:
ESTException
-
-