All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.bouncycastle.cert.crmf.jcajce.JcaCertificateRepMessageBuilder Maven / Gradle / Ivy

Go to download

The Bouncy Castle Java APIs for CMS, PKCS, EAC, TSP, CMP, CRMF, OCSP, and certificate generation. This jar contains APIs for JDK 1.8 and up. The APIs are designed primarily to be used in conjunction with the BC LTS provider but may also be used with other providers providing cryptographic services.

There is a newer version: 2.73.7
Show newest version
package org.bouncycastle.cert.crmf.jcajce;

import java.security.cert.CertificateEncodingException;
import java.security.cert.X509Certificate;

import org.bouncycastle.cert.X509CertificateHolder;
import org.bouncycastle.cert.crmf.CertificateRepMessageBuilder;
import org.bouncycastle.cert.jcajce.JcaX509CertificateHolder;

/**
 * X509Certificate aware extension of {@link CertificateRepMessageBuilder}.
 */
public class JcaCertificateRepMessageBuilder
    extends CertificateRepMessageBuilder
{
    /**
     * Base constructor which can accept 0 or more certificates representing the CA plus its chain.
     *
     * @param caCertificates the CA public key and it's support certificates (optional)
     * @throws CertificateEncodingException if the certificates cannot be re-encoded.
     */
    public JcaCertificateRepMessageBuilder(X509Certificate... caCertificates)
        throws CertificateEncodingException
    {
        super(convert(caCertificates));
    }

    private static X509CertificateHolder[] convert(X509Certificate... certificates)
        throws CertificateEncodingException
    {
        X509CertificateHolder[] certs = new X509CertificateHolder[certificates.length];
        for (int i = 0; i != certs.length; i++)
        {
            certs[i] = new JcaX509CertificateHolder(certificates[i]);
        }

        return certs;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy