public class BcCertificateProvider extends Object implements CertificateProvider
CertificateProvider.| Constructor and Description |
|---|
BcCertificateProvider()
Creates new BcCertificateProvider.
|
| Modifier and Type | Method and Description |
|---|---|
byte[] |
base64Decode(String string) |
String |
base64Encode(byte[] bytes) |
X509Certificate |
generateCertificate(String domainName,
PublicKey publicKey,
PrivateKey privateKey,
KeyPair issuerKeys,
Instant from,
Instant to,
BigInteger serial,
String applicationUri,
String... hostNames)
Generates a new certificate using the Bouncy Castle implementation.
|
X509Certificate |
generateIssuerCert(PublicKey publicKey,
PrivateKey privateKey,
KeyPair issuerKeys,
String commonName,
BigInteger serialNr,
Instant startDate,
Instant expiryDate)
Build a X509 V3 certificate to use as an issuer (CA) certificate.
|
Collection<List<?>> |
getSubjectAlternativeNames(X509Certificate cert) |
PrivateKey |
readPrivateKey(InputStream stream,
String password,
String algorithm)
Read a private key from a PEM encoded byte array with a password.
|
void |
writePrivateKey(PrivateKey key,
OutputStream stream,
String password,
String algorithm)
Write a private key to a PEM file with a password.
|
public BcCertificateProvider()
public byte[] base64Decode(String string)
base64Decode in interface CertificateProviderpublic String base64Encode(byte[] bytes)
base64Encode in interface CertificateProviderpublic X509Certificate generateCertificate(String domainName, PublicKey publicKey, PrivateKey privateKey, KeyPair issuerKeys, Instant from, Instant to, BigInteger serial, String applicationUri, String... hostNames) throws IOException, GeneralSecurityException
generateCertificate in interface CertificateProviderIOExceptionGeneralSecurityExceptionpublic X509Certificate generateIssuerCert(PublicKey publicKey, PrivateKey privateKey, KeyPair issuerKeys, String commonName, BigInteger serialNr, Instant startDate, Instant expiryDate) throws GeneralSecurityException, IOException
generateIssuerCert in interface CertificateProviderGeneralSecurityExceptionIOExceptionpublic Collection<List<?>> getSubjectAlternativeNames(X509Certificate cert) throws CertificateParsingException
getSubjectAlternativeNames in interface CertificateProviderCertificateParsingExceptionpublic PrivateKey readPrivateKey(InputStream stream, String password, String algorithm) throws IOException
CertificateProviderRead a private key from a PEM encoded byte array with a password.
readPrivateKey in interface CertificateProviderstream - the stream (for example FileInputStream) to read from topassword - the password o use for decrypt the keyalgorithm - encryption algorithm to use. For example "AES-128-CBC"IOException - if any.public void writePrivateKey(PrivateKey key, OutputStream stream, String password, String algorithm) throws IOException
CertificateProviderWrite a private key to a PEM file with a password.
writePrivateKey in interface CertificateProviderkey - the private key to savestream - the stream (for example FileOutputStream) to save topassword - the password o use for protecting the keyalgorithm - encryption algorithm to use. For example "AES-128-CBC"IOException - if any.Copyright © 2026. All rights reserved.