diff --git a/crates/gpapi/src/utils/certificate/gnutls.c b/crates/gpapi/src/utils/certificate/gnutls.c index ec6e2e3..33a749a 100644 --- a/crates/gpapi/src/utils/certificate/gnutls.c +++ b/crates/gpapi/src/utils/certificate/gnutls.c @@ -49,6 +49,40 @@ void gp_key_free(unsigned char *data, size_t length) { #include #include +/* Check only the signature, not whether this local certificate is trusted, + * current, or has extensions understood by the client. */ +int gp_certificate_verify_signature( + const unsigned char *certificate, size_t certificate_length, + const unsigned char *issuer_key, size_t issuer_key_length, + const unsigned char *message, size_t message_length, + const unsigned char *signature, size_t signature_length) { + gnutls_x509_crt_t child = NULL; + gnutls_pubkey_t public_key = NULL; + int result, algorithm; + if (certificate_length > UINT_MAX || issuer_key_length > UINT_MAX || + message_length > UINT_MAX || signature_length > UINT_MAX) return -1; + result = gnutls_global_init(); + if (result < 0) return -1; + gnutls_datum_t child_data = {(unsigned char *)certificate, (unsigned int)certificate_length}; + gnutls_datum_t key_data = {(unsigned char *)issuer_key, (unsigned int)issuer_key_length}; + gnutls_datum_t data = {(unsigned char *)message, (unsigned int)message_length}; + gnutls_datum_t sig = {(unsigned char *)signature, (unsigned int)signature_length}; + result = gnutls_x509_crt_init(&child); + if (result >= 0) result = gnutls_x509_crt_import(child, &child_data, GNUTLS_X509_FMT_DER); + if (result >= 0) result = gnutls_pubkey_init(&public_key); + if (result >= 0) result = gnutls_pubkey_import(public_key, &key_data, GNUTLS_X509_FMT_DER); + if (result >= 0) { + algorithm = gnutls_x509_crt_get_signature_algorithm(child); + if (algorithm < 0) result = algorithm; + else result = gnutls_pubkey_verify_data2(public_key, algorithm, + GNUTLS_VERIFY_ALLOW_BROKEN | GNUTLS_VERIFY_ALLOW_SIGN_WITH_SHA1, &data, &sig) >= 0; + } + if (public_key != NULL) gnutls_pubkey_deinit(public_key); + if (child != NULL) gnutls_x509_crt_deinit(child); + gnutls_global_deinit(); + return result < 0 ? -1 : result; +} + /* Stable private kinds, independent of the native enum values. */ struct gp_client_key { gnutls_privkey_t signer; diff --git a/crates/gpapi/src/utils/certificate/gnutls.rs b/crates/gpapi/src/utils/certificate/gnutls.rs index 406f1d2..10eb531 100644 --- a/crates/gpapi/src/utils/certificate/gnutls.rs +++ b/crates/gpapi/src/utils/certificate/gnutls.rs @@ -1,11 +1,22 @@ use std::ffi::{c_char, c_int}; use pkcs8::SecretDocument; +use pkcs8::der::{Encode, asn1::ObjectIdentifier}; use zeroize::Zeroizing; use crate::utils::request::RequestIdentityError; unsafe extern "C" { + fn gp_certificate_verify_signature( + certificate: *const u8, + certificate_length: usize, + issuer_key: *const u8, + issuer_key_length: usize, + message: *const u8, + message_length: usize, + signature: *const u8, + signature_length: usize, + ) -> c_int; fn gp_key_import( input: *const u8, length: usize, @@ -26,6 +37,46 @@ unsafe extern "C" { fn gp_key_free(data: *mut u8, length: usize); } +pub(super) fn verify_certificate_signature( + certificate: &x509_cert::Certificate, + issuer: &x509_cert::Certificate, + message: &[u8], + signature: &[u8], +) -> anyhow::Result { + const RSA: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.1.1.1"); + const RSA_PSS: ObjectIdentifier = ObjectIdentifier::new_unwrap("1.2.840.113549.1.1.10"); + let mut issuer_key = issuer.tbs_certificate().subject_public_key_info().clone(); + if certificate.signature_algorithm().oid == RSA_PSS { + if !matches!(issuer_key.algorithm.oid, RSA | RSA_PSS) { + return Ok(false); + } + // GnuTLS's generic verifier takes PSS parameters from the imported key. + // Give this verification operation the certificate's full AlgorithmIdentifier, + // including salt length, rather than the default implied by its signature enum. + // This temporary SPKI never changes the certificates sent to the server. + issuer_key.algorithm = certificate.signature_algorithm().clone(); + } + let issuer_key = issuer_key.to_der()?; + let certificate = certificate.to_der()?; + let result = unsafe { + gp_certificate_verify_signature( + certificate.as_ptr(), + certificate.len(), + issuer_key.as_ptr(), + issuer_key.len(), + message.as_ptr(), + message.len(), + signature.as_ptr(), + signature.len(), + ) + }; + match result { + 0 => Ok(false), + 1 => Ok(true), + _ => Err(RequestIdentityError::InvalidCertificate.into()), + } +} + struct ExportedKey { data: *mut u8, length: usize, diff --git a/crates/gpapi/src/utils/certificate/issuer.rs b/crates/gpapi/src/utils/certificate/issuer.rs new file mode 100644 index 0000000..bf51539 --- /dev/null +++ b/crates/gpapi/src/utils/certificate/issuer.rs @@ -0,0 +1,18 @@ +use pkcs8::der::{Decode, Encode}; + +use crate::utils::request::RequestIdentityError; + +/// Identify the signing issuer, without applying trust, expiry or extension policy +/// to a local identity. The VPN server remains responsible for those checks. +pub(super) fn is_issuer(certificate: &[u8], issuer: &[u8]) -> anyhow::Result { + let child = x509_cert::Certificate::from_der(certificate).map_err(|_| RequestIdentityError::InvalidCertificate)?; + let parent = x509_cert::Certificate::from_der(issuer).map_err(|_| RequestIdentityError::InvalidCertificate)?; + if child.tbs_certificate().issuer() != parent.tbs_certificate().subject() { + return Ok(false); + } + let signature = child + .signature() + .as_bytes() + .ok_or(RequestIdentityError::InvalidCertificate)?; + super::platform_import::verify_certificate_signature(&child, &parent, &child.tbs_certificate().to_der()?, signature) +} diff --git a/crates/gpapi/src/utils/certificate/mod.rs b/crates/gpapi/src/utils/certificate/mod.rs index 282bd95..864543c 100644 --- a/crates/gpapi/src/utils/certificate/mod.rs +++ b/crates/gpapi/src/utils/certificate/mod.rs @@ -1,4 +1,5 @@ mod client_key; +mod issuer; pub(super) use client_key::{ClientKey, validate_certificate}; pub(super) mod pkcs12; @@ -18,7 +19,7 @@ mod platform_import; target_os = "freebsd", target_os = "openbsd" )))] -#[path = "unsupported.rs"] +#[path = "portable_import.rs"] mod platform_import; pub(super) use platform_import::{archive, decrypt as decrypt_key}; diff --git a/crates/gpapi/src/utils/certificate/pkcs12.rs b/crates/gpapi/src/utils/certificate/pkcs12.rs index 5f55bac..73212e5 100644 --- a/crates/gpapi/src/utils/certificate/pkcs12.rs +++ b/crates/gpapi/src/utils/certificate/pkcs12.rs @@ -65,10 +65,17 @@ pub(in crate::utils) fn certified_key( let mut chain = Vec::new(); loop { chain.extend_from_slice(pem::encode(&pem::Pem::new("CERTIFICATE", current.as_der())).as_bytes()); - if current.subject() == current.issuer() { + if super::issuer::is_issuer(current.as_der(), current.as_der())? { break; } - let Some(parent) = certs.iter().position(|cert| cert.subject() == current.issuer()) else { + let mut parent = None; + for (index, candidate) in certs.iter().enumerate() { + if super::issuer::is_issuer(current.as_der(), candidate.as_der())? { + parent = Some(index); + break; + } + } + let Some(parent) = parent else { break; }; current = certs.remove(parent); diff --git a/crates/gpapi/src/utils/certificate/portable_import.rs b/crates/gpapi/src/utils/certificate/portable_import.rs new file mode 100644 index 0000000..7532c6a --- /dev/null +++ b/crates/gpapi/src/utils/certificate/portable_import.rs @@ -0,0 +1,46 @@ +//! Portable certificate verification; native legacy import is unavailable here. +use crate::utils::request::RequestIdentityError; +use pkcs8::der::{Decode, Encode, asn1::AnyRef}; + +pub(in crate::utils) fn decrypt( + _bytes: &[u8], + _pem: bool, + _passphrase: Option<&str>, +) -> anyhow::Result { + Err(RequestIdentityError::UnsupportedEncryption.into()) +} + +pub(in crate::utils) fn archive( + _bytes: &[u8], + _passphrase: Option<&str>, +) -> anyhow::Result<(zeroize::Zeroizing>, pkcs8::SecretDocument)> { + Err(RequestIdentityError::UnsupportedEncryption.into()) +} + +pub(super) fn verify_certificate_signature( + child: &x509_cert::Certificate, + parent: &x509_cert::Certificate, + message: &[u8], + signature: &[u8], +) -> anyhow::Result { + let public_key = parent.tbs_certificate().subject_public_key_info(); + let key_algorithm = public_key.algorithm.to_der()?; + let signature_algorithm = child.signature_algorithm().to_der()?; + let key_algorithm = AnyRef::from_der(&key_algorithm)?.value(); + let signature_algorithm = AnyRef::from_der(&signature_algorithm)?.value(); + let key = public_key + .subject_public_key + .as_bytes() + .ok_or(RequestIdentityError::InvalidCertificate)?; + Ok( + rustls::crypto::ring::default_provider() + .signature_verification_algorithms + .all + .iter() + .any(|algorithm| { + algorithm.public_key_alg_id().as_ref() == key_algorithm + && algorithm.signature_alg_id().as_ref() == signature_algorithm + && algorithm.verify_signature(key, message, signature).is_ok() + }), + ) +} diff --git a/crates/gpapi/src/utils/certificate/unsupported.rs b/crates/gpapi/src/utils/certificate/unsupported.rs deleted file mode 100644 index 3eb9f6d..0000000 --- a/crates/gpapi/src/utils/certificate/unsupported.rs +++ /dev/null @@ -1,14 +0,0 @@ -pub(in crate::utils) fn decrypt( - _bytes: &[u8], - _pem: bool, - _passphrase: Option<&str>, -) -> anyhow::Result { - Err(crate::utils::request::RequestIdentityError::UnsupportedEncryption.into()) -} - -pub(in crate::utils) fn archive( - _bytes: &[u8], - _passphrase: Option<&str>, -) -> anyhow::Result<(zeroize::Zeroizing>, pkcs8::SecretDocument)> { - Err(crate::utils::request::RequestIdentityError::UnsupportedEncryption.into()) -} diff --git a/crates/gpapi/tests/client_certificate_chain.rs b/crates/gpapi/tests/client_certificate_chain.rs new file mode 100644 index 0000000..31da392 --- /dev/null +++ b/crates/gpapi/tests/client_certificate_chain.rs @@ -0,0 +1,238 @@ +//! A PKCS#12 CA rollover must send the intermediate that signed the client. +use gpapi::{ + gp_params::GpParams, + os_profile::{ClientOs, HostIdentity, HostSnapshot, OsProfile}, + utils::request::ClientIdentity, +}; +use openssl::{ + asn1::Asn1Time, + bn::BigNum, + ec::{EcGroup, EcKey}, + hash::MessageDigest, + nid::Nid, + pkey::{PKey, Private}, + ssl::{SslAcceptor, SslMethod, SslVerifyMode}, + stack::Stack, + x509::{ + X509, X509NameBuilder, + extension::{AuthorityKeyIdentifier, BasicConstraints, KeyUsage, SubjectKeyIdentifier}, + }, +}; +use std::{ + io::{Read, Write}, + net::TcpListener, + thread, + time::Duration, +}; +use zeroize::Zeroizing; + +fn key() -> PKey { + PKey::from_ec_key(EcKey::generate(&EcGroup::from_curve_name(Nid::X9_62_PRIME256V1).unwrap()).unwrap()).unwrap() +} + +fn certificate( + name: &str, + key: &PKey, + issuer: Option<(&X509, &PKey)>, + serial: u32, + ca: bool, + key_identifiers: bool, +) -> X509 { + let mut subject = X509NameBuilder::new().unwrap(); + subject.append_entry_by_text("CN", name).unwrap(); + let subject = subject.build(); + let mut cert = X509::builder().unwrap(); + cert.set_version(2).unwrap(); + cert + .set_serial_number(&BigNum::from_u32(serial).unwrap().to_asn1_integer().unwrap()) + .unwrap(); + cert.set_subject_name(&subject).unwrap(); + cert + .set_issuer_name(issuer.map(|(cert, _)| cert.subject_name()).unwrap_or(&subject)) + .unwrap(); + cert.set_pubkey(key).unwrap(); + cert + .set_not_before(&Asn1Time::from_unix(1_700_000_000).unwrap()) + .unwrap(); + cert + .set_not_after(&Asn1Time::from_unix(4_000_000_000).unwrap()) + .unwrap(); + let mut constraints = BasicConstraints::new(); + if ca { + constraints.ca(); + } + cert.append_extension(constraints.critical().build().unwrap()).unwrap(); + let mut usage = KeyUsage::new(); + if ca { + usage.key_cert_sign(); + } else { + usage.digital_signature(); + } + cert.append_extension(usage.critical().build().unwrap()).unwrap(); + if key_identifiers { + let identifier = SubjectKeyIdentifier::new() + .build(&cert.x509v3_context(None, None)) + .unwrap(); + cert.append_extension(identifier).unwrap(); + if let Some((parent, _)) = issuer { + let identifier = AuthorityKeyIdentifier::new() + .keyid(true) + .build(&cert.x509v3_context(Some(parent), None)) + .unwrap(); + cert.append_extension(identifier).unwrap(); + } + } + cert + .sign(issuer.map(|(_, key)| key).unwrap_or(key), MessageDigest::sha256()) + .unwrap(); + cert.build() +} + +#[tokio::test] +async fn pkcs12_ca_rollover_authenticates_in_both_bag_orders() { + for self_issued in [false, true] { + let root_key = key(); + // Ordinary rollover also works without AKI/SKI. The self-issued chain + // needs key identifiers so the independent server distinguishes its root. + let root = certificate("Root", &root_key, None, 1, true, self_issued); + let issuer_name = if self_issued { "Root" } else { "Issuing CA" }; + let old_key = key(); + let old = certificate(issuer_name, &old_key, Some((&root, &root_key)), 2, true, self_issued); + let current_key = key(); + let current = certificate( + issuer_name, + ¤t_key, + Some((&root, &root_key)), + 3, + true, + self_issued, + ); + let client_key = key(); + let leaf = certificate( + "Client", + &client_key, + Some((¤t, ¤t_key)), + 4, + false, + self_issued, + ); + for old_first in [true, false] { + let mut ca = Stack::new().unwrap(); + let intermediates = if old_first { [&old, ¤t] } else { [¤t, &old] }; + for cert in intermediates { + ca.push(cert.clone()).unwrap(); + } + ca.push(root.clone()).unwrap(); + authenticate(&root, ¤t, &leaf, &client_key, ca).await; + } + } +} + +async fn authenticate(root: &X509, current: &X509, leaf: &X509, client_key: &PKey, ca: Stack) { + let archive = openssl::pkcs12::Pkcs12::builder() + .pkey(client_key) + .cert(leaf) + .ca(ca) + .build2("test") + .unwrap() + .to_der() + .unwrap(); + let identity = ClientIdentity::from_data(Zeroizing::new(archive.clone()), None, Some("test")).unwrap(); + assert_eq!( + identity.certificate_data(), + archive, + "OpenConnect must retain the original archive" + ); + let profile = OsProfile::builder(ClientOs::Linux).build(HostSnapshot { + runtime_os: ClientOs::Linux, + identity: HostIdentity::application("test".into(), "test".into()), + os_version: "test".into(), + software_version: "test".into(), + }); + let params = GpParams::builder(profile) + .client_identity(Some(identity)) + .ignore_tls_errors(true) + .build(); + let client = reqwest::Client::try_from(¶ms).unwrap(); + let server_key = key(); + let mut server = SslAcceptor::mozilla_intermediate_v5(SslMethod::tls()).unwrap(); + server + .set_certificate(&certificate("Server", &server_key, None, 5, false, false)) + .unwrap(); + server.set_private_key(&server_key).unwrap(); + server.cert_store_mut().add_cert(root.clone()).unwrap(); + server.set_verify(SslVerifyMode::PEER | SslVerifyMode::FAIL_IF_NO_PEER_CERT); + let server = server.build(); + let listener = TcpListener::bind("127.0.0.1:0").unwrap(); + listener.set_nonblocking(true).unwrap(); + let address = format!("https://{}", listener.local_addr().unwrap()); + let expected_leaf = leaf.to_der().unwrap(); + let expected_issuer = current.to_der().unwrap(); + let worker = thread::spawn(move || { + let deadline = std::time::Instant::now() + Duration::from_secs(5); + let socket = loop { + match listener.accept() { + Ok((socket, _)) => break socket, + Err(error) if error.kind() == std::io::ErrorKind::WouldBlock && std::time::Instant::now() < deadline => { + thread::sleep(Duration::from_millis(5)) + } + Err(error) => return Err(error.to_string()), + } + }; + socket.set_nonblocking(false).unwrap(); + socket.set_read_timeout(Some(Duration::from_secs(5))).unwrap(); + socket.set_write_timeout(Some(Duration::from_secs(5))).unwrap(); + let mut socket = server.accept(socket).map_err(|error| error.to_string())?; + assert_eq!( + socket.ssl().peer_certificate().unwrap().to_der().unwrap(), + expected_leaf + ); + assert!( + socket + .ssl() + .peer_cert_chain() + .unwrap() + .iter() + .any(|cert| cert.to_der().unwrap() == expected_issuer) + ); + let mut request = [0; 4096]; + socket.read(&mut request).map_err(|error| error.to_string())?; + socket + .write_all(b"HTTP/1.1 200 OK\r\nContent-Length: 2\r\nConnection: close\r\n\r\nok") + .map_err(|error| error.to_string()) + }); + let response = client.get(address).timeout(Duration::from_secs(5)).send().await; + let server_result = worker.join().unwrap(); + assert!(server_result.is_ok(), "{server_result:?}; {response:?}"); + assert_eq!(response.unwrap().text().await.unwrap(), "ok"); +} + +#[tokio::test] +async fn pkcs12_pss_certificate_signature_parameters_authenticate() { + let root = X509::from_pem(include_bytes!("files/client-identity/pss-chain-root.pem")).unwrap(); + let issuer = X509::from_pem(include_bytes!("files/client-identity/pss-chain-issuer.pem")).unwrap(); + let client_key = PKey::private_key_from_pem(include_bytes!("files/client-identity/rsa-pkcs8.pem")).unwrap(); + let wrong_key = PKey::from_rsa(openssl::rsa::Rsa::generate(2048).unwrap()).unwrap(); + let wrong_issuer = certificate("PSS Issuing CA", &wrong_key, None, 6, true, false); + for certificate in [ + include_bytes!("files/client-identity/pss-chain-salt-20.pem").as_slice(), + include_bytes!("files/client-identity/pss-chain-salt-32.pem").as_slice(), + include_bytes!("files/client-identity/pss-chain-salt-48.pem").as_slice(), + ] { + let leaf = X509::from_pem(certificate).unwrap(); + assert!(leaf.verify(&issuer.public_key().unwrap()).unwrap()); + for wrong_first in [true, false] { + let mut ca = Stack::new().unwrap(); + let candidates = if wrong_first { + [&wrong_issuer, &issuer] + } else { + [&issuer, &wrong_issuer] + }; + for candidate in candidates { + ca.push(candidate.clone()).unwrap(); + } + ca.push(root.clone()).unwrap(); + authenticate(&root, &issuer, &leaf, &client_key, ca).await; + } + } +} diff --git a/crates/gpapi/tests/files/client-identity/README.md b/crates/gpapi/tests/files/client-identity/README.md index 6500f08..dcca817 100644 --- a/crates/gpapi/tests/files/client-identity/README.md +++ b/crates/gpapi/tests/files/client-identity/README.md @@ -37,6 +37,7 @@ optional fixture-generation script, not identity import. | `legacy-rc2.p12` | Issue #437 case: RC2-40 certificate bags, SHA1/3DES key bag, SHA1 MAC | | `ec-p521.pem`, `ec-p521-cert.pem` | Valid P-521 identity; explicit unsupported-key error until HTTP negotiation parity exists | | `rsa-pss.pem`, `rsa-pss-cert.pem` | Valid RSA-PSS identity; explicit unsupported-key error until Rustls negotiation parity exists | +| `pss-chain-{root,issuer}.pem`, `pss-chain-salt-{20,32,48}.pem` | RSA client certificates signed with RSA-PSS/SHA256 and different salt lengths; client key is `rsa-pkcs8.pem`. Regenerate with `generate-pss-chain.sh` | | `ec-{compressed,explicit}.pem`, matching `-cert.pem` files | Valid OpenSSL inputs rejected by the tested GnuTLS backend; actionable unsupported-encoding tests | | `legacy-RC4-128.p12` | SHA1/RC4-128 key encryption and SHA1/3DES certificate encryption; native archive import | | `legacy-RC2-128.p12`, `legacy-2DES.p12` | Unsupported archive encryption; terminal AES re-export guidance with any password | @@ -84,6 +85,12 @@ until the HTTP transport can negotiate them correctly on both TLS versions. This differs from ordinary RSA keys producing RSA-PSS signatures, which remain supported. OpenSSL remains development-only. +`tests/client_certificate_chain.rs` checks mutual TLS with PKCS#12 CA rollover, +including self-issued intermediates and both certificate bag orders. It also +checks RSA-PSS certificate signatures with 20-, 32-, and 48-byte salts against +a same-name, wrong-key issuer. The server must receive the original leaf and +correct intermediate; OpenConnect must retain the original archive. + `tests/client_certificate_tls12_hash.rs` records the remaining TLS 1.2 P-384 with SHA-256-only peer request gap: the OpenSSL baseline passes, while the replacement reproducer is explicitly ignored pending negotiated-version-aware diff --git a/crates/gpapi/tests/files/client-identity/generate-pss-chain.sh b/crates/gpapi/tests/files/client-identity/generate-pss-chain.sh new file mode 100644 index 0000000..4b816c3 --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/generate-pss-chain.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# Public test certificates only; uses the existing public RSA client key. +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=PSS Chain Root' -addext 'basicConstraints=critical,CA:TRUE' \ + -keyout "$scratch/root.key" -out pss-chain-root.pem +"$openssl_bin" req -new -newkey rsa:2048 -noenc -subj '/CN=PSS Issuing CA' \ + -keyout "$scratch/issuer.key" -out "$scratch/issuer.csr" +printf 'basicConstraints=critical,CA:TRUE\nkeyUsage=critical,keyCertSign\n' > "$scratch/ca.ext" +"$openssl_bin" x509 -req -in "$scratch/issuer.csr" -CA pss-chain-root.pem \ + -CAkey "$scratch/root.key" -set_serial 2 -days 3650 -sha256 \ + -extfile "$scratch/ca.ext" -out pss-chain-issuer.pem +"$openssl_bin" req -new -key rsa-pkcs8.pem -subj '/CN=PSS Signed Client' -out "$scratch/client.csr" +printf 'basicConstraints=critical,CA:FALSE\nkeyUsage=critical,digitalSignature\nextendedKeyUsage=clientAuth\n' > "$scratch/client.ext" +for salt_length in 20 32 48; do + "$openssl_bin" x509 -req -in "$scratch/client.csr" -CA pss-chain-issuer.pem \ + -CAkey "$scratch/issuer.key" -set_serial "$salt_length" -days 3650 -sha256 \ + -sigopt rsa_padding_mode:pss -sigopt "rsa_pss_saltlen:$salt_length" \ + -extfile "$scratch/client.ext" -out "pss-chain-salt-$salt_length.pem" +done diff --git a/crates/gpapi/tests/files/client-identity/generate.sh b/crates/gpapi/tests/files/client-identity/generate.sh index bccd1c4..d47e15e 100644 --- a/crates/gpapi/tests/files/client-identity/generate.sh +++ b/crates/gpapi/tests/files/client-identity/generate.sh @@ -99,3 +99,4 @@ done # 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" diff --git a/crates/gpapi/tests/files/client-identity/pss-chain-issuer.pem b/crates/gpapi/tests/files/client-identity/pss-chain-issuer.pem new file mode 100644 index 0000000..044702e --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/pss-chain-issuer.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDEDCCAfigAwIBAgIBAjANBgkqhkiG9w0BAQsFADAZMRcwFQYDVQQDDA5QU1Mg +Q2hhaW4gUm9vdDAeFw0yNjExMDcwNTIxNTJaFw0zNjExMDQwNTIxNTJaMBkxFzAV +BgNVBAMMDlBTUyBJc3N1aW5nIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB +CgKCAQEAkjFaot6TCYfvnmfxSGfpqd2X+633FdjuaJLFf+G/EAccA7SVwtyGAJuT +/+RE3q0JO9I502mPRIWxkKOH0KU1dQK92iIup2lhc4WOtaGFvk+KGu3UrIQhgK8N +h0bEkiPcO160M3MEBo3mZGC933n/q+ean1nHcxrh3vp6t4fAUmH8B46+ww2QgUR0 +nJorVh/gAmrzRmgRfRy3FKHRh9sZLrguJqlNOe8g3x/brmFV2dd4vl1iX84+Xxs3 +9WfyrYGH0Sy3HAUv7ur5z8j9eiPTdy3UvGpDoz815WKCJNkdTvbMlDJVu0+NokLa +7q3z0CidYwVGqHlzKl6yXPp4J/ZbVwIDAQABo2MwYTAPBgNVHRMBAf8EBTADAQH/ +MA4GA1UdDwEB/wQEAwICBDAdBgNVHQ4EFgQUjMoHVKzTYMWxwGZvjWzCuv2roqYw +HwYDVR0jBBgwFoAUK0dvk5jU2/lvSQ4u3d0VdEQ1bTwwDQYJKoZIhvcNAQELBQAD +ggEBABr/bCjbrX3JrF8S30glfEPOwXuYsJRCWuHn4+p89x0nwEU7+DpChepRwG6n +rhsFRUz2ADrpJyw+4DaEHquGpEGirRx9QLEV9rDXAAyHK7/k1yy25pfj/CttzjXn +M6WEZPR5jRcNNBH+B7Lb55uvGQHiuZg7abuNz+lE8iUwXOsfsbXqAU7RoWpvb59f +jrDh925YPvKRIMGPqZjA9l5KzPxmBxyWZlSyTwRlZPVcAJXPRusfuCVko6kXcEJ1 +U86g8VjR03EknNSxYifXjbAlFGh2NBeJ1BeS12yTe9zlyZ1hijwC0jTlzF9fzI/K +YgwNW6V0W51+Rn2L8EyHtl0IbyU= +-----END CERTIFICATE----- diff --git a/crates/gpapi/tests/files/client-identity/pss-chain-root.pem b/crates/gpapi/tests/files/client-identity/pss-chain-root.pem new file mode 100644 index 0000000..bdcd412 --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/pss-chain-root.pem @@ -0,0 +1,19 @@ +-----BEGIN CERTIFICATE----- +MIIDEzCCAfugAwIBAgIUbtOYPmJw0zjzONdDDXnD4PWLy+8wDQYJKoZIhvcNAQEL +BQAwGTEXMBUGA1UEAwwOUFNTIENoYWluIFJvb3QwHhcNMjYxMTA3MDUyMTUxWhcN +MzYxMTA0MDUyMTUxWjAZMRcwFQYDVQQDDA5QU1MgQ2hhaW4gUm9vdDCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBANnZ/+l/MSDO3IlW57rCGg8WOSOQ1Kmy +2QoMUGCSNNrYsfmriY0BkcyX4LHyvH2FqZUE4h6IfVnY1qEaKRQYw6Rljy9unGkW +Z7a5c6N88KbZ3GgFUkn/BpFbf1FAd7AVfXwOrbUtpw43nxLmN6nXr3iYTme0aOuH +rNTnxBUq7WEMKyZNwtuKJoYBllqNr6Pth+KVtFNvXyQfqOetTi1upwObsZYVewnU +Hv5+XM9ZQ9S2pC8816B9DGm+ys0+f+mn+W9f6C+ffHhjV+aUMfgBFOIB9sl1oZNO +td+WX5yT96/b7OTwOwP/Q6eKvK+QMDEbi2K2ULMqknlUfOfeLvKPCUECAwEAAaNT +MFEwHQYDVR0OBBYEFCtHb5OY1Nv5b0kOLt3dFXRENW08MB8GA1UdIwQYMBaAFCtH +b5OY1Nv5b0kOLt3dFXRENW08MA8GA1UdEwEB/wQFMAMBAf8wDQYJKoZIhvcNAQEL +BQADggEBALrN2Eu94nDxpbSp1AfYPVr5/9yUOMfA/NjUB3OZ4q5fyPoAiTmOFZ7C +hIdnXfMZq6tKKUf1qO86HreiyHF4+JIewBPkR43uTRxRuuV37R9igbXDmYtvmUK0 ++8zgj4Y6IhXO7wqr6llIgK3LF9dkg7K1NhqvgWaGXB10YrjU5Ae1rVToN+9Yre8a +4PsbaWGQR+kchcYd1WlJJO4afBf7ecGDujwBc0k/bHX8eFmhQ94ZIh/KyONsEI3C +mmgEDeFCdWPCG+736IkrYA8SAAFqVMMQCvHDMpROUzbHFOQQIKKOUy0ErLKpwEYo +4Xn5o6uX/eWZaLv5iOcNACugZ2JwW1g= +-----END CERTIFICATE----- diff --git a/crates/gpapi/tests/files/client-identity/pss-chain-salt-20.pem b/crates/gpapi/tests/files/client-identity/pss-chain-salt-20.pem new file mode 100644 index 0000000..ffe9553 --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/pss-chain-salt-20.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDgzCCAjygAwIBAgIBFDA8BgkqhkiG9w0BAQowL6APMA0GCWCGSAFlAwQCAQUA +oRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAMBkxFzAVBgNVBAMMDlBTUyBJ +c3N1aW5nIENBMB4XDTI2MTEwNzA1MjE1MloXDTM2MTEwNDA1MjE1MlowHDEaMBgG +A1UEAwwRUFNTIFNpZ25lZCBDbGllbnQwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAw +ggEKAoIBAQDd1Qd/iKhTpVWOjhfwPTqlaj9Ac6CKubFr0fZsVgR8r1OSmRv16e2t +jhfjjhOI0cz3S4Cqt9ZPLWIMGMugt9Y1YFHpg8gTsLrnYgRHBtA2eoBhLROLsj5x +aiUBoAYPR1vLmPyHtPuvveRepaY59AEarptx6//jf6LJQAjxTNbiU5FQsGr4ixVG +I29zsesFE0VbVSxKYdiMN+duVX7iPQSkMODWedcBEqQo17xAdvPgjtpN1AfXoDHW +ns/kpfOb2z9W1o3GG89XxA1s/IBivmIb6Dy+p7CzhCFxHmOd8Wlt8/U5W9wkphHm +HWbsF79XEBqyIoUx6Vo1kNsCezCSf9aHAgMBAAGjdTBzMAwGA1UdEwEB/wQCMAAw +DgYDVR0PAQH/BAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMCMB0GA1UdDgQWBBQ/ +cTzIdpR+vdaP5Z9fBxp5isXZMDAfBgNVHSMEGDAWgBSMygdUrNNgxbHAZm+NbMK6 +/auipjA8BgkqhkiG9w0BAQowL6APMA0GCWCGSAFlAwQCAQUAoRwwGgYJKoZIhvcN +AQEIMA0GCWCGSAFlAwQCAQUAA4IBAQAUOI4kd5ZvRevSo5kt6xoJBYmRw2jVwcqG +rVoq21h1L3cqhqYSb9oCyGcrkWcUfXY5uPAemF9wyScbLgwyGudX6ngVdHWwRVvN +dBZLRLDsviRAjN60NP06vrV/JzcQfFOL2L0tjGfYCfXdYD+0WZG8R1qtb2fHPh89 +II7O3dof2eR/GOot/JX6te7vYc3faWyNTC8SclB9tJrwAz8++tf0cuStHoLWd9jV +Gq3mhKn1ZzdJsbwTQjledIXLG6eRE6XyLHzcB6VctAt6bhVLxH8Ck/oEfGwYY2wK +tkwyNCnl35CCBRdbKxXfUJavoq8jwETZmSVnRUfWn2HUB6FDmtGm +-----END CERTIFICATE----- diff --git a/crates/gpapi/tests/files/client-identity/pss-chain-salt-32.pem b/crates/gpapi/tests/files/client-identity/pss-chain-salt-32.pem new file mode 100644 index 0000000..dd9f347 --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/pss-chain-salt-32.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDjTCCAkGgAwIBAgIBIDBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQCAQUA +oRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCASAwGTEXMBUGA1UEAwwO +UFNTIElzc3VpbmcgQ0EwHhcNMjYxMTA3MDUyMTUyWhcNMzYxMTA0MDUyMTUyWjAc +MRowGAYDVQQDDBFQU1MgU2lnbmVkIENsaWVudDCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAN3VB3+IqFOlVY6OF/A9OqVqP0BzoIq5sWvR9mxWBHyvU5KZ +G/Xp7a2OF+OOE4jRzPdLgKq31k8tYgwYy6C31jVgUemDyBOwuudiBEcG0DZ6gGEt +E4uyPnFqJQGgBg9HW8uY/Ie0+6+95F6lpjn0ARqum3Hr/+N/oslACPFM1uJTkVCw +aviLFUYjb3Ox6wUTRVtVLEph2Iw3525VfuI9BKQw4NZ51wESpCjXvEB28+CO2k3U +B9egMdaez+Sl85vbP1bWjcYbz1fEDWz8gGK+YhvoPL6nsLOEIXEeY53xaW3z9Tlb +3CSmEeYdZuwXv1cQGrIihTHpWjWQ2wJ7MJJ/1ocCAwEAAaN1MHMwDAYDVR0TAQH/ +BAIwADAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwIwHQYDVR0O +BBYEFD9xPMh2lH691o/ln18HGnmKxdkwMB8GA1UdIwQYMBaAFIzKB1Ss02DFscBm +b41swrr9q6KmMEEGCSqGSIb3DQEBCjA0oA8wDQYJYIZIAWUDBAIBBQChHDAaBgkq +hkiG9w0BAQgwDQYJYIZIAWUDBAIBBQCiAwIBIAOCAQEAHduUqnc8vvfsg8PrIRxD +qOWW0wx6BdRSd23cx1V7OaT7JMU6gvWSiiFx+aOl+REPQNNxi9yTAUDL0vPewwa9 +UZSNUy0tYVXuhZ4QfoPMZNRV2d1JekoHXgWLk39JgD363TL504MEhDoeXtIAbj/d +Ta+7aHGH6xMhwldUWMqiUkBpC4TUOsshZm92197/SRl9joTWB5G3RSREirG8LEn4 +HiTgd2AbiPXzAzA5MdIOeGWMKSF+Ey3R6Z2HzOzIrqAd3pFVPI6oHMSN6WzfHLVW +GT8LM+eQyUXTQn7B67REH+/GsolCHBUEMjyABUtZoNIxa3KOXE7GN7SQDV93UPhT +CQ== +-----END CERTIFICATE----- diff --git a/crates/gpapi/tests/files/client-identity/pss-chain-salt-48.pem b/crates/gpapi/tests/files/client-identity/pss-chain-salt-48.pem new file mode 100644 index 0000000..14c8b97 --- /dev/null +++ b/crates/gpapi/tests/files/client-identity/pss-chain-salt-48.pem @@ -0,0 +1,22 @@ +-----BEGIN CERTIFICATE----- +MIIDjTCCAkGgAwIBAgIBMDBBBgkqhkiG9w0BAQowNKAPMA0GCWCGSAFlAwQCAQUA +oRwwGgYJKoZIhvcNAQEIMA0GCWCGSAFlAwQCAQUAogMCATAwGTEXMBUGA1UEAwwO +UFNTIElzc3VpbmcgQ0EwHhcNMjYxMTA3MDUyMTUyWhcNMzYxMTA0MDUyMTUyWjAc +MRowGAYDVQQDDBFQU1MgU2lnbmVkIENsaWVudDCCASIwDQYJKoZIhvcNAQEBBQAD +ggEPADCCAQoCggEBAN3VB3+IqFOlVY6OF/A9OqVqP0BzoIq5sWvR9mxWBHyvU5KZ +G/Xp7a2OF+OOE4jRzPdLgKq31k8tYgwYy6C31jVgUemDyBOwuudiBEcG0DZ6gGEt +E4uyPnFqJQGgBg9HW8uY/Ie0+6+95F6lpjn0ARqum3Hr/+N/oslACPFM1uJTkVCw +aviLFUYjb3Ox6wUTRVtVLEph2Iw3525VfuI9BKQw4NZ51wESpCjXvEB28+CO2k3U +B9egMdaez+Sl85vbP1bWjcYbz1fEDWz8gGK+YhvoPL6nsLOEIXEeY53xaW3z9Tlb +3CSmEeYdZuwXv1cQGrIihTHpWjWQ2wJ7MJJ/1ocCAwEAAaN1MHMwDAYDVR0TAQH/ +BAIwADAOBgNVHQ8BAf8EBAMCB4AwEwYDVR0lBAwwCgYIKwYBBQUHAwIwHQYDVR0O +BBYEFD9xPMh2lH691o/ln18HGnmKxdkwMB8GA1UdIwQYMBaAFIzKB1Ss02DFscBm +b41swrr9q6KmMEEGCSqGSIb3DQEBCjA0oA8wDQYJYIZIAWUDBAIBBQChHDAaBgkq +hkiG9w0BAQgwDQYJYIZIAWUDBAIBBQCiAwIBMAOCAQEAfRbXy5n1jSsOiKKGppzq +iRhrCJf51Le9aaf5cot/l1Q8GTFdYi8Ieu4CghsmGvfJIuRyig/aFfqXxpcFldDq +Nm4uIKRyDwygLyDau+OUaNmz1UZ2Y6FzOfyb6ujy2pEhOXr1EnQnL82MvlvbN4DT +9Dx4FgXAydtM6P6QfALvAEVy8/wjAYVCK5Xv/vKR5fFc2Rgl3DZkopcPF2pNQFN4 +E0P7GWxE+elRG952lacqHyhL4sIMoHF6AvDFUVwWoqttIfjX1272vt2yN1ej9F94 +BWyVm+sYf0fg767lsW2yFQS/1LbldjkHmxQn3qkrPhPni1zWhC5MJ6DxFLXGxkIr +kw== +-----END CERTIFICATE-----