WALTER | Workable Algorithms for Location-aware Transmission, Encryption Response

PGPManaged..::..VerifySignature Method (String, String, String)

Verifies the signature that is supposed to match the plain text.

Namespace:  Walter.Cypher.PGP
Assembly:  Walter.Cypher (in Walter.Cypher.dll)

Syntax


[MethodImplAttribute]
public bool VerifySignature(
	string plainText,
	string signedHashValue,
	string key
)

Parameters

plainText
Type: String
The plain text.
signedHashValue
Type: String
The signed hash value.
key
Type: String
The key.

Return Value

true if signature matches the signed text, false otherwise.

Exceptions


ExceptionCondition
ArgumentNullExceptionplainText
ArgumentNullExceptionsignedHashValue
ArgumentNullExceptionkey

Examples


shows how one can sign and validate a signature using the private key of a keyring
C#
var keyGen = new PGPKeyGenerator();
   var keyRing2048 = keyGen.GenerateKeys(PGPKeySize.Key2048);
   var pgp = new PGPManaged();
   var signature = pgp.Sign("sample", keyRing2048.PrivateKey);
   var actual = pgp.VerifySignature("sample", signature, keyRing2048.PrivateKey);

   Assert.IsTrue(actual);

See Also


VerifySignature Overload