Decrypts a PGP encrypted message.

Namespace:  DidiSoft
Assembly:  PGPLib (in PGPLib.dll) Version: 1.6.3.19546

Syntax

C#
public string DecryptString(
	string encryptedString,
	FileInfo privateKeyFile,
	string privateKeyPassword
)
Visual Basic (Declaration)
Public Function DecryptString ( _
	encryptedString As String, _
	privateKeyFile As FileInfo, _
	privateKeyPassword As String _
) As String
Visual C++
public:
String^ DecryptString(
	String^ encryptedString, 
	FileInfo^ privateKeyFile, 
	String^ privateKeyPassword
)

Parameters

encryptedString
Type: System..::.String
OpenPGP encrypted message
privateKeyFile
Type: System.IO..::.FileInfo
Private key file
privateKeyPassword
Type: System..::.String
Private key password

Return Value

Decrypted string

Examples

CopyC#
using System;
using System.IO;
using DidiSoft;

class DecryptString {

       public static String Demo(String encryptedString)
       {
           PGPLib pgp = new PGPLib();
           String plainString = pgp.DecryptString(encryptedString, 
                                                    new FileInfo(@"DataFiles\private.key"), 
                                                    "changeit");
           return plainString;
       }
}
CopyVB.NET
Imports System
Imports System.IO
Imports DidiSoft

   Class DecryptString
       Public Shared Function Demo(ByVal encryptedString As String) As String
           Dim pgp As New PGPLib()
           Dim plainString As String = pgp.DecryptString(encryptedString, _
                                                        New FileInfo("DataFiles\private.key"), _
                                                        "changeit")
           Return plainString
       End Function
   End Class

Exceptions

ExceptionCondition
PgpExceptionif an error has occured
System.IO..::.IOExceptionif a problem has occured reading private key file

See Also