public class CertificateHelper extends Object
| Constructor and Description |
|---|
CertificateHelper() |
| Modifier and Type | Method and Description |
|---|---|
X509Certificate |
fromBytes(byte[] certificateBytes)
This will decode an X.509 Certificate object from its bytes.
|
X509Certificate |
fromPem(String pemString)
This will decode a X.509 Certificate from a PEM string.
|
X509Certificate |
generate(CertificateSubject subject,
CertificateIssuer issuer,
int daysValid)
Generate a new certificate with teh given subject, issuer and lifespan.
|
X509Certificate |
generate(PublicKey subjectKey,
String subjectName,
String subjectOrganization,
String subjectCountry,
PrivateKey issuerKey,
String issuerName,
String issuerOrganization,
String issuerCountry,
int daysValid)
Generate a new certificate with teh given subject data, issuer data and lifespan.
|
String |
toPem(X509Certificate certificate)
This will convert the X.509 Certificate into a PEM string.
|
public X509Certificate generate(CertificateSubject subject, CertificateIssuer issuer, int daysValid)
subject - the subject of the certificateissuer - the issuer of the certificatedaysValid - the number of days the certificate will be validpublic X509Certificate generate(PublicKey subjectKey, String subjectName, String subjectOrganization, String subjectCountry, PrivateKey issuerKey, String issuerName, String issuerOrganization, String issuerCountry, int daysValid)
subjectKey - the subject key of the certificatesubjectName - the subject name of the certificatesubjectOrganization - the subject organization of the certificatesubjectCountry - the subject country of the certificateissuerKey - the issuer key of the certificateissuerName - the issuer name of the certificateissuerOrganization - the issuer organization of the certificateissuerCountry - the issuer country of the certificatedaysValid - the number of days the certificate will be validpublic String toPem(X509Certificate certificate) throws IOException, CertificateEncodingException
certificate - the certificate to convertIOException - thrown if there are issues converting the certificateCertificateEncodingException - thrown if there are issues converting the certificatepublic X509Certificate fromPem(String pemString) throws IOException, CertificateException
pemString - the PEM representation of the X.509 CertificateIOException - thrown if there are issues converting the certificateCertificateEncodingException - thrown if there are issues converting the certificateCertificateExceptionpublic X509Certificate fromBytes(byte[] certificateBytes) throws CertificateException
certificateBytes - the X.509 Certificate bytesCertificateEncodingException - thrown if there are issues converting the certificateCertificateExceptionCopyright © 2021. All rights reserved.