Open sarfudheen opened 3 years ago
Yes, this would be useful.
JcePBEProtectionRemoverFactory
is hard-coded to AES/CBC/NoPadding. The AAD is the full key binary s-expression (starting with the key type) minus the protected sub-list.Sample code for this is in JGit. If anyone's interested in doing this properly in BC itself, feel free to take that code as inspiration.
Bump
I'm trying to load GNUPG 2.2.23 secret keys from D:\Users\xxxxx\AppData\Roaming\gnupg\private-keys-v1.d using bouncy castle bcpg-jdk15on-1.66.jar.
But I'm getting
Exception in thread "main" java.io.IOException: unknown character encountered: K at org.bouncycastle.gpg.SXprUtils.skipOpenParenthesis(Unknown Source) at org.bouncycastle.gpg.SExprParser.parseSecretKey(Unknown Source)
**gpg (GnuPG) 2.2.23
libgcrypt 1.8.6**
It seems to secret key file format has been changed between GNUPG 2.1.X et GNUPG 2.2.X
https://lists.gnupg.org/pipermail/gnupg-devel/2017-December/033295.html