Hello, i'm using PGPCore Version 6.0.0 in my C# application. I was able to generate Key to .asc file and also, encrypt string succesfuly. But the Description is showing me this error:
Org.BouncyCastle.Bcpg.OpenPgp.PgpSecretKeyRing found where PgpPublicKeyRing expected
Below is my code structure
Generating Key
public void GenerateSecurityKey(string username = null, string password = null)
{
using(PGP pgp = new PGP())
{
string pubKeyFile = $"{_config["KeyPath"]}/publickey.asc";
string prvKeyFile = $"{_config["KeyPath"]}/privatekey.asc";
var fl = File.Create(pubKeyFile);
fl.Close();
fl = File.Create(prvKeyFile);
fl.Close();
var publicKey = new FileInfo(pubKeyFile);
var privateKey = new FileInfo(prvKeyFile);
pgp.GenerateKey(publicKey, privateKey, username, password);
Console.WriteLine($"\r\nKey Generated successfully.\r\nLocate it at {pubKeyFile}, {prvKeyFile}");
}
}
For your decryption method you need to pass the password to the EncryptionKeys constructer as well. If you only pass a single argument it thinks it's a public key.
Hello, i'm using PGPCore Version 6.0.0 in my C# application. I was able to generate Key to .asc file and also, encrypt string succesfuly. But the Description is showing me this error:
Org.BouncyCastle.Bcpg.OpenPgp.PgpSecretKeyRing found where PgpPublicKeyRing expected
Below is my code structureGenerating Key
Encrypt Text
Decrypt Text
Kindly help to look into this as soon as possible