Skip to content

Commit 159dbb7

Browse files
committed
test: generate an explicit CA certificate for X.509 signing
The fixture relied on the TLS tool's default certificate extensions. LibreSSL generated a certificate that gpgsm could import but could not validate for signing. Declare the self-signed root's CA extension in a temporary configuration instead of relying on those defaults. The existing signing and signature-verification assertions now pass with LibreSSL 3.3.6 and OpenSSL 3.5.8. The full make check target also passes, including all 363 nextest tests, without excluding the signing test.
1 parent 9582b9d commit 159dbb7

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎asyncgit/src/sync/sign.rs‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -772,6 +772,14 @@ mod tests {
772772

773773
let key = home.join("key.pem");
774774
let cert = home.join("cert.pem");
775+
let cert_config = home.join("openssl.cnf");
776+
// LibreSSL and OpenSSL ship different default extensions. Make
777+
// this self-signed trust root a CA explicitly so gpgsm can
778+
// validate it with either tool's default configuration.
779+
std::fs::write(
780+
&cert_config,
781+
"[req]\ndistinguished_name=dn\n[dn]\n[extensions]\nbasicConstraints=critical,CA:TRUE\n",
782+
)?;
775783
run(
776784
"openssl",
777785
&[
@@ -788,6 +796,10 @@ mod tests {
788796
"3650",
789797
"-subj",
790798
&format!("/CN=gitui test/emailAddress={email}"),
799+
"-config",
800+
cert_config.to_str().unwrap(),
801+
"-extensions",
802+
"extensions",
791803
],
792804
);
793805
// gpgsm's PKCS#12 reader accepts different ciphers across versions, so

0 commit comments

Comments
 (0)