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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddEmail(jakarta.mail.internet.InternetAddress email) Adds anInternetAddress.voidaddEmails(jakarta.mail.internet.InternetAddress... emails) Adds multipleInternetAddress.voidaddEmails(Collection<jakarta.mail.internet.InternetAddress> emails) Adds multipleInternetAddress.voidAdds an emailIdentifier.voidAdds aCollectionof emailIdentifier.voidaddIdentifiers(Identifier... ids) Adds multiple emailIdentifier.voidSets an entry of the subject used for the CSR.voidSets an entry of the subject used for the CSRorg.bouncycastle.pkcs.PKCS10CertificationRequestgetCSR()Gets the PKCS#10 certification request.byte[]Gets an encoded PKCS#10 certification request.voidsetCountry(String c) Sets the country.voidsetKeyUsageType(KeyUsageType keyUsageType) Sets the key usage type for S/MIME certificates.voidSets the city or locality.voidSets the organization.voidSets the organizational unit.voidSets the state or province.voidSigns the completed S/MIME CSR.toString()voidwrite(OutputStream out) Writes the signed certificate request to anOutputStream.voidWrites 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-InternetAddressto add
-
addEmails
Adds multipleInternetAddress.- Parameters:
emails- Collection ofInternetAddressto add
-
addEmails
Adds multipleInternetAddress.- Parameters:
emails-InternetAddressto add
-
addIdentifier
Adds an emailIdentifier.- Parameters:
id-Identifierto add
-
addIdentifiers
Adds aCollectionof 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-KeyPairto 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-Writerto write the PEM file to. TheWriteris closed after use.- Throws:
IOException
-
write
Writes the signed certificate request to anOutputStream.- Parameters:
out-OutputStreamto write the PEM file to. TheOutputStreamis closed after use.- Throws:
IOException
-
toString
-