Search in sources :

Example 26 with CertificationRequest

use of com.github.zhenwei.core.asn1.pkcs.CertificationRequest in project interlok by adaptris.

the class CertRequestHandler method createRequest.

/**
 * Create a CertificateRequest based on the provided certificate and write it
 * to the supplied outputStream.
 * <p>
 * The default implementation writes out the request as a DER encoded ASN.1
 * data structure
 *
 * @param c the certificate
 * @param out the OutputStream to write to
 * @param key the Private key
 * @throws AdaptrisSecurityException if any error occurs
 * @see AdaptrisSecurityException
 */
public static void createRequest(Certificate c, PrivateKey key, OutputStream out) throws AdaptrisSecurityException {
    try {
        CertificationRequest req = createCertRequest(c, key);
        out.write(req.getEncoded());
    } catch (Exception e) {
        throw new CertException(e);
    }
}
Also used : CertException(com.adaptris.security.exc.CertException) PKCS10CertificationRequest(org.bouncycastle.pkcs.PKCS10CertificationRequest) CertificationRequest(org.bouncycastle.asn1.pkcs.CertificationRequest) CertException(com.adaptris.security.exc.CertException) AdaptrisSecurityException(com.adaptris.security.exc.AdaptrisSecurityException)

Aggregations

CertificationRequest (org.bouncycastle.asn1.pkcs.CertificationRequest)24 X500Name (org.bouncycastle.asn1.x500.X500Name)12 X509Certificate (java.security.cert.X509Certificate)9 Date (java.util.Date)9 BigInteger (java.math.BigInteger)8 CertificationRequestInfo (org.bouncycastle.asn1.pkcs.CertificationRequestInfo)8 X509Cert (org.xipki.security.X509Cert)8 Extensions (org.bouncycastle.asn1.x509.Extensions)7 File (java.io.File)5 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)5 PrivateKey (java.security.PrivateKey)5 SubjectPublicKeyInfo (org.bouncycastle.asn1.x509.SubjectPublicKeyInfo)5 OperationException (org.xipki.ca.api.OperationException)5 IOException (java.io.IOException)4 CertificateException (java.security.cert.CertificateException)4 ASN1ObjectIdentifier (org.bouncycastle.asn1.ASN1ObjectIdentifier)4 ContentInfo (org.bouncycastle.asn1.cms.ContentInfo)4 IssuerAndSerialNumber (org.bouncycastle.asn1.cms.IssuerAndSerialNumber)4 EnrolmentResponse (org.xipki.scep.client.EnrolmentResponse)4 ScepClient (org.xipki.scep.client.ScepClient)4