Package io.skodjob.testframe.security
Class OpenSsl
java.lang.Object
io.skodjob.testframe.security.OpenSsl
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 Summary
Modifier and TypeMethodDescriptionstatic FilegenerateCertSigningRequest(File privateKey, String subject) Generates cert signing requeststatic FileGenerates private keystatic FilegeneratePrivateKey(int keyLengthBits) Generates private keystatic FilegenerateSignedCert(File csr, File caCrt, File caKey) Generates signed certstatic voidwaitForCertIsInValidDateRange(File certificate) Waits for cert is valid in current range
-
Method Details
-
generatePrivateKey
Generates private key- Returns:
- file with private key
-
generatePrivateKey
Generates private key- Parameters:
keyLengthBits- key length- Returns:
- file with private key
-
generateCertSigningRequest
Generates cert signing request- Parameters:
privateKey- file with private keysubject- subject- Returns:
- csr file
-
generateSignedCert
Generates signed cert- Parameters:
csr- csrcaCrt- ca filecaKey- ca key- Returns:
- file with signed cert
-
waitForCertIsInValidDateRange
Waits for cert is valid in current range- Parameters:
certificate- signed cert file
-