Class ADCSConnector
- java.lang.Object
-
- de.trustable.ca3s.core.service.adcs.ADCSConnector
-
@Service public class ADCSConnector extends Object
-
-
Constructor Summary
Constructors Constructor Description ADCSConnector()Adapter class to connect to an ADCS server using the parameter given in a CaConnectorConfig
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CAStatusgetStatus(CAConnectorConfig caConfig)Retrieve the current status of the ADCSProxyintretrieveCertificates(CAConnectorConfig config)Try to retrieve new certificates added since the last call.intretrieveCertificatesByResolvedDate(CAConnectorConfig config)Try to retrieve new certificates resolved since the last call.intretrieveCertificatesByRevokedDate(CAConnectorConfig config)intretrieveCertificatesOffsetOnly(CAConnectorConfig config)Try to retrieve new certificates added since the last call.voidrevokeCertificate(Certificate certDao, org.bouncycastle.asn1.x509.CRLReason crlReason, Date revocationDate, CAConnectorConfig config)Revoke (or reactivate) a given certificate created by the ADCS server identified by connector configCertificatesignCertificateRequest(CSR csr, CAConnectorConfig config)Send a csr object to the ADCS and retrieve a created certificate
-
-
-
Method Detail
-
getStatus
public CAStatus getStatus(CAConnectorConfig caConfig)
Retrieve the current status of the ADCSProxy- Parameters:
caConfig- set of configuration items- Returns:
- current status
-
signCertificateRequest
public Certificate signCertificateRequest(CSR csr, CAConnectorConfig config) throws GeneralSecurityException
Send a csr object to the ADCS and retrieve a created certificate- Parameters:
csr- the CSR object, not just a P10 PEM string, holding e.g. a CRS statusconfig- CAConnectorConfig- Returns:
- the freshly created certificate, already stored in the database
- Throws:
GeneralSecurityException- something went wrong, e.g. a rejection of the CSR. The status of the CSR is updated accordingly.
-
revokeCertificate
public void revokeCertificate(Certificate certDao, org.bouncycastle.asn1.x509.CRLReason crlReason, Date revocationDate, CAConnectorConfig config) throws GeneralSecurityException
Revoke (or reactivate) a given certificate created by the ADCS server identified by connector config- Parameters:
certDao- the certificate object to be revokedcrlReason- the revocation reason. The reason 'removeFromCRL' reactivates a certificate that was put 'on hold' previously.revocationDate- the revocation dateconfig- the connection data identifying an ADCS instance- Throws:
GeneralSecurityException- something went wrong, e.g. revocation reason is unknown
-
retrieveCertificatesOffsetOnly
public int retrieveCertificatesOffsetOnly(CAConnectorConfig config) throws de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException, de.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException
Try to retrieve new certificates added since the last call. This method is usually called by a timer. A chunk of certificates starting with a given offset will be requested. If there are new certificates available (with a ADCS request id greater than the offset) the content of these new certificates will be retrieved in distinct calls and stored in the internal database. The highest request ID will be stored as starting offset for subsequent calls. The number of certificates is limited to avoid blocking the calling cron job.- Parameters:
config- the connection data identifying an ADCS instance- Returns:
- the number in imported certificates
- Throws:
de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException- something went wrongde.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException- something went wrong, the adcsProxy is unavailable
-
retrieveCertificatesByResolvedDate
public int retrieveCertificatesByResolvedDate(CAConnectorConfig config) throws de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException, de.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException
Try to retrieve new certificates resolved since the last call. This method is usually called by a timer. A chunk of certificates with an resolved date after the timestamp of the last call will be requested. If there are new resolved certificates available the content of these new certificates will be retrieved in distinct calls and stored in the internal database. The number of certificates is limited to avoid blocking the calling cron job.- Parameters:
config- the connection data identifying an ADCS instance- Returns:
- the number in imported certificates
- Throws:
de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException- something went wrongde.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException- something went wrong, the adcsProxy is unavailable
-
retrieveCertificatesByRevokedDate
public int retrieveCertificatesByRevokedDate(CAConnectorConfig config) throws de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException, de.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException
- Throws:
de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSExceptionde.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException
-
retrieveCertificates
@Transactional public int retrieveCertificates(CAConnectorConfig config) throws de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException, de.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException
Try to retrieve new certificates added since the last call. This method is usually called by a timer. The number of certificates is limited to avoid blocking the calling cron job.- Parameters:
config- the connection data identifying an ADCS instance- Returns:
- the number in imported certificates
- Throws:
de.trustable.ca3s.adcsCertUtil.OODBConnectionsADCSException- something went wrongde.trustable.ca3s.adcsCertUtil.ADCSProxyUnavailableException- something went wrong, the adcsProxy is unavailable
-
-