feat: Update tests and further streamline Bash version with Pyton and Go.
/ test-bash (push) Successful in 24s
/ test-python (push) Successful in 1m12s
/ test-go (push) Successful in 10m3s

This commit is contained in:
2026-05-10 18:39:34 +02:00
parent 87e3933f0c
commit b28354e41c
2 changed files with 21 additions and 19 deletions
+6 -6
View File
@@ -73,21 +73,21 @@ run_flow() {
echo
echo "--- [$NAME] Standalone CA ---"
clean_up_test_dir
$MAKE_CA_CMD "$CA_DIR" "Test CA"
$MAKE_CA_CMD --ca-dir "$CA_DIR" "Test CA"
display_certificate "$CA_DIR/ca_cert.pem"
$MAKE_CERT_CMD --ca-dir "$CA_DIR" "$CERT_DIR" "test" "test.example.com" "127.0.0.1"
$MAKE_CERT_CMD --ca-dir "$CA_DIR" --cert-dir "$CERT_DIR" "test" "test.example.com" "127.0.0.1"
display_certificate "$CERT_DIR/test_cert.pem"
echo
echo "--- [$NAME] Two-level CA ---"
clean_up_test_dir
$MAKE_CA_CMD "$CA_DIR" "Test Two Level CA"
$MAKE_CA_CMD --ca-dir "$CA_DIR" "Test Two Level CA"
display_certificate "$CA_DIR/ca_cert.pem"
$MAKE_CA_CMD --issuing-ca "issuing_ca" "$CA_DIR" "Issuing CA"
$MAKE_CA_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" "Issuing CA"
display_certificate "$CA_DIR/issuing_ca_cert.pem"
$MAKE_CERT_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" "$CERT_DIR" "test" "test.example.com" "127.0.0.1"
$MAKE_CERT_CMD --ca-dir "$CA_DIR" --cert-dir "$CERT_DIR" --issuing-ca "issuing_ca" "test" "test.example.com" "127.0.0.1"
display_certificate "$CERT_DIR/test_cert.pem"
$MAKE_PFX_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" --path "$CERT_DIR/test_cert.pem" --password "s3cr3t"
$MAKE_PFX_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" --password "s3cr3t" "$CERT_DIR/test_cert.pem"
echo -e "\nVerifying contents of generated PKCS#12 (PFX) file ($CERT_DIR/test.pfx):"
openssl pkcs12 -in "$CERT_DIR/test.pfx" -noout -info -password pass:"s3cr3t"
+15 -13
View File
@@ -199,7 +199,8 @@ function _is_dns() {
function make_cert() {
local CA_FILE_PREFIX="ca" # Default to CA if no issuing CA is used
local CERT_DAYS=365 # Default validity period for leaf certificates
local CA_DIR="" # The CA directory will default to certificate directory if not specified with --ca-dir
local CA_DIR=""
local CERT_DIR=""
while [[ $# -gt 0 ]]; do
case "$1" in
@@ -211,6 +212,14 @@ function make_cert() {
CA_DIR="$2"
shift 2
;;
--cert-dir)
if [[ -z "$2" ]]; then
echo "ERROR: Missing value for --cert-dir." >&2
return 1
fi
CERT_DIR="$2"
shift 2
;;
--issuing-ca)
if [[ -z "$2" ]]; then
echo "ERROR: Missing value for --issuing-ca." >&2
@@ -235,9 +244,8 @@ function make_cert() {
esac
done
local CERT_DIR="$1"
local CERT_SUBJECT_NAME="$2"
shift 2
local CERT_SUBJECT_NAME="$1"
shift 1
CA_DIR="${CA_DIR:-${SIMPLE_CA_DIR:-$(pwd)}}"
@@ -334,7 +342,6 @@ function make_cert() {
function make_pfx() {
local CA_DIR=""
local CA_FILE_PREFIX=""
local CERT_PATH=""
local PFX_PASSWORD=""
while [[ $# -gt 0 ]]; do
@@ -359,14 +366,6 @@ function make_pfx() {
CA_FILE_PREFIX="$2"
shift 2
;;
--path)
if [[ -z "$2" ]]; then
echo "ERROR: Missing value for certificate path." >&2
return 1
fi
CERT_PATH="$2"
shift 2
;;
--password)
if [[ -z "$2" ]]; then
echo "ERROR: Missing value for --password." >&2
@@ -379,6 +378,9 @@ function make_pfx() {
esac
done
local CERT_PATH="$1"
shift 1
CA_DIR="${CA_DIR:-${SIMPLE_CA_DIR:-$(pwd)}}"
local ROOT_CA_CERT="ca_cert.pem"
local ROOT_CA_KEY="ca_key.pem"