Remove simple-ca module and its associated files
/ test-python (push) Successful in 49s
/ test-go (push) Failing after 4m44s

- Deleted go.mod and go.sum files for the simple-ca module.
- Removed main.go file containing the implementation of the simple-ca tool.
This commit is contained in:
2026-05-24 16:47:43 +02:00
parent 0d61919162
commit cb858a96b1
3 changed files with 271 additions and 104 deletions
+66 -13
View File
@@ -21,8 +21,8 @@
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# This script runs integration tests against one or more simple-ca implementations.
# Usage: run-tests.sh [python|go|all] (default: all)
# This script runs integration tests against the simple-ca Python implementation.
# Usage: run-tests.sh [python|all] (default: all)
set -e
TEST_TARGET="${1:-all}"
@@ -149,6 +149,67 @@ run_pfx_algorithm_tests() {
fi
}
# run_crl_tests NAME MAKE_CA_CMD MAKE_CERT_CMD MAKE_PFX_CMD REVOKE_CMD MAKE_CRL_CMD
run_crl_tests() {
local NAME="$1"
local MAKE_CA_CMD="$2"
local MAKE_CERT_CMD="$3"
local REVOKE_CMD="$4"
local MAKE_CRL_CMD="$5"
echo
echo "--- [$NAME] CRL tests ---"
clean_up_test_dir
# Build a two-level CA hierarchy
$MAKE_CA_CMD --ca-dir "$CA_DIR" "CRL Test CA"
$MAKE_CA_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" "Issuing CA"
# Issue two certs; revoke the first; keep the second active
$MAKE_CERT_CMD --ca-dir "$CA_DIR" --cert-dir "$CERT_DIR" --issuing-ca "issuing_ca" \
"alice" "alice.example.com"
$MAKE_CERT_CMD --ca-dir "$CA_DIR" --cert-dir "$CERT_DIR" --issuing-ca "issuing_ca" \
"bob" "bob.example.com"
$REVOKE_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca" "$CERT_DIR/alice_cert.pem"
# Generate CRL for the issuing CA
$MAKE_CRL_CMD --ca-dir "$CA_DIR" --issuing-ca "issuing_ca"
[[ -f "$CA_DIR/issuing_ca/crl.pem" ]] || { echo "ERROR: issuing_ca/crl.pem not created" >&2; exit 1; }
# alice's serial must appear in the issuing CA CRL
CRL_TEXT=$(openssl crl -in "$CA_DIR/issuing_ca/crl.pem" -noout -text 2>/dev/null)
ALICE_SERIAL=$(openssl x509 -in "$CERT_DIR/alice_cert.pem" -noout -serial | cut -d= -f2)
if echo "$CRL_TEXT" | grep -qi "$ALICE_SERIAL"; then
echo "CRL [issuing_ca]: alice's serial found — OK"
else
echo "ERROR: CRL [issuing_ca]: alice's serial not found in CRL" >&2
echo "$CRL_TEXT" >&2
exit 1
fi
# bob's serial must NOT appear in the issuing CA CRL
BOB_SERIAL=$(openssl x509 -in "$CERT_DIR/bob_cert.pem" -noout -serial | cut -d= -f2)
if echo "$CRL_TEXT" | grep -qi "$BOB_SERIAL"; then
echo "ERROR: CRL [issuing_ca]: bob's serial unexpectedly found in CRL" >&2
exit 1
else
echo "CRL [issuing_ca]: bob's serial absent — OK"
fi
# Root CA CRL should be empty (no revoctions at root level)
$MAKE_CRL_CMD --ca-dir "$CA_DIR"
[[ -f "$CA_DIR/crl.pem" ]] || { echo "ERROR: root crl.pem not created" >&2; exit 1; }
ROOT_CRL_TEXT=$(openssl crl -in "$CA_DIR/crl.pem" -noout -text 2>/dev/null)
if echo "$ROOT_CRL_TEXT" | grep -q "No Revoked Certificates"; then
echo "CRL [root]: empty — OK"
else
echo "ERROR: CRL [root]: expected empty CRL" >&2
echo "$ROOT_CRL_TEXT" >&2
exit 1
fi
}
# Uses ;;& to fall through to subsequent patterns so 'all' matches every block.
case "$TEST_TARGET" in
python|all)
@@ -156,20 +217,12 @@ case "$TEST_TARGET" in
PY_PREFIX="python3 $SCRIPT_DIR/simple-ca.py"
run_flow "python" "$PY_PREFIX make-ca" "$PY_PREFIX make-cert" "$PY_PREFIX make-pfx"
run_pfx_algorithm_tests "python" "$PY_PREFIX make-ca" "$PY_PREFIX make-cert" "$PY_PREFIX make-pfx"
run_crl_tests "python" "$PY_PREFIX make-ca" "$PY_PREFIX make-cert" "$PY_PREFIX revoke-cert" "$PY_PREFIX make-crl"
;;&
go|all)
command -v go >/dev/null || { echo "ERROR: go not found" >&2; exit 1; }
GO_SRC="$SCRIPT_DIR/src/simple-ca"
GO_BIN="$GO_SRC/simple-ca"
echo "Building Go binary..."
(cd "$GO_SRC" && go build -o simple-ca .)
run_flow "go" "$GO_BIN make-ca" "$GO_BIN make-cert" "$GO_BIN make-pfx"
run_pfx_algorithm_tests "go" "$GO_BIN make-ca" "$GO_BIN make-cert" "$GO_BIN make-pfx"
;;&
python|go|all)
python|all)
;;
*)
echo "ERROR: unknown target '$TEST_TARGET' (expected: python|go|all)" >&2
echo "ERROR: unknown target '$TEST_TARGET' (expected: python|all)" >&2
exit 1
;;
esac