java.lang.Object
org.cryptomator.cryptolib.common.X509CertBuilder
-
Method Summary
Modifier and TypeMethodDescriptionbuild()Creates a self-signed X509Certificate containing the public key and signed with the private key of a given key pair.withIssuer(String issuer) Sets the certificate's issuerwithNotAfter(Instant notAfter) Sets the certificate's end of validity periodwithNotBefore(Instant notBefore) Sets the certificate's begin of validity periodwithSubject(String subject) Sets the certificate's subject
-
Method Details
-
withIssuer
Sets the certificate's issuer- Parameters:
issuer- DistinguishedName as defined in RFC 4514, e.g.CN=Issuer- Returns:
this- See Also:
-
withSubject
Sets the certificate's subject- Parameters:
subject- DistinguishedName as defined in RFC 4514, e.g.CN=Subject- Returns:
this- See Also:
-
withNotBefore
Sets the certificate's begin of validity period- Parameters:
notBefore- date before which the certificate is not valid.- Returns:
this
-
withNotAfter
Sets the certificate's end of validity period- Parameters:
notAfter- date after which the certificate is not valid.- Returns:
this
-
build
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
-