public final class X509CertificateBuilder extends Object
Constructor and Description |
---|
X509CertificateBuilder()
Construct a new uninitialized instance.
|
Modifier and Type | Method and Description |
---|---|
X509CertificateBuilder |
addExtension(X509CertificateExtension extension)
Add a certificate extension.
|
X509CertificateExtension |
addOrReplaceExtension(X509CertificateExtension extension)
Add or replace a certificate extension.
|
X509Certificate |
build()
Attempt to construct and sign an X.509 certificate according to the information in this builder.
|
X500Principal |
getIssuerDn()
Get the issuer DN.
|
byte[] |
getIssuerUniqueId()
Get the issuer unique ID.
|
ZonedDateTime |
getNotValidAfter()
Get the not-valid-after date.
|
ZonedDateTime |
getNotValidBefore()
Get the not-valid-before date.
|
PublicKey |
getPublicKey()
Get the public key.
|
BigInteger |
getSerialNumber()
Get the serial number of the certificate being built.
|
String |
getSignatureAlgorithmName()
Get the signature algorithm name.
|
PrivateKey |
getSigningKey()
Get the signing key.
|
X500Principal |
getSubjectDn()
Get the subject DN.
|
byte[] |
getSubjectUniqueId()
Get the subject unique ID.
|
int |
getVersion()
Get the certificate version.
|
X509CertificateExtension |
removeExtension(String oid)
Remove the extension with the given OID, if it is registered.
|
X509CertificateBuilder |
setIssuerDn(X500Principal issuerDn)
Set the issuer DN.
|
X509CertificateBuilder |
setIssuerUniqueId(byte[] issuerUniqueId)
Set the issuer unique ID.
|
X509CertificateBuilder |
setNotValidAfter(ZonedDateTime notValidAfter)
Set the not-valid-after date.
|
X509CertificateBuilder |
setNotValidBefore(ZonedDateTime notValidBefore)
Set the not-valid-before date.
|
X509CertificateBuilder |
setPublicKey(PublicKey publicKey)
Set the public key.
|
X509CertificateBuilder |
setSerialNumber(BigInteger serialNumber)
Set the serial number of the certificate being built.
|
X509CertificateBuilder |
setSignatureAlgorithmName(String signatureAlgorithmName)
Set the signature algorithm name.
|
X509CertificateBuilder |
setSigningKey(PrivateKey signingKey)
Set the signing key.
|
X509CertificateBuilder |
setSubjectDn(X500Principal subjectDn)
Set the subject DN.
|
X509CertificateBuilder |
setSubjectUniqueId(byte[] subjectUniqueId)
Set the subject unique ID.
|
X509CertificateBuilder |
setVersion(int version)
Set the certificate version.
|
public X509CertificateBuilder()
public X509CertificateBuilder addExtension(X509CertificateExtension extension)
extension
- the extension to add (must not be null
)public X509CertificateExtension addOrReplaceExtension(X509CertificateExtension extension)
extension
- the extension to add (must not be null
)null
if no other extension with the same OID was existentpublic X509CertificateExtension removeExtension(String oid)
oid
- the OID of the extension to removenull
if no extension with the same OID was existentpublic int getVersion()
public X509CertificateBuilder setVersion(int version)
version
- the certificate version (must be between 1 and 3, inclusive)public BigInteger getSerialNumber()
null
)public X509CertificateBuilder setSerialNumber(BigInteger serialNumber)
serialNumber
- the serial number of the certificate being builtpublic X500Principal getSubjectDn()
public X509CertificateBuilder setSubjectDn(X500Principal subjectDn)
subjectDn
- the subject DN (must not be null
)public byte[] getSubjectUniqueId()
public X509CertificateBuilder setSubjectUniqueId(byte[] subjectUniqueId)
subjectUniqueId
- the subject unique ID (must not be null
)public X500Principal getIssuerDn()
public X509CertificateBuilder setIssuerDn(X500Principal issuerDn)
issuerDn
- the issuer DN (must not be null
)public byte[] getIssuerUniqueId()
public X509CertificateBuilder setIssuerUniqueId(byte[] issuerUniqueId)
issuerUniqueId
- the issuer unique ID (must not be null
)public ZonedDateTime getNotValidBefore()
public X509CertificateBuilder setNotValidBefore(ZonedDateTime notValidBefore)
notValidBefore
- the not-valid-before date (must not be null
)public ZonedDateTime getNotValidAfter()
99991231235959Z
as specified in RFC 5280
.public X509CertificateBuilder setNotValidAfter(ZonedDateTime notValidAfter)
notValidAfter
- the not-valid-after date (must not be null
)public PublicKey getPublicKey()
public X509CertificateBuilder setPublicKey(PublicKey publicKey)
publicKey
- the public key (must not be null
)public PrivateKey getSigningKey()
public X509CertificateBuilder setSigningKey(PrivateKey signingKey)
signingKey
- the signing key (must not be null
)public String getSignatureAlgorithmName()
public X509CertificateBuilder setSignatureAlgorithmName(String signatureAlgorithmName)
signatureAlgorithmName
- the signature algorithm name (must not be null
)public X509Certificate build() throws CertificateException
IllegalArgumentException
- if one or more of the builder parameters are invalid or missingCertificateException
- if the certificate failed to be constructedCopyright © 2020 JBoss by Red Hat. All rights reserved.