You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interestingly, if we only make a single change in Cargo.toml, namely by downgrading aws-lc-rs to 1.12.2:
aws-lc-rs = { version = "=1.12.2", default-features = false, features = ["alloc", "ring-io", "aws-lc-sys", "prebuilt-nasm"] }
[...]
then the above script prints
This is a P-384 keypair!
which is correct.
This sounds like either a bug in aws-lc-rs, or in the interaction between aws-lc and rcgen. I'm also using aws-lc-rs directly, and there I couldn't reproduce the problem right away, which is why I'm reporting this issue to rcgen initially.
The text was updated successfully, but these errors were encountered:
I believe that previously from_private_key_der() in ec/key_pair.rs only called parse_rfc5915_private_key(), which enforces the alg's NID matches expectation post-parse.
In 686 I think it was changed so parse_rfc5915_private_key() is only called if parse_rfc5208_private_key() returns an err, and crucially that new codepath doesn't look like it examines the alg at all. Your input key looks at first glance to me like a RFC 5208 PKCS#8 private key so I think that parse succeeds and returns a P384 decoded private key without noticing that we specified the P256 algorithm ID in the call. That breaks the way rcgen is trying to determine the curve by trial and error.
I'll pull out a smaller repro and report upstream.
Foreword: I apologize if this is actually AWS's bug - I'm not sure where the error is, currently.
I was debugging unit test failures today, when I noticed this very odd behaviour:
Steps to reproduce
I have (test) code that does something like this:
In addition, I have the following
Cargo.toml
(excerpt):Now, we feed this private key (this is a test key!) to
from_pem
:we get this output
This is a P-256 keypair!
but if we decode the above PEM using OpenSSL...
This is clearly a P-384 key!!!
Expected output
Interestingly, if we only make a single change in
Cargo.toml
, namely by downgrading aws-lc-rs to 1.12.2:then the above script prints
This is a P-384 keypair!
which is correct.
This sounds like either a bug in aws-lc-rs, or in the interaction between aws-lc and rcgen. I'm also using aws-lc-rs directly, and there I couldn't reproduce the problem right away, which is why I'm reporting this issue to rcgen initially.
The text was updated successfully, but these errors were encountered: