Class OpenSsl

java.lang.Object
io.skodjob.testframe.security.OpenSsl

public class OpenSsl extends Object
The `OpenSsl` class encapsulates OpenSSL command execution using the OpenSSLCommand object, which interfaces with the command-line version of OpenSSL. It serves as a versatile tool for various OpenSSL operations, primarily focusing on the creation of private keys, the generation of certificate signing requests (CSRs), and the signing of these CSRs using a certificate authority (CA). The primary use case for this class is to facilitate the simulation of externally provided client certificates, offering a seamless solution for integrating secure authentication mechanisms into your application.
  • Method Details

    • generatePrivateKey

      public static File generatePrivateKey()
      Generates private key
      Returns:
      file with private key
    • generatePrivateKey

      public static File generatePrivateKey(int keyLengthBits)
      Generates private key
      Parameters:
      keyLengthBits - key length
      Returns:
      file with private key
    • generateCertSigningRequest

      public static File generateCertSigningRequest(File privateKey, String subject)
      Generates cert signing request
      Parameters:
      privateKey - file with private key
      subject - subject
      Returns:
      csr file
    • generateSignedCert

      public static File generateSignedCert(File csr, File caCrt, File caKey)
      Generates signed cert
      Parameters:
      csr - csr
      caCrt - ca file
      caKey - ca key
      Returns:
      file with signed cert
    • waitForCertIsInValidDateRange

      public static void waitForCertIsInValidDateRange(File certificate)
      Waits for cert is valid in current range
      Parameters:
      certificate - signed cert file