Skip to content

Commit adb6f14

Browse files
committed
FrodoKEM: ASN.1 keys, X.509 certicates
Added support for encoding and decoding keys in ASN.1. Added support for X.509 certificates and CSRs. Generated certificates and CSRs. Not fo FrodoKEM-640 as is not in the specs.
1 parent f6d12a1 commit adb6f14

43 files changed

Lines changed: 4946 additions & 58 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.wolfssl_known_macro_extras

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ WOLFSSL_EXTRA
842842
WOLFSSL_FORCE_OCSP_NONCE_CHECK
843843
WOLFSSL_FRDM_K64
844844
WOLFSSL_FRDM_K64_JENKINS
845+
WOLFSSL_FRODOKEM_NO_ASN1
845846
WOLFSSL_FUNC_TIME
846847
WOLFSSL_FUNC_TIME_LOG
847848
WOLFSSL_GEN_CERT

certs/frodokem/README.txt

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
FrodoKEM test key material for wolfSSL tests.
2+
3+
IMPORTANT - these files are NOT generated by OpenSSL.
4+
5+
FrodoKEM is a Key Encapsulation Mechanism (KEM). Neither OpenSSL nor the
6+
liboqs oqs-provider expose it as a certificate / key-encoding algorithm with
7+
the ISO/IEC 18033-2 key OIDs (arc 1.0.18033.2.2.7.x) that wolfSSL uses - their
8+
FrodoKEM support is KEM-only, for TLS key exchange, and is not going to be
9+
present as a signature/certificate algorithm. So, unlike the ML-DSA material
10+
in certs/mldsa/ (produced with OpenSSL 3.5+), these fixtures are generated by
11+
wolfSSL itself using wc_MakeCert_ex() / wc_MakeCertReq_ex().
12+
13+
A KEM public key cannot sign, so the certificate and the request are signed by
14+
an ECC (P-256) issuer key; the FrodoKEM key is only ever the subject public
15+
key.
16+
17+
Files (material is provided for parameter sets N in {976, 1344}; the 640 set
18+
has no standardised OID and cannot be encoded):
19+
gen_frodokem.c Generator (the "regeneration" tool; see below).
20+
frodokem-ca-ecc-key.der ECC P-256 issuer (CA) private key (DER / PEM).
21+
frodokem-ca-ecc-key.pem
22+
frodokem-ca-ecc-cert.der Self-signed ECC issuer (CA) certificate.
23+
frodokem-ca-ecc-cert.pem
24+
frodokem<N>-key.der FrodoKEM-<N> (SHAKE) private key, PKCS#8.
25+
frodokem<N>-key.pem
26+
frodokem<N>_pub-spki.der FrodoKEM-<N> public key, SubjectPublicKeyInfo.
27+
frodokem<N>-cert.der FrodoKEM-<N> leaf certificate signed by the ECC
28+
frodokem<N>-cert.pem CA (subject key is FrodoKEM, signature is ECDSA).
29+
frodokem<N>-req.der FrodoKEM-<N> certificate request (PKCS#10),
30+
frodokem<N>-req.pem signed by the ECC key.
31+
32+
Regenerating:
33+
wolfSSL must be built with (at least):
34+
--enable-experimental --enable-frodokem --enable-certgen --enable-certreq
35+
--enable-certext --enable-keygen --enable-ecc
36+
CPPFLAGS="-DHAVE_PKCS8 -DWOLFSSL_DER_TO_PEM"
37+
then:
38+
cc gen_frodokem.c -lwolfssl -o gen_frodokem
39+
(cd certs/frodokem && ./gen_frodokem)
40+
41+
The keys are generated fresh each run, so the output bytes differ every time;
42+
the committed copies are a stable snapshot for the test suite.
535 Bytes
Binary file not shown.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
-----BEGIN CERTIFICATE-----
2+
MIICEzCCAbmgAwIBAgIQLsJMxJ0pvxI9bYcdLnYYWTAKBggqhkjOPQQDAjBxMQsw
3+
CQYDVQQGEwJVUzEQMA4GA1UECAwHTW9udGFuYTEQMA4GA1UEBwwHQm96ZW1hbjEQ
4+
MA4GA1UECgwHd29sZlNTTDENMAsGA1UECwwEVGVzdDEdMBsGA1UEAwwURnJvZG9L
5+
RU0gVGVzdCBFQ0MgQ0EwIhgPMjAyNjA3MTIwNDE3MzhaGA8yMTI2MDYxOTA0MTcz
6+
OFowcTELMAkGA1UEBhMCVVMxEDAOBgNVBAgMB01vbnRhbmExEDAOBgNVBAcMB0Jv
7+
emVtYW4xEDAOBgNVBAoMB3dvbGZTU0wxDTALBgNVBAsMBFRlc3QxHTAbBgNVBAMM
8+
FEZyb2RvS0VNIFRlc3QgRUNDIENBMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE
9+
lmrJv8E5Z9nxzcyFWnRcQDwQVK0yZW10dS1i2xWRHquf4YNX4C/TXwUVqCGaSgaT
10+
UxwbCF3QtR5y43n6rKNYmqMvMC0wDAYDVR0TBAUwAwEB/zAdBgNVHQ4EFgQU41ak
11+
BnP4505sNDHigUVlOFv0K9gwCgYIKoZIzj0EAwIDSAAwRQIhAPRzykW9LJ8iATDl
12+
jIE5crF2/5YCg+RYMB2XG2VrVoeLAiBAVo3KhhWGCZgSlQ1JmlGSmFnLM7UaiXzE
13+
TeZ8oyaqXA==
14+
-----END CERTIFICATE-----
121 Bytes
Binary file not shown.
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
-----BEGIN EC PRIVATE KEY-----
2+
MHcCAQEEICBWOGxeT5BVTVs82QLQ71ahUMDedN3inIZhqsR+U89ToAoGCCqGSM49
3+
AwEHoUQDQgAElmrJv8E5Z9nxzcyFWnRcQDwQVK0yZW10dS1i2xWRHquf4YNX4C/T
4+
XwUVqCGaSgaTUxwbCF3QtR5y43n6rKNYmg==
5+
-----END EC PRIVATE KEY-----
21.5 KB
Binary file not shown.

certs/frodokem/frodokem1344-cert.pem

Lines changed: 461 additions & 0 deletions
Large diffs are not rendered by default.
42.1 KB
Binary file not shown.

certs/frodokem/frodokem1344-key.pem

Lines changed: 901 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)