bc-java icon indicating copy to clipboard operation
bc-java copied to clipboard

SExpParser fails with GnuPG ed25519 private keys

Open cstamas opened this issue 1 year ago • 0 comments

The SExpParser cannot partse GnuPG private keys if they are ed25519.

Reason is trivial: this is how GnuPG stores them: https://github.com/gpg/gnupg/blob/40227e42ea0f2f1cf9c9f506375446648df17e8d/common/t-ssh-utils.c#L179-L199 https://github.com/gpg/gnupg/blob/40227e42ea0f2f1cf9c9f506375446648df17e8d/agent/cvt-openpgp.c#L222-L243

And SExprParser always ends up here: https://github.com/bcgit/bc-java/blob/bd6e70c7cad0a35fdcba055de13ef2e36f6a151b/pg/src/main/java/org/bouncycastle/gpg/SExprParser.java#L94

As it does not count for (flags xxx).

cstamas avatar Feb 26 '24 11:02 cstamas