Class CryptoCAService

java.lang.Object
com.eurodyn.qlack.fuse.crypto.service.CryptoCAService

@Service @Validated public class CryptoCAService extends Object
Certificate Authority management.
  • Constructor Details

  • Method Details

    • createCA

      public CPPPemHolderDTO createCA(CreateCADTO createCADTO) throws NoSuchAlgorithmException, InvalidKeySpecException, org.bouncycastle.operator.OperatorCreationException, IOException, NoSuchProviderException
      Create a new Certificate Authority. This method also supports creating a sub-CA by providing the issuer's information.
      Parameters:
      createCADTO - the details of the CA to be created
      Returns:
      the generated certificate
      Throws:
      NoSuchAlgorithmException - thrown when no algorithm is found for encryption
      InvalidKeySpecException - thrown when the provided key is invalid
      org.bouncycastle.operator.OperatorCreationException - thrown when something unexpected happens during the encryption
      IOException - thrown when something unexpected happens
      NoSuchProviderException
    • generateCertificate

      public org.bouncycastle.cert.X509CertificateHolder generateCertificate(CertificateSignDTO certificateSignDTO) throws org.bouncycastle.operator.OperatorCreationException, org.bouncycastle.cert.CertIOException
      Signs a key with another key providing a certificate.
      Parameters:
      certificateSignDTO - the details of the signing to take place
      Returns:
      the generated signature
      Throws:
      org.bouncycastle.operator.OperatorCreationException - thrown when something unexpected happens during the encryption
      org.bouncycastle.cert.CertIOException - thrown when something unexpected happens while generating the certificate
    • certificateToPEM

      public String certificateToPEM(org.bouncycastle.cert.X509CertificateHolder certificateHolder) throws IOException
      Converts a certificate to a PEM format encoded as X.509.
      Parameters:
      certificateHolder - the certificate to convert
      Returns:
      the generated PEM
      Throws:
      IOException - thrown when something unexpected happens
    • pemToCertificate

      public X509Certificate pemToCertificate(String cert) throws CertificateException
      Parses a certificate in PEM format encoded as X.509.
      Parameters:
      cert - the certificate in PEM format
      Returns:
      the generated certificate
      Throws:
      CertificateException - thrown when something unexpected happens while generating the certificate