Package net.maritimeconnectivity.pki
Class Revocation
- java.lang.Object
-
- net.maritimeconnectivity.pki.Revocation
-
public class Revocation extends Object
Class that contains functions that are relevant for providing revocation information
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static X509CRLgenerateCRL(List<RevocationInfo> revokedCerts, KeyStore.PrivateKeyEntry keyEntry, PKIConfiguration pkiConfiguration)Creates a Certificate RevocationInfo List (CRL) for the certificate serialnumbers given.static org.bouncycastle.cert.ocsp.OCSPRespgenerateOCSPResponse(org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder respBuilder, KeyStore.PrivateKeyEntry signingCert, P11PKIConfiguration p11PKIConfiguration)Generates a OCSPResp.static voidgenerateRootCACRL(String signName, List<RevocationInfo> revokedCerts, KeyStore.PrivateKeyEntry keyEntry, String outputCaCrlPath, AuthProvider pkcs11Provider)Creates a Certificate RevocationInfo List (CRL) for the certificate serialnumbers given.static intgetCRLReasonFromString(String certReason)Returns the int value associated with a revocation statusstatic org.bouncycastle.cert.ocsp.OCSPResphandleOCSP(org.bouncycastle.cert.ocsp.OCSPReq request, PublicKey caPublicKey, KeyStore.PrivateKeyEntry signingCA, Map<org.bouncycastle.cert.ocsp.CertificateID,org.bouncycastle.cert.ocsp.CertificateStatus> certificateStatusMap, PKIConfiguration pkiConfiguration)static org.bouncycastle.cert.ocsp.BasicOCSPRespBuilderinitOCSPRespBuilder(org.bouncycastle.cert.ocsp.OCSPReq request, PublicKey publicKey)Generate a BasicOCSPRespBuilder.
-
-
-
Method Detail
-
getCRLReasonFromString
public static int getCRLReasonFromString(String certReason)
Returns the int value associated with a revocation status- Parameters:
certReason- The string representation of the status. Should be lowercase with no spaces or underscore- Returns:
- The int value associated with the revocation status
-
generateCRL
public static X509CRL generateCRL(List<RevocationInfo> revokedCerts, KeyStore.PrivateKeyEntry keyEntry, PKIConfiguration pkiConfiguration)
Creates a Certificate RevocationInfo List (CRL) for the certificate serialnumbers given.- Parameters:
revokedCerts- List of the serialnumbers that should be revoked.keyEntry- Private key to sign the CRLpkiConfiguration- A PKIConfiguration- Returns:
- a CRL
-
generateRootCACRL
public static void generateRootCACRL(String signName, List<RevocationInfo> revokedCerts, KeyStore.PrivateKeyEntry keyEntry, String outputCaCrlPath, AuthProvider pkcs11Provider)
Creates a Certificate RevocationInfo List (CRL) for the certificate serialnumbers given.- Parameters:
signName- DN name of the signing certificaterevokedCerts- List of the serialnumbers that should be revoked.keyEntry- Private key to sign the CRLoutputCaCrlPath- Where to place the CRLpkcs11Provider- PKCS#11 provider. If null default BC provider will be used.
-
handleOCSP
public static org.bouncycastle.cert.ocsp.OCSPResp handleOCSP(org.bouncycastle.cert.ocsp.OCSPReq request, PublicKey caPublicKey, KeyStore.PrivateKeyEntry signingCA, Map<org.bouncycastle.cert.ocsp.CertificateID,org.bouncycastle.cert.ocsp.CertificateStatus> certificateStatusMap, PKIConfiguration pkiConfiguration)- Parameters:
request- The incoming issuecaPublicKey- The public key of the signing CAsigningCA- The keystore entry for the signing CAcertificateStatusMap- A mapping from CertificateID to CertificateStatuspkiConfiguration- A PKIConfiguration- Returns:
- An OCSP response
-
initOCSPRespBuilder
public static org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder initOCSPRespBuilder(org.bouncycastle.cert.ocsp.OCSPReq request, PublicKey publicKey) throws org.bouncycastle.cert.ocsp.OCSPException, org.bouncycastle.operator.OperatorCreationExceptionGenerate a BasicOCSPRespBuilder.- Parameters:
request- The incoming request.publicKey- Public key of the issuer.- Returns:
- a BasicOCSPRespBuilder
- Throws:
org.bouncycastle.cert.ocsp.OCSPExceptionorg.bouncycastle.operator.OperatorCreationException
-
generateOCSPResponse
public static org.bouncycastle.cert.ocsp.OCSPResp generateOCSPResponse(org.bouncycastle.cert.ocsp.BasicOCSPRespBuilder respBuilder, KeyStore.PrivateKeyEntry signingCert, P11PKIConfiguration p11PKIConfiguration) throws org.bouncycastle.cert.ocsp.OCSPException, IOException, org.bouncycastle.operator.OperatorCreationException, CertificateEncodingExceptionGenerates a OCSPResp.- Parameters:
respBuilder- A BasicOCSPRespBuildersigningCert- PrivateKeyEntry of the signing certificate.p11PKIConfiguration- A P11PKIConfiguration. Can be null- Returns:
- a OCSPResp
- Throws:
org.bouncycastle.cert.ocsp.OCSPExceptionIOExceptionorg.bouncycastle.operator.OperatorCreationExceptionCertificateEncodingException
-
-