5

I am using PgpCore nuget package for PGP encryption and decryption.

The case I encountered is as follows, I encrypt a file with EncryptAndSign method as follows.

using (PGP pgp = new PGP())
{
   pgp.EncryptFileAndSign(fileNameToEncrypt, outputFileName, _publicKey, _privateKey, _passPhrase);
}

Then I decrypt the encrypted file using the Decrypt method as follows.

using (PGP pgp = new PGP())
{
   pgp.DecryptFile(fileNameToDecrypt, outputFileName, _privateKey, _passPhrase);
}

Here is I'm getting the error "Secret key for message not found.".

I suspect that PrivateKey and PublicKey might be wrong, altered, or different values ​​might have been used in the two methods.

So I did the encryption process in an application called PGP Tool using privatekey and publickey and wrote the file path to the inputFile parameter of the descrypt method above. And the decrypt process was successful.

PublicKey and PrivateKey were given to me by the API owner company to communicate with their APIs. So I don't generate these keys, both values ​​are defined in a constant way.

Thanks.

Umut Gür
  • 369
  • 1
  • 4
  • 18
  • I'd love to know what this message really means as I am in the same boat, trying to work out of my provided keys/passphrase are valid – Nick.Mc Aug 22 '22 at 00:12

0 Answers0