- java.lang.Object
-
- org.cryptomator.cryptolib.common.X509CertBuilder
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description X509Certificatebuild()Creates a self-signed X509Certificate containing the public key and signed with the private key of a given key pair.X509CertBuilderwithIssuer(String issuer)Sets the certificate's issuerX509CertBuilderwithNotAfter(Instant notAfter)Sets the certificate's end of validity periodX509CertBuilderwithNotBefore(Instant notBefore)Sets the certificate's begin of validity periodX509CertBuilderwithSubject(String subject)Sets the certificate's subject
-
-
-
Method Detail
-
withIssuer
public X509CertBuilder withIssuer(String issuer)
Sets the certificate's issuer- Parameters:
issuer- DistinguishedName as defined in RFC 4514, e.g.CN=Issuer- Returns:
this- See Also:
- RFC 4514, Examples
-
withSubject
public X509CertBuilder withSubject(String subject)
Sets the certificate's subject- Parameters:
subject- DistinguishedName as defined in RFC 4514, e.g.CN=Subject- Returns:
this- See Also:
- RFC 4514, Examples
-
withNotBefore
public X509CertBuilder withNotBefore(Instant notBefore)
Sets the certificate's begin of validity period- Parameters:
notBefore- date before which the certificate is not valid.- Returns:
this
-
withNotAfter
public X509CertBuilder withNotAfter(Instant notAfter)
Sets the certificate's end of validity period- Parameters:
notAfter- date after which the certificate is not valid.- Returns:
this
-
build
public X509Certificate build() throws CertificateException, IllegalStateException
Creates a self-signed X509Certificate containing the public key and signed with the private key of a given key pair.- Returns:
- A self-signed X509Certificate
- Throws:
CertificateException- If certificate generation failed, e.g. due to invalid parametersIllegalStateException- If one or more required parameters have not been set yet
-
-