Interface CertificateService


public interface CertificateService
API for PKI support.
Version:
1.0
Author:
matt
  • 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=US
      publicKey - the public key
      privateKey - 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 one
      privateKey - 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

      String generatePKCS7CertificateChainString(X509Certificate[] chain) throws CertificateException
      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

      X509Certificate[] parsePKCS7CertificateChainString(String pem) throws CertificateException
      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