Class CaCmpConnector
- java.lang.Object
-
- de.trustable.ca3s.core.service.cmp.CaCmpConnector
-
@Service public class CaCmpConnector extends Object
-
-
Constructor Summary
Constructors Constructor Description CaCmpConnector(RemoteConnector remoteConnector, de.trustable.util.CryptoUtil cryptoUtil, CertificateUtil certUtil, CSRUtil csrUtil, ProtectedContentUtil protUtil, CertificateRepository certificateRepository, CaConnectorConfigUtil caConnectorConfigUtil, CertificateUtil certificateUtil)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description CAStatusgetStatus(CAConnectorConfig caConnConfig)CertificatereadCertResponse(de.trustable.cmp.client.cmpClient.CMPClientImpl.CertificateResponseContent certificateResponseContent, CSR csr, CAConnectorConfig config)public GenMsgContent getGeneralInfo(String hmacSecret, String cmpEndpoint, String alias) throws GeneralSecurityException { try { PKIMessage pkiMessage = cryptoUtil.buildGeneralMessageRequest(hmacSecret); // send and receive ..voidrevokeCertificate(Certificate certDao, org.bouncycastle.asn1.x509.CRLReason crlReason, Date revocationDate, CAConnectorConfig caConnConfig)voidrevokeCertificate(org.bouncycastle.asn1.x500.X500Name issuerDN, org.bouncycastle.asn1.x500.X500Name subjectDN, BigInteger serial, org.bouncycastle.asn1.x509.CRLReason crlReason, CAConnectorConfig caConnConfig)CertificatesignCertificateRequest(CSR csr, CAConnectorConfig caConnConfig)
-
-
-
Constructor Detail
-
CaCmpConnector
public CaCmpConnector(RemoteConnector remoteConnector, de.trustable.util.CryptoUtil cryptoUtil, CertificateUtil certUtil, CSRUtil csrUtil, ProtectedContentUtil protUtil, CertificateRepository certificateRepository, CaConnectorConfigUtil caConnectorConfigUtil, CertificateUtil certificateUtil)
- Parameters:
remoteConnector-cryptoUtil-certUtil-csrUtil-protUtil-certificateRepository-caConnectorConfigUtil-certificateUtil-
-
-
Method Detail
-
signCertificateRequest
public Certificate signCertificateRequest(CSR csr, CAConnectorConfig caConnConfig) throws GeneralSecurityException
- Parameters:
csr- csr as CSR objectcaConnConfig- CAConnectorConfig- Returns:
- the created certificate, pem encoded
- Throws:
GeneralSecurityException- something went wrong, e.g. no CSM format
-
revokeCertificate
public void revokeCertificate(Certificate certDao, org.bouncycastle.asn1.x509.CRLReason crlReason, Date revocationDate, CAConnectorConfig caConnConfig) throws GeneralSecurityException
- Parameters:
certDao-crlReason-revocationDate-caConnConfig-- Throws:
GeneralSecurityException
-
revokeCertificate
public void revokeCertificate(org.bouncycastle.asn1.x500.X500Name issuerDN, org.bouncycastle.asn1.x500.X500Name subjectDN, BigInteger serial, org.bouncycastle.asn1.x509.CRLReason crlReason, CAConnectorConfig caConnConfig) throws GeneralSecurityException- Parameters:
issuerDN-subjectDN-serial-crlReason-caConnConfig-- Throws:
GeneralSecurityException
-
getStatus
public CAStatus getStatus(CAConnectorConfig caConnConfig)
- Parameters:
caConnConfig-- Returns:
-
readCertResponse
public Certificate readCertResponse(de.trustable.cmp.client.cmpClient.CMPClientImpl.CertificateResponseContent certificateResponseContent, CSR csr, CAConnectorConfig config) throws GeneralSecurityException
public GenMsgContent getGeneralInfo(String hmacSecret, String cmpEndpoint, String alias) throws GeneralSecurityException { try { PKIMessage pkiMessage = cryptoUtil.buildGeneralMessageRequest(hmacSecret); // send and receive .. LOGGER.debug("general info requestBytes : " + java.util.Base64.getEncoder().encodeToString(pkiMessage.getEncoded())); byte[] responseBytes = remoteConnector.sendHttpReq(cmpEndpoint + "/" + alias, pkiMessage.getEncoded()); LOGGER.debug("general info responseBytes : " + java.util.Base64.getEncoder().encodeToString(responseBytes)); // handle the response return cryptoUtil.readGenMsgResponse(responseBytes, hmacSecret); } catch (CRMFException e) { LOGGER.info("CMS format problem", e); throw new GeneralSecurityException(e.getMessage()); } catch (CMPException e) { LOGGER.info("CMP problem", e); throw new GeneralSecurityException(e.getMessage()); } catch (IOException e) { if( LOGGER.isDebugEnabled()){ LOGGER.debug("IO / encoding problem", e); }else { LOGGER.info("IO / encoding problem: {}", e.getMessage()); } throw new GeneralSecurityException(e.getMessage()); } }- Throws:
GeneralSecurityException
-
-