PGP 加密、解密 和 驗證簽名 函式 大全
When we receive a one pass signed and encrypted OpenPGP message we can simply decrypt it or both decrypt it and verifythe authenticity of the sender in a single step.
This tutorial refers to version 1.7.12 or newer of the library. The tutorial for older versions is available here.
The examples below shows how to perform both decryption and verification with DidiSoft
Decrypt and verify a file
Decrypt and verify a file that may contain multiple files inside
Decrypt and verify a String message
Decrypt and verify password encrypted file
Appendix
1. Decrypt and verify file with keys located in files
This example demonstrates OpenPGP decryption and verification of an OpenPGP one pass signed and encrypted file.
We use the public key of the other party to verify the source of this signed file. Our own private key is usually used for decryption.
C# example
|
VB.NET example
|
2. Decrypt and verify file with keys located in a KeyStore
In this example the public key of the sender is used for verification and our private key is used for decryption and they both are located in a KeyStore.
C# example
|
VB.NET example
|
3. Decrypt and verify a multiple file archive with keys located in files
This sample is useful in cases when the .pgp archive contains multiple files inside. The only drawback is that this we need to invoke two methods instead of one:
C# example
|