utility-pki

OpenSSL configuration

Export BDEW AS4, BSI TR-03116-3 or TR-02102-2 as an openssl.cnf section: protocols, cipher suites, groups, signature algorithms and options, verified.

OpenSSL 3.2 or later is the common TLS library that supports everything BDEW AS4 and TR-03116-3 require: CBC and CCM suites, and the Brainpool groups for both TLS versions.

Export

cargo run --example openssl -- bdew-as4
# BDEW AS4 (utility-pki)
MinProtocol = TLSv1.2
MaxProtocol = TLSv1.3
CipherString = ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-ECDSA-AES256-SHA384
Ciphersuites = TLS_AES_128_GCM_SHA256:TLS_AES_256_GCM_SHA384:TLS_AES_128_CCM_SHA256
Groups = brainpoolP256r1tls13:brainpoolP384r1tls13:secp256r1:brainpoolP256r1:brainpoolP384r1:brainpoolP512r1tls13:secp384r1:brainpoolP512r1
SignatureAlgorithms = ecdsa_brainpoolP256r1tls13_sha256:ecdsa_brainpoolP384r1tls13_sha384:ecdsa_brainpoolP512r1tls13_sha512:ecdsa_secp256r1_sha256:ecdsa_secp384r1_sha384:ecdsa_secp521r1_sha512
Options = ServerPreference,NoRenegotiation,EncryptThenMac,ExtendedMasterSecret

How the export decides what to write:

  • Order. Each list puts required items first, then optional ones. AEAD suites come before CBC, and ServerPreference makes the server follow that order.
  • One list for both versions. OpenSSL has a single Groups and a single SignatureAlgorithms list. The export writes what either version allows. Where TR-03116-3 differs between versions (Tab. 9 wants ECDSA-SHA512 in TLS 1.2; Tab. 15 has no P-521 scheme for TLS 1.3), audit reports NotAllowedWith, and check catches a session that uses it. With SM-PKI keys on brainpoolP256r1, no such session occurs.

Wire it in

Point ssl_conf at a section and paste the lines into it:

openssl_conf = openssl_init

[openssl_init]
ssl_conf = ssl_sect

[ssl_sect]
system_default = tls_profile

[tls_profile]
# paste here

Or set single values from code, for example through the openssl crate:

let config = utility_pki::profiles::BDEW_AS4.openssl()?;
ctx.set_cipher_list(&config.cipher_string().to_string())?;
ctx.set_ciphersuites(&config.ciphersuites().to_string())?;
ctx.set_groups_list(&config.groups().to_string())?;
ctx.set_sigalgs_list(&config.signature_algorithms().to_string())?;

Set these in code

OpenSSL configuration cannot express these rules:

  • Mutual TLS. On the server, request and require a client certificate (SSL_VERIFY_PEER | SSL_VERIFY_FAIL_IF_NO_PEER_CERT).
  • The 48-hour session limit (TR-03116-3 §4.1.2). Set the session timeout, and close connections older than 48 hours.
  • A separate certificate signature list (TR-03116-3 Tab. 16: Brainpool only in TLS 1.3). OpenSSL has no setting for signature_algorithms_cert, so let check_certificate judge each certificate's signature algorithm.

Then check each session with check and each certificate with check_certificate.

Why you can trust the names

  • The names come from a table checked against openssl ciphers -V -stdname, openssl list -tls-groups and SSL_CONF_cmd(3) of OpenSSL 4.1.
  • A test pins every entry, and just openssl passes every exported value to the local OpenSSL, which rejects unknown names.
  • A profile item without a verified name makes openssl() return Unsupported, so a custom profile never loses a suite silently.
  • The profile's name appears only as one comment line with control characters removed, so it cannot inject a directive.

Edit this page on GitHub