Search in sources :

Example 1 with RevokeCertRequest

use of org.xipki.ca.client.api.dto.RevokeCertRequest in project xipki by xipki.

the class CaClientImpl method revokeCert.

private CertIdOrError revokeCert(CaConf ca, BigInteger serial, int reason, Date invalidityDate, RequestResponseDebug debug) throws CaClientException, PkiErrorException {
    ParamUtil.requireNonNull("ca", ca);
    ParamUtil.requireNonNull("serial", serial);
    final String id = "cert-1";
    RevokeCertRequestEntry entry = new RevokeCertRequestEntry(id, ca.getSubject(), serial, reason, invalidityDate);
    if (ca.getCmpControl().isRrAkiRequired()) {
        entry.setAuthorityKeyIdentifier(ca.getSubjectKeyIdentifier());
    }
    RevokeCertRequest request = new RevokeCertRequest();
    request.addRequestEntry(entry);
    Map<String, CertIdOrError> result = revokeCerts(request, debug);
    return (result == null) ? null : result.get(id);
}
Also used : RevokeCertRequestEntry(org.xipki.ca.client.api.dto.RevokeCertRequestEntry) CertIdOrError(org.xipki.ca.client.api.CertIdOrError) RevokeCertRequest(org.xipki.ca.client.api.dto.RevokeCertRequest)

Example 2 with RevokeCertRequest

use of org.xipki.ca.client.api.dto.RevokeCertRequest in project xipki by xipki.

the class CaClientImpl method envelopeRevocation.

// method verify
@Override
public byte[] envelopeRevocation(X500Name issuer, BigInteger serial, int reason) throws CaClientException {
    ParamUtil.requireNonNull("issuer", issuer);
    init0(false);
    final String id = "cert-1";
    RevokeCertRequestEntry entry = new RevokeCertRequestEntry(id, issuer, serial, reason, null);
    RevokeCertRequest request = new RevokeCertRequest();
    request.addRequestEntry(entry);
    String caName = getCaNameByIssuer(issuer);
    X509CmpRequestor cmpRequestor = casMap.get(caName).getRequestor();
    try {
        PKIMessage pkiMessage = cmpRequestor.envelopeRevocation(request);
        return pkiMessage.getEncoded();
    } catch (CmpRequestorException | IOException ex) {
        throw new CaClientException(ex.getMessage(), ex);
    }
}
Also used : PKIMessage(org.bouncycastle.asn1.cmp.PKIMessage) RevokeCertRequestEntry(org.xipki.ca.client.api.dto.RevokeCertRequestEntry) IOException(java.io.IOException) RevokeCertRequest(org.xipki.ca.client.api.dto.RevokeCertRequest) CaClientException(org.xipki.ca.client.api.CaClientException)

Aggregations

RevokeCertRequest (org.xipki.ca.client.api.dto.RevokeCertRequest)2 RevokeCertRequestEntry (org.xipki.ca.client.api.dto.RevokeCertRequestEntry)2 IOException (java.io.IOException)1 PKIMessage (org.bouncycastle.asn1.cmp.PKIMessage)1 CaClientException (org.xipki.ca.client.api.CaClientException)1 CertIdOrError (org.xipki.ca.client.api.CertIdOrError)1