Package net.targetr.wtm3.net.tls
Class SelfSignedCertificateGenerator
java.lang.Object
net.targetr.wtm3.net.tls.SelfSignedCertificateGenerator
Generates self signed certificates for TLS.
- Author:
- Dr Michael Gardiner
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new SelfSignedCertificateGenerator. -
Method Summary
Modifier and TypeMethodDescriptionstatic GeneratedCertcreateCertificate(String commonName, String domain, GeneratedCert issuer, boolean isCA, int expryDays) Creates a new self-signed or CA-signed certificate.
-
Constructor Details
-
SelfSignedCertificateGenerator
public SelfSignedCertificateGenerator()Constructs a new SelfSignedCertificateGenerator.
-
-
Method Details
-
createCertificate
public static GeneratedCert createCertificate(String commonName, String domain, GeneratedCert issuer, boolean isCA, int expryDays) throws org.bouncycastle.cert.CertIOException, CertificateException, NoSuchAlgorithmException Creates a new self-signed or CA-signed certificate.- Parameters:
commonName- The CN={name} of the certificate. When the certificate is for a domain it should be the domain namedomain- Nullable. The DNS domain for the certificate.issuer- Issuer who signs this certificate. Null for a self-signed certificateisCA- Can this certificate be used to sign other certificatesexpryDays- Days this certificate this is valid- Returns:
- Newly created certificate with its private key
- Throws:
org.bouncycastle.cert.CertIOException- if a certificate I/O error occursCertificateException- if a certificate error occursNoSuchAlgorithmException- if a required algorithm is missing
-