IPWorks Encrypt 2020 C++ Builder Edition

Questions / Feedback?

VerifySignature Method

Verifies the signature for the specified data.

Syntax

bool __fastcall VerifySignature();

Remarks

VerifySignature will verify a hash signature and return True if successful or False otherwise.

Before calling this method specify the input file by setting InputFile or InputMessage.

A public key and the hash signature are required to perform the signature verification. Specify the public key in SignerKey. Specify the hash signature in HashSignature.

When this method is called the component will compute the hash for the specified file and populate HashValue. It will verify the signature using the specified SignerKey and HashSignature.

To verify the hash signature without first computing the hash simply specify HashValue before calling this method. Note: HashValue is not applicable when the message was signed with a PureEdDSA algorithm such as ed25519 or ed448.

The Progress event will fire with updates for the hash computation progress only. The hash signature verification process is quick and does not require progress updates.

The following properties are applicable when calling this method:

Sign And Verify Example (ECDSA)


//Create an ECDSA key on Party 1
Ecc ecc1 = new Ecc();
ecc1.CreateKey("secp256r1");
string ecc1_priv = ecc1.Key.PrivateKey;
string ecc1_pub = ecc1.Key.PublicKey;

//Sign the data on Party 1
string originalData = "hello ecc";

ecc1.Reset();
ecc1.Key.PrivateKey = ecc1_priv;
ecc1.InputMessage = originalData;
ecc1.UseHex = true; //Hex encode the hash signature for ease of use.
ecc1.Sign();

string hashSignature = ecc1.HashSignature;

//Transmit the hash signature, public key, and original data to part 2

//Verify the data on Party 2
Ecc ecc2 = new Ecc();
ecc2.SignerKey.PublicKey = ecc1_pub;
ecc2.InputMessage = originalData;
ecc2.HashSignature = hashSignature;
ecc2.UseHex = true; //Decode the hex encoded hash signature

bool isVerified = ecc2.VerifySignature();

Sign And Verify Example (EdDSA - PureEdDSA)


//Create an EdDSA key on Party 1
Ecc ecc1 = new Ecc();
ecc1.CreateKey("ed25519");
string ecc1_priv = ecc1.Key.PrivateKey;
string ecc1_pub = ecc1.Key.PublicKey;

//Sign the data on Party 1
string originalData = "hello ecc";

ecc1.Reset();
ecc1.Key.PrivateKey = ecc1_priv;
ecc1.InputMessage = originalData;
ecc1.UseHex = true; //Hex encode the hash signature for ease of use.
ecc1.Sign();

string hashSignature = ecc1.HashSignature;

//Transmit the hash signature, public key, and original data to part 2

//Verify the data on Party 2
Ecc ecc2 = new Ecc();
ecc2.SignerKey.PublicKey = ecc1_pub;
ecc2.InputMessage = originalData;
ecc2.HashSignature = hashSignature;
ecc2.UseHex = true; //Decode the hex encoded hash signature

bool isVerified = ecc2.VerifySignature();

Sign And Verify Example (EdDSA - HashEdDSA)


//Create an EdDSA key on Party 1
Ecc ecc1 = new Ecc();
ecc1.CreateKey("ed25519");
string ecc1_priv = ecc1.Key.PrivateKey;
string ecc1_pub = ecc1.Key.PublicKey;

//Sign the data on Party 1
string originalData = "hello ecc";

ecc1.Reset();
ecc1.Key.PrivateKey = ecc1_priv;
ecc1.InputMessage = originalData;
ecc1.UseHex = true; //Hex encode the hash signature for ease of use.
ecc1.HashEdDSA = true; //Use "ed25519ph"
ecc1.Sign();

string hashSignature = ecc1.HashSignature;

//Transmit the hash signature, public key, and original data to part 2

//Verify the data on Party 2
Ecc ecc2 = new Ecc();
ecc2.SignerKey.PublicKey = ecc1_pub;
ecc2.InputMessage = originalData;
ecc2.HashSignature = hashSignature;
ecc2.HashEdDSA = true;
ecc2.UseHex = true; //Decode the hex encoded hash signature

bool isVerified = ecc2.VerifySignature();

Copyright (c) 2022 /n software inc. - All rights reserved.
IPWorks Encrypt 2020 C++ Builder Edition - Version 20.0 [Build 8155]