BouncyCastle PGP Decryption issue #548
vivekm1817
started this conversation in
General
Replies: 1 comment
-
any updates? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Hi there,
I am using BouncyCastle nuget package in the .NET8 project. The Encryption part works fine and I can see the encrypted data in the file but when I try to decrypt using the secret key the pgpObject is null PgpObject pgpObject = pgpObjectFactory.NextPgpObject()
Below is the complete code for the encryption and decryption. I am using test cases to verify the methods
`using Org.BouncyCastle.Bcpg;
using Org.BouncyCastle.Bcpg.OpenPgp;
using Org.BouncyCastle.Security;
using Org.BouncyCastle.Utilities.IO;
namespace PGPEncryption
{
public class PgpEncryption : IPgpEncryption
{
}
`
Test case
` [Fact]
public void DecryptFile_ShouldCallDecryptWithCorrectParameters()
{
// Arrange
string inputFile = "TestFile";
string encryptedOutputFileName = "testTIKET04P_encp";
string decryptedOutputFileName = "TIKET04P_decp";
string publicKeyFile = "UnitTest_0x0DDD517D_public.asc";
string privateKeyFile = "UnitTest_0x0DDD517D_SECRET.asc";
string passphrase = "";
pgpEncryption.EncryptFile(inputFile, encryptedOutputFileName, publicKeyFile);
}`
Not sure which bit is incorrect here. Any help is appreciated. Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions