Files
Kevin Yue 408536807c chore: promote GP Connect 3.3.1 sources and Nix packages (#699)
* fix: restore client certificate compatibility after OpenSSL removal

Use GnuTLS for desktop client key matching and signing without applying server certificate policy to local identities. Restore RC4 PKCS12 import and renewed certificate selection, and provide actionable unsupported identity errors.

Add HTTP and OpenConnect mutual TLS regressions. Record the unresolved TLS 1.2 ECDSA hash limitation and reject P-521 and RSA-PSS keys explicitly.

* fix: select PKCS12 issuers by certificate signature

Handle CA rollover and self-issued intermediates by checking issuer signatures. Preserve RSA-PSS signature parameters during GnuTLS verification and keep the original archive for OpenConnect.

Add mutual-TLS regression coverage for certificate bag order and RSA-PSS salt lengths. Verified 53 targeted tests plus gpapi, desktop-core, and iOS compile checks.

* fix: add gateway login diagnostics and scope platform dependencies

* chore: prepare GP Connect 3.3.1 release
2026-11-09 00:51:46 +08:00

103 lines
5.2 KiB
Bash

#!/usr/bin/env bash
# Public test identities only. Run with OpenSSL 3; no production credentials.
set -euo pipefail
cd "$(dirname "$0")"
openssl_bin=${OPENSSL_BIN:-openssl}
scratch=$(mktemp -d)
trap 'rm -rf "$scratch"' EXIT
"$openssl_bin" req -x509 -newkey rsa:2048 -noenc -sha256 -days 3650 \
-subj '/CN=GP Identity Test Root' -addext 'basicConstraints=critical,CA:TRUE' \
-keyout "$scratch/root.key" -out root.pem
"$openssl_bin" genpkey -algorithm RSA -pkeyopt rsa_keygen_bits:2048 -out rsa-pkcs8.pem
"$openssl_bin" genpkey -algorithm EC -pkeyopt ec_paramgen_curve:P-256 -out ec-pkcs8.pem
for algorithm in rsa ec; do
"$openssl_bin" req -new -key "$algorithm-pkcs8.pem" -subj "/CN=GP Identity Test $algorithm" \
-out "$scratch/$algorithm.csr"
"$openssl_bin" x509 -req -in "$scratch/$algorithm.csr" -CA root.pem -CAkey "$scratch/root.key" \
-set_serial 10 -days 3650 -sha256 -out "$algorithm-cert.pem"
done
# Issue #697: the local identity must allow a server-specific critical extension.
"$openssl_bin" req -new -x509 -key rsa-pkcs8.pem -sha256 -days 3650 \
-subj '/CN=GP Critical Extension Regression' \
-addext '1.3.6.1.4.1.55555.1=critical,DER:05:00' -out rsa-critical-extension.pem
# Compatibility and unsupported-input fixtures use the same public test keys.
"$openssl_bin" ec -in ec-pkcs8.pem -conv_form compressed -out ec-compressed.pem
"$openssl_bin" ec -in ec-pkcs8.pem -param_enc explicit -out ec-explicit.pem
"$openssl_bin" ecparam -name secp521r1 -genkey -noout -out ec-p521.pem
"$openssl_bin" genpkey -algorithm RSA-PSS -pkeyopt rsa_keygen_bits:2048 -out rsa-pss.pem
for variant in ec-compressed ec-explicit ec-p521 rsa-pss; do
"$openssl_bin" req -new -x509 -key "$variant.pem" -sha256 -days 3650 \
-subj "/CN=GP Public $variant Regression" -out "$variant-cert.pem"
done
"$openssl_bin" rsa -in rsa-pkcs8.pem -traditional -out rsa-pkcs1.pem
"$openssl_bin" ec -in ec-pkcs8.pem -out ec-sec1.pem
for cipher in aes128 aes192 aes256 des3; do
"$openssl_bin" rsa -in rsa-pkcs8.pem -traditional -"$cipher" \
-passout pass:fixture-password -out "rsa-traditional-$cipher.pem"
"$openssl_bin" ec -in ec-pkcs8.pem -"$cipher" \
-passout pass:fixture-password -out "ec-traditional-$cipher.pem"
done
for prf in sha1 sha256; do
if [[ "$prf" == sha1 ]]; then
prf_name=hmacWithSHA1
else
prf_name=hmacWithSHA256
fi
"$openssl_bin" pkcs8 -topk8 -in rsa-pkcs8.pem -v2 aes-256-cbc -v2prf "$prf_name" \
-passout pass:fixture-password -out "rsa-pbes2-$prf.pem"
done
for cipher in aes-128-cbc aes-192-cbc des3; do
for prf in sha1 sha256; do
if [[ "$prf" == sha1 ]]; then
prf_name=hmacWithSHA1
else
prf_name=hmacWithSHA256
fi
"$openssl_bin" pkcs8 -topk8 -in rsa-pkcs8.pem -v2 "$cipher" -v2prf "$prf_name" \
-passout pass:fixture-password -out "rsa-pbes2-$cipher-$prf.pem"
done
done
"$openssl_bin" pkcs8 -topk8 -in rsa-pkcs8.pem -scrypt -v2 aes-256-cbc \
-passout pass:fixture-password -out rsa-pbes2-scrypt.pem
"$openssl_bin" pkcs8 -topk8 -in rsa-pkcs8.pem -v1 PBE-SHA1-3DES \
-passout pass:fixture-password -out rsa-pbes1-3des.pem
for length in 127 128; do
printf -v password '%*s' "$length" ''
password=${password// /x}
"$openssl_bin" pkcs8 -topk8 -in rsa-pkcs8.pem -v1 PBE-SHA1-3DES \
-passout "pass:$password" -out "rsa-pbes1-3des-password-$length.pem"
done
"$openssl_bin" pkcs8 -topk8 -in ec-pkcs8.pem -v2 aes-256-cbc \
-passout pass:fixture-password -out ec-pbes2.pem
"$openssl_bin" pkcs12 -export -inkey rsa-pkcs8.pem -in rsa-cert.pem -certfile root.pem \
-name fixture -passout pass:fixture-password -out modern.p12
"$openssl_bin" pkcs12 -export -legacy -inkey rsa-pkcs8.pem -in rsa-cert.pem -certfile root.pem \
-keypbe PBE-SHA1-3DES -certpbe PBE-SHA1-RC2-40 -macalg SHA1 \
-name fixture -passout pass:fixture-password -out legacy-rc2.p12
"$openssl_bin" pkcs12 -export -inkey ec-pkcs8.pem -in ec-cert.pem -certfile root.pem \
-name fixture -passout 'pass:pässword-密码' -out unicode-password.p12
"$openssl_bin" pkcs12 -export -inkey rsa-pkcs8.pem -in rsa-cert.pem -certfile root.pem \
-name fixture -passout pass: -out empty-password.p12
# DES requires the legacy provider in OpenSSL 3, unlike PBES2 3DES.
"$openssl_bin" pkcs8 -provider default -provider legacy -topk8 -in rsa-pkcs8.pem \
-v2 des-cbc -v2prf hmacWithSHA256 -passout pass:fixture-password -out rsa-pbes2-des.pem
# RC4-128 was usable with the former OpenSSL legacy provider and OpenConnect.
# RC2-128 and two-key 3DES deliberately exercise unsupported-encryption errors.
for scheme in RC4-128 RC2-128 2DES; do
"$openssl_bin" pkcs12 -export -legacy -inkey rsa-pkcs8.pem -in rsa-cert.pem \
-keypbe "PBE-SHA1-$scheme" -certpbe PBE-SHA1-3DES \
-passout pass:fixture-password -out "legacy-$scheme.p12"
done
# Incomplete identity archives exercise validation before native TLS import.
"$openssl_bin" pkcs12 -export -nokeys -in rsa-cert.pem \
-name fixture -passout pass:fixture-password -out certificate-only.pfx
"$openssl_bin" pkcs12 -export -nocerts -inkey rsa-pkcs8.pem \
-name fixture -passout pass:fixture-password -out key-only.pfx
# Plain PKCS#12 bags let the import tests omit optional IDs and reorder bags.
python3 "$(dirname "$0")/generate-plain-pfx.py"
bash "$(dirname "$0")/generate-pss-chain.sh"