Asked by:
pgp file decryption

Question
-
User1717218719 posted
Monday, June 22, 2020 10:20 AM
All replies
-
User475983607 posted
Do a google search for .NET Open PGP libraries and read the docs.
Monday, June 22, 2020 10:37 AM -
User1717218719 posted
.
Monday, June 22, 2020 2:06 PM -
User475983607 posted
This is a 3rd party library. It is up to you to read the documentation. At this point it is not clear if downloaded and installed the library.
Monday, June 22, 2020 3:08 PM -
User288213138 posted
Hi E.RU,
the issue with this code is that PGPLib is getting the error not declared.Dim pgp As New PGPLib()
Have you installed the PGPLib NuGet package? If not, please install NuGet package, then reference the following namespace.
NuGet: PM> Install-Package DidiSoft.Pgp.Trial Imports DidiSoft.Pgp
Best regards,
Sam
Tuesday, June 23, 2020 2:17 AM -
User1717218719 posted
.
Wednesday, June 24, 2020 7:09 AM -
User288213138 posted
Hi E.RU,
I have installed the package which solved that problem. I still have my original issue however of trying to find an example of pgp decryption using public key in file.
This is the code I have so far but this is for a private key which is not what I am looking for.
Here a demo about how to decrypt and verify a password encrypted file with a public key located in a file for you as a reference.
This example demonstrates OpenPGP decryption and verification of an OpenPGP one pass signed and password encrypted file. We use the public key of the other party to verify the source of this signed file. The decryption password is the same as the one used for encryption.
Imports System Imports DidiSoft.Pgp Public Class DecryptAndVerifyPBE Public Sub Demo() ' create an instance of the library Dim pgp As New PGPLib() Dim signatureCheck As SignatureCheckResult = _ pgp.DecryptAndVerifyFilePBE("C:\Test\OUTPUT.pgp", _ "encryption password", _ "C:\Test\sender_public_key.asc", _ "C:\Test\INPUT.txt") If signatureCheck = SignatureCheckResult.SignatureVerified Then Console.WriteLine("Signare OK") ElseIf signatureCheck = SignatureCheckResult.SignatureBroken Then Console.WriteLine("Signare of the message is either broken or forged") ElseIf signatureCheck = SignatureCheckResult.PublicKeyNotMatching Then Console.WriteLine("The provided public key(s) doesn't match the signature") ElseIf signatureCheck = SignatureCheckResult.NoSignatureFound Then Console.WriteLine("This message is not digitally signed") End If End Sub End Class
Wednesday, June 24, 2020 8:09 AM -
User1717218719 posted
.
Friday, June 26, 2020 8:32 AM -
User288213138 posted
Hi E.RU,
The file is encrypted with an OpenPGP key. Use DecryptFile insteadSince this is a third-party plug-in, I cannot test it. I suggest you go to the PGPLib forum for help.
Best regards,
Sam
Tuesday, June 30, 2020 8:38 AM -
User1717218719 posted
.
Wednesday, July 8, 2020 10:01 AM