Requires Bouncy Castle
. The
BouncyCastleProvider
must be added as security
provider.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a domain name to the CSR.void
addDomains
(String... domains) Adds multiple domain names.void
addDomains
(Collection<String> domains) Adds aCollection
of domains.void
Adds anIdentifier
.void
Adds aCollection
ofIdentifier
.void
addIdentifiers
(Identifier... ids) Adds multipleIdentifier
.void
addIP
(InetAddress address) Adds anInetAddress
.void
addIPs
(InetAddress... ips) Adds multiple IP addresses.void
addIPs
(Collection<InetAddress> ips) Adds aCollection
of IP addresses.void
Sets an entry of the subject used for the CSR.void
Sets an entry of the subject used for the CSR.org.bouncycastle.pkcs.PKCS10CertificationRequest
getCSR()
Gets the PKCS#10 certification request.byte[]
Gets an encoded PKCS#10 certification request.void
setCommonName
(String cn) Sets the common name.void
setCountry
(String c) Sets the country.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 CSR.toString()
void
write
(OutputStream out) Writes the signed certificate request to anOutputStream
.void
Writes the signed certificate request to aWriter
.
-
Constructor Details
-
CSRBuilder
public CSRBuilder()
-
-
Method Details
-
addDomain
Adds a domain name to the CSR. All domain names will be added as Subject Alternative Name.IDN domain names are ACE encoded automatically.
For wildcard certificates, the domain name must be prefixed with
"*."
.- Parameters:
domain
- Domain name to add
-
addDomains
Adds aCollection
of domains.IDN domain names are ACE encoded automatically.
- Parameters:
domains
- Collection of domain names to add
-
addDomains
Adds multiple domain names.IDN domain names are ACE encoded automatically.
- Parameters:
domains
- Domain names to add
-
addIP
Adds anInetAddress
. All IP addresses will be set as iPAddress Subject Alternative Name.- Parameters:
address
-InetAddress
to add- Since:
- 2.4
-
addIPs
Adds aCollection
of IP addresses.- Parameters:
ips
- Collection of IP addresses to add- Since:
- 2.4
-
addIPs
Adds multiple IP addresses.- Parameters:
ips
- IP addresses to add- Since:
- 2.4
-
addIdentifier
Adds anIdentifier
. Only DNS and IP types are supported.- Parameters:
id
-Identifier
to add- Since:
- 2.7
-
addIdentifiers
Adds aCollection
ofIdentifier
.- Parameters:
ids
- Collection of Identifiers to add- Since:
- 2.7
-
addIdentifiers
Adds multipleIdentifier
.- Parameters:
ids
- Identifiers to add- Since:
- 2.7
-
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- Since:
- 2.14
-
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:
oid
- The OID of the attribute to be addedvalue
- The value- Since:
- 2.14
-
setCommonName
Sets the common name.Note that it is at the discretion of the ACME server to accept this parameter.
- Since:
- 3.2.0
-
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.
-
sign
Signs the completed 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
-