Example usage for org.bouncycastle.cert.cmp CertificateConfirmationContentBuilder build

List of usage examples for org.bouncycastle.cert.cmp CertificateConfirmationContentBuilder build

Introduction

In this page you can find the example usage for org.bouncycastle.cert.cmp CertificateConfirmationContentBuilder build.

Prototype

public CertificateConfirmationContent build(DigestCalculatorProvider digesterProvider) throws CMPException 

Source Link

Usage

From source file:org.cryptable.pki.communication.PKICMPMessages.java

License:Open Source License

/**
 * This creates a message to confirm a certification message
 *
 * @param x509Certificate the certificate to confirm
 * @return return the binary ASN.1 message to confirm certificate
 * @throws CertificateEncodingException/*w  w w  .ja  va2  s  . c  o  m*/
 * @throws IOException
 * @throws OperatorCreationException
 * @throws CMPException
 */
public byte[] createConfirmationMessage(X509Certificate x509Certificate, BigInteger certificateID)
        throws CertificateEncodingException, IOException, OperatorCreationException, CMPException,
        PKICMPMessageException {
    CertificateConfirmationContentBuilder certificateConfirmationContentBuilder = new CertificateConfirmationContentBuilder();
    X509CertificateHolder x509CertificateHolder = new X509CertificateHolder(x509Certificate.getEncoded());
    certificateConfirmationContentBuilder.addAcceptedCertificate(x509CertificateHolder, certificateID);

    return createProtectedPKIMessage(
            new PKIBody(PKIBody.TYPE_CERT_CONFIRM, certificateConfirmationContentBuilder
                    .build(new JcaDigestCalculatorProviderBuilder().build()).toASN1Structure()));
}

From source file:org.xipki.ca.client.impl.X509CmpRequestor.java

License:Open Source License

private PKIMessage buildCertConfirmRequest(ASN1OctetString tid,
        CertificateConfirmationContentBuilder certConfirmBuilder) throws CmpRequestorException {
    PKIHeader header = buildPKIHeader(implicitConfirm, tid, null, (InfoTypeAndValue[]) null);
    CertificateConfirmationContent certConfirm;
    try {//from w  ww.j a  va  2s  . c  o  m
        certConfirm = certConfirmBuilder.build(digesetCalculatorProvider);
    } catch (CMPException e) {
        throw new CmpRequestorException(e.getMessage(), e);
    }
    PKIBody body = new PKIBody(PKIBody.TYPE_CERT_CONFIRM, certConfirm.toASN1Structure());
    return new PKIMessage(header, body);
}

From source file:org.xipki.pki.ca.client.impl.X509CmpRequestor.java

License:Open Source License

private PKIMessage buildCertConfirmRequest(final ASN1OctetString tid,
        final CertificateConfirmationContentBuilder certConfirmBuilder) throws CmpRequestorException {
    PKIHeader header = buildPkiHeader(implicitConfirm, tid, null, (InfoTypeAndValue[]) null);
    CertificateConfirmationContent certConfirm;
    try {/*from   w ww .  j  a va2  s  .c  om*/
        certConfirm = certConfirmBuilder.build(DIGEST_CALCULATOR_PROVIDER);
    } catch (CMPException ex) {
        throw new CmpRequestorException(ex.getMessage(), ex);
    }
    PKIBody body = new PKIBody(PKIBody.TYPE_CERT_CONFIRM, certConfirm.toASN1Structure());
    return new PKIMessage(header, body);
}