Package net.solarnetwork.service
Interface CertificateService
public interface CertificateService
API for PKI support.
- Version:
- 1.0
- Author:
- matt
-
Method Summary
Modifier and TypeMethodDescriptiongenerateCertificate(String dn, PublicKey publicKey, PrivateKey privateKey) Generate a new, self-signed certificate using the provided DN and keys.generatePKCS10CertificateRequestString(X509Certificate cert, PrivateKey privateKey) Generate a certificate request for a given certificate, public key, and private key, formatted as a Base64-encoded request string (PEM).Generate a certificate chain formatted as a Base64-encoded PKCS#7 string (PEM).Parse a PKCS#7 certificate chain, formatted as a Base64-encoded request string (PEM).
-
Method Details
-
generateCertificate
X509Certificate generateCertificate(String dn, PublicKey publicKey, PrivateKey privateKey) throws CertificateException Generate a new, self-signed certificate using the provided DN and keys.- Parameters:
dn- the DN for the certificate, e.g.CN=John Doe, OU=Accounting, O=Big Organization, C=USpublicKey- the public keyprivateKey- the private key- Returns:
- the certificate
- Throws:
CertificateException- if any error occurs
-
generatePKCS10CertificateRequestString
String generatePKCS10CertificateRequestString(X509Certificate cert, PrivateKey privateKey) throws CertificateException Generate a certificate request for a given certificate, public key, and private key, formatted as a Base64-encoded request string (PEM).- Parameters:
cert- the certificate to generate a CSR for, presumably a self-signed oneprivateKey- the private key to sign the request with- Returns:
- the request, as a Base64-encoded PKCS#10 request
- Throws:
CertificateException- if any error occurs
-
generatePKCS7CertificateChainString
Generate a certificate chain formatted as a Base64-encoded PKCS#7 string (PEM).- Parameters:
chain- the certificates to generate a PKCS#7 for- Returns:
- the certificate, as a Base64-encoded PKCS#7 request
- Throws:
CertificateException- if any error occurs
-
parsePKCS7CertificateChainString
Parse a PKCS#7 certificate chain, formatted as a Base64-encoded request string (PEM).- Parameters:
pem- the PEM-encoded certificate chain- Returns:
- the certificates
- Throws:
CertificateException- if any error occurs
-