public class X509v3CertificateBuilder extends Object
| Constructor and Description |
|---|
X509v3CertificateBuilder(X500Name issuer,
BigInteger serial,
Date notBefore,
Date notAfter,
X500Name subject,
SubjectPublicKeyInfo publicKeyInfo)
Create a builder for a version 3 certificate.
|
| Modifier and Type | Method and Description |
|---|---|
X509v3CertificateBuilder |
addExtension(ASN1ObjectIdentifier oid,
boolean isCritical,
ASN1Encodable value)
Add a given extension field for the standard extensions tag (tag 3)
|
X509Certificate |
build(PrivateKey key,
AlgorithmIdentifier sigAlg,
String sigAlgName,
String provider,
SecureRandom random)
Generate the certificate, signing it with the provided private key and
using the specified algorithm.
|
static AlgorithmIdentifier |
extractAlgorithmId(X509Certificate cert)
Extracts the full algorithm identifier from the given certificate.
|
public X509v3CertificateBuilder(X500Name issuer, BigInteger serial, Date notBefore, Date notAfter, X500Name subject, SubjectPublicKeyInfo publicKeyInfo)
issuer - the certificate issuerserial - the certificate serial numbernotBefore - the date before which the certificate is not validnotAfter - the date after which the certificate is not validsubject - the certificate subjectpublicKeyInfo - the info structure for the public key to be associated
with this certificate.public X509v3CertificateBuilder addExtension(ASN1ObjectIdentifier oid, boolean isCritical, ASN1Encodable value)
oid - the OID defining the extension type.isCritical - true if the extension is critical, false otherwise.value - the ASN.1 structure that forms the extension's value.public X509Certificate build(PrivateKey key, AlgorithmIdentifier sigAlg, String sigAlgName, String provider, SecureRandom random) throws InvalidKeyException, CertificateParsingException, NoSuchProviderException, NoSuchAlgorithmException, SignatureException, IOException
key - to be used for signingsigAlg - oid and paramters of the signature algsigAlgName - name of the signature algprovider - can be null -> default will be usedrandom - can be null -> default will be usedInvalidKeyExceptionCertificateParsingExceptionNoSuchProviderExceptionNoSuchAlgorithmExceptionSignatureExceptionIOExceptionpublic static AlgorithmIdentifier extractAlgorithmId(X509Certificate cert) throws IOException
cert - input certificateIOException - if parameters of the algorithm can not be parsedCopyright © 2012-2014 European Middleware Initiative. All Rights Reserved.