throw new CertificateException(e);
}
}
protected CertificateResponse buildV1Certificate(final BouncyCastleCertificateRequest request) throws OperatorCreationException, GeneralSecurityException, IOException {
JcaX509v1CertificateBuilder builder = new JcaX509v1CertificateBuilder(request.getIssuerAsX500Name(), request.getSerialNumber(), request.getNotBefore(), request.getNotAfter(), request.getSubjectAsX500Name(), request.getPublicKey());
JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(request.getSignAlgorithm());
contentSignerBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
ContentSigner contentSigner = contentSignerBuilder.build(request.getPrivateKey());
X509CertificateHolder holder = builder.build(contentSigner);
X509Certificate certificate = (X509Certificate) CertificateUtils.getCertificateFromFile(holder.getEncoded(), CertificateType.X509);
PrivateKey privateKey = request.getPrivateKey();
Identity identity = new Identity(privateKey, new Certificate[] { certificate });
CertificateResponse response = new CertificateResponse(identity);