This project is read-only.

PGP Interop: crypter unable to decrypt from GPG

Mar 28, 2016 at 7:15 PM
Edited Mar 29, 2016 at 12:55 AM
Is there an explanation of how to use PGP/GPG to encrypt a file in a manner compatible with crypter? My primary interest in determining this is because I want to use crypter with the PGP/GPG default settings.

I am using gpg4win v2.3.0 Kleopatra GUI; I walked through the initial setup and wound up with a certificate.

I exported the certificate and successfully used it with crypter to encrypt a small sample file - and then successfully used Kleopatra to decrypt the file.

However, when I tried the reverse (using Kleopatra to encrypt the file), I was unable to decrypt it using crypter with the exported secret key. I encountered the following exception:
 Org.BouncyCastle.Bcpg.OpenPgp.PgpException occurred
  Message=exception decrypting secret key
       at crypter.Program.Main(String[] args) in d:\dev\open-source\crypter\Program.cs:line 10901
  InnerException: Org.BouncyCastle.Crypto.InvalidCipherTextException
       Message=unknown block type (99)
            at Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding.DecodeBlock(Byte[] input, Int32 inOff, Int32 inLen) in d:\dev\open-source\crypter\3rd-parties\bccrypto\src\crypto\encodings\Pkcs1Encoding.cs:line 340
            at Org.BouncyCastle.Crypto.Encodings.Pkcs1Encoding.ProcessBlock(Byte[] input, Int32 inOff, Int32 length) in d:\dev\open-source\crypter\3rd-parties\bccrypto\src\crypto\encodings\Pkcs1Encoding.cs:line 154
            at Org.BouncyCastle.Crypto.BufferedAsymmetricBlockCipher.DoFinal() in d:\dev\open-source\crypter\3rd-parties\bccrypto\src\crypto\BufferedAsymmetricBlockCipher.cs:line 124
            at Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKeyEncryptedData.RecoverSessionData(PgpPrivateKey privKey) in d:\dev\open-source\crypter\3rd-parties\bccrypto\src\openpgp\PgpPublicKeyEncryptedData.cs:line 250
Apr 21 at 6:48 PM
I do not know if it will be for this, but I think the standards are different:

Gpg4win is based on the international standard OpenPGP (RFC 2440):

and Bouncy Castle C# is based on the international standard OpenPGP (RFC 4880):