PGPManaged..::..Decrypt Method (String, String)
Decrypts the specified encrypted text that was encrypted using a public key.
Namespace:
Walter.Cypher.PGPAssembly: Walter.Cypher (in Walter.Cypher.dll)
Syntax
[NotNullAttribute] [MethodImplAttribute] public string Decrypt( string encryptedText, string privateKey )
Return Value
the deciphered textExamples
C#
var keyGen = new PGPKeyGenerator(); var keyRing = keyGen.GenerateKeys(PGPKeySize.Key2048); var pgp = new PGPManaged(); var smallTextFile = "ABC"; var secure = pgp.Encrypt(smallTextFile, keyRing.PublicKey); var copy = pgp.Decrypt(secure, keyRing.PrivateKey); Assert.AreEqual(smallTextFile, copy);