Requires Bouncy Castle
. The BouncyCastleProvider
must also be added as security provider.
A javax.mail
implementation must be present in the classpath.
- Since:
- 2.12
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addEmail
(jakarta.mail.internet.InternetAddress email) Adds anInternetAddress
.void
addEmails
(jakarta.mail.internet.InternetAddress... emails) Adds multipleInternetAddress
.void
addEmails
(Collection<jakarta.mail.internet.InternetAddress> emails) Adds multipleInternetAddress
.void
Adds an emailIdentifier
.void
Adds aCollection
of emailIdentifier
.void
addIdentifiers
(Identifier... ids) Adds multiple emailIdentifier
.void
Sets an entry of the subject used for the CSR.void
Sets an entry of the subject used for the CSRorg.bouncycastle.pkcs.PKCS10CertificationRequest
getCSR()
Gets the PKCS#10 certification request.byte[]
Gets an encoded PKCS#10 certification request.void
setCountry
(String c) Sets the country.void
setKeyUsageType
(KeyUsageType keyUsageType) Sets the key usage type for S/MIME certificates.void
Sets the city or locality.void
Sets the organization.void
Sets the organizational unit.void
Sets the state or province.void
Signs the completed S/MIME CSR.toString()
void
write
(OutputStream out) Writes the signed certificate request to anOutputStream
.void
Writes the signed certificate request to aWriter
.
-
Constructor Details
-
SMIMECSRBuilder
public SMIMECSRBuilder()
-
-
Method Details
-
addEmail
Adds anInternetAddress
. The first address is also used as CN.- Parameters:
email
-InternetAddress
to add
-
addEmails
Adds multipleInternetAddress
.- Parameters:
emails
- Collection ofInternetAddress
to add
-
addEmails
Adds multipleInternetAddress
.- Parameters:
emails
-InternetAddress
to add
-
addIdentifier
Adds an emailIdentifier
.- Parameters:
id
-Identifier
to add
-
addIdentifiers
Adds aCollection
of emailIdentifier
.- Parameters:
ids
- Collection of Identifier to add
-
addIdentifiers
Adds multiple emailIdentifier
.- Parameters:
ids
- Identifier to add
-
addValue
Sets an entry of the subject used for the CSR.This method is meant as "expert mode" for setting attributes that are not covered by the other methods. It is at the discretion of the ACME server to accept this parameter.
- Parameters:
attName
- The BCStyle attribute namevalue
- The value- Throws:
jakarta.mail.internet.AddressException
- if a common name is added, but the value is not a valid email address.- Since:
- 2.14
-
addValue
public void addValue(org.bouncycastle.asn1.ASN1ObjectIdentifier oid, String value) throws jakarta.mail.internet.AddressException Sets an entry of the subject used for the CSRThis method is meant as "expert mode" for setting attributes that are not covered by the other methods. It is at the discretion of the ACME server to accept this parameter.
- Parameters:
oid
- The OID of the attribute to be addedvalue
- The value- Throws:
jakarta.mail.internet.AddressException
- if a common name is added, but the value is not a valid email address.- Since:
- 2.14
-
setOrganization
Sets the organization.Note that it is at the discretion of the ACME server to accept this parameter.
-
setOrganizationalUnit
Sets the organizational unit.Note that it is at the discretion of the ACME server to accept this parameter.
-
setLocality
Sets the city or locality.Note that it is at the discretion of the ACME server to accept this parameter.
-
setState
Sets the state or province.Note that it is at the discretion of the ACME server to accept this parameter.
-
setCountry
Sets the country.Note that it is at the discretion of the ACME server to accept this parameter.
-
setKeyUsageType
Sets the key usage type for S/MIME certificates.By default, the S/MIME certificate will be suitable for both signing and encryption.
-
sign
Signs the completed S/MIME CSR.- Parameters:
keypair
-KeyPair
to sign the CSR with- Throws:
IOException
-
getCSR
Gets the PKCS#10 certification request. -
getEncoded
Gets an encoded PKCS#10 certification request.- Throws:
IOException
-
write
Writes the signed certificate request to aWriter
.- Parameters:
w
-Writer
to write the PEM file to. TheWriter
is closed after use.- Throws:
IOException
-
write
Writes the signed certificate request to anOutputStream
.- Parameters:
out
-OutputStream
to write the PEM file to. TheOutputStream
is closed after use.- Throws:
IOException
-
toString
-