Unable to load any oqs-provider generated PEM files #527
Replies: 2 comments 2 replies
-
@andybrucenet It looks like you might be short an attachment, so the below is pure speculation on my part based on what others have encountered in the past... :-) What version of OQS are you using? open-quantum-safe/liboqs#1626 merged two weeks ago (:tada:), adding the new draft ML-DSA &co specs that NIST has published, but it doesn't look like they've published a new release yet according to https://github.com/open-quantum-safe/liboqs/tags. Before that PR, Let us know if that helps,
|
Beta Was this translation helpful? Give feedback.
-
Nope -- this has been the incredible @SWilson4. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Summary:
Can someone provide guidance on how to use BouncyCastle to read post-quantum PEM files generated by openssl / liboqs / oqs-provider?
Recently was tasked to implement post-quantum crypto in both C++ native libs as well as .net code. We use openssl for C++; thus, gravitated to openssl 3.2.1 / liboqs / oqs-provider which integrates ml-kem (aka Kyber), falcon, sphincs+, etc. directly into openssl APIs. Used
OQS_ALGS_ENABLED=STD
when building liboqs to get only the NIST-approved list of algorithms.Created PEM outputs for all supported algorithms (no passwords).
However - latest BouncyCastle.Cryptography 2.3.0 is unable to read any of the PEM files generated by the C++ app.
Attachment contains READMEs, full source code and screenshots showing output.
Notes:
Created a trivial test C++ app which enumerates all included OQS algorithms and creates a PEM using
EVP_PKEY_keygen
/PEM_write_bio_PrivateKey_ex
. In that same C++ app verified the created PEM by usingPEM_read_bio_PrivateKey_ex
.Created trivial C# app which reads each of the generated PEM files and uses
PemReader.ReadObject()
to load the file. However, receive the same exception for all:The C# app uses latest BouncyCastle.Cryptography 2.3.0 - in fact, that is the only nuget package installed for the app.
Attached source code and examples of several PEM files as well as screenshots of both PEM.
Openssl client has
oqs-provider
installed and can read the PEM files generated by the C++ app.Source
The C++ source code is pretty simple; given an input algorithm name, create a PKEY and export PEM-encoded to
/tmp
:The C# source code is even simpler: Read all
/tmp/foobar-*.pem
and attempt to read using BouncyCastle:The attachment contains the full projects including static libraries (at least for macOS which is what I'm doing my testing on).
Beta Was this translation helpful? Give feedback.
All reactions