if (request.isCa()) {
AuthorityKeyIdentifier authorityKeyIdentifier = new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(request.getIssuerCertificate().getPublicKey());
builder.addExtension(X509Extension.authorityKeyIdentifier, false, authorityKeyIdentifier);
}
SubjectKeyIdentifier subjectKeyIdentifier = new JcaX509ExtensionUtils().createSubjectKeyIdentifier(request.getIssuerCertificate().getPublicKey());
builder.addExtension(X509Extension.subjectKeyIdentifier, false, subjectKeyIdentifier);
contentSigner = contentSignerBuilder.build(request.getIssuerPrivateKey());
} else {
builder = new JcaX509v3CertificateBuilder(request.getIssuerAsX500Name(), request.getSerialNumber(), request.getNotBefore(), request.getNotAfter(), request.getSubjectAsX500Name(), request.getPublicKey());
SubjectKeyIdentifier subjectKeyIdentifier = new JcaX509ExtensionUtils().createSubjectKeyIdentifier(request.getPublicKey());
builder.addExtension(X509Extension.subjectKeyIdentifier, false, subjectKeyIdentifier);
contentSigner = contentSignerBuilder.build(request.getPrivateKey());
}