AsymmetricVerifySign

Description

Verifies the signature of the data with asymmetric algorithm.

Applies to

CrypterObject objects

Syntax

crypter.AsymmetricVerifySign ( algorithm, variable, pubKey, sign)

Argument

Description

crypter

The name of the CrypterObject object

algorithm

A value of the AsymmetricAlgorithm enumerated type that specifies the type of asymmetric algorithm.

Values are:

  • RSA! – The Rivest-Shamir-Adleman cryptopsystem

  • DSA! – The Digital Signature Algorithm. It is designed to be used in signature, not in encryption and decryption.

  • Rabin! – The Rabin Algorithm

variable

A blob whose value is the data you want to verify with Public-Key cipher.

When using the system blob function to convert a string to a blob, it is recommended to specify its encoding argument to be EncodingANSI! (for English characters only) or EncodingUTF8!, otherwise, the default EncodingUTF16LE! will be used.

pubKey

A blob specifying the public key.

sign

A blob specifying the signature.


Return value

Integer. Returns 1 if it succeeds and -1 if it failed. If any argument's value is null, the method returns null. If an error occurs, throw the exception.

Examples

This statement signs the data with RAS and validates the signature.

Blob lblb_data
Blob lblb_privKey
Blob lblb_pubKey
Blob lblb_signature
Integer li_isPass

lblb_data = Blob("Test Rsa", EncodingANSI!)

CrypterObject lnv_CrypterObject
lnv_CrypterObject = Create CrypterObject

// Generate the private key
lnv_CrypterObject.AsymmetricGenerateKey(RSA!, 1024, lblb_privKey, lblb_pubKey)

// Sign data with RSA
lblb_signature = lnv_CrypterObject.AsymmetricSign(RSA!, lblb_data, lblb_privKey)

// Validate the RSA signature
li_isPass = lnv_CrypterObject.AsymmetricVerifySign(RSA!, lblb_data, lblb_pubKey, lblb_signature)
if li_isPass = 1 then
	messagebox("Success", "Verification succeeded!")
else
	messagebox("Error", "Verification failed!")
end if

See also

SymmetricEncrypt

SymmetricDecrypt

SymmetricGenerateKey

AsymmetricEncrypt

AsymmetricDecrypt

AsymmetricSign

AsymmetricGenerateKey

MD5

SHA

HMAC