Back to product page
Verify method
Verifies signature of the signed Blob.
Type
A Boolean value. True if signature matches, False if signature is invalid.Syntax
- Basic
object.Verify (Data, Signature)
The Verify(object,Data,Signature) syntax has these parts:
The Verify(object,Data,Signature) syntax has these parts:
object | An expression evaluating to an object of type wodCrypt. |
Data | Required. A Blob object. Contains readable (plaintext) data - same as the one signed by the other party. |
Signature | Required. A Blob object. Contains signature received from other party. |
Remarks
The Verify method will use one of the selected algorithms (RSA or DSA) with MD5 digest, together with readable data and the owner's digital signature to verify if the signature is correct. As a result, a Boolean value True/False will be returned from the calculation. To verify the signature, you must have the public key of the owner set in the SecretKey property. If you wish to use SHA1 digest instead of MD5, you should use RSA+SHA1 or DSA+SHA1 constants.You should receive the PublicKey from the owner - you cannot generate one by yourself. This is because the public key is derived from the owner's private key - which only the real owner possesses.
Code sample
- Basic
When you have the owner's public key, readable data which you believe he signed, and his signature, you can verify it with the following code:
Dim crypt As New wodCryptCom
Dim i_blob As New MemBlob
Dim sig_blob As New MemBlob
Dim Key As New Keys
sig_blob.FromBase64 ("MC4CFQDoYDKp8Owxfp5iAmI5MIumvLY3BgIVAK5bqQgQ9W3OGA7DgCtML40uuKBL")
Key.Load "c:\keys\dsa.pem" ' this is only public key
i_blob.Text = "data to be signed"
crypt.Type = DSA
crypt.SecretKey = Key.PublicKey(DSAkey)
Debug.Print crypt.Verify(i_blob, sig_blob)
result:
True
Dim crypt As New wodCryptCom
Dim i_blob As New MemBlob
Dim sig_blob As New MemBlob
Dim Key As New Keys
sig_blob.FromBase64 ("MC4CFQDoYDKp8Owxfp5iAmI5MIumvLY3BgIVAK5bqQgQ9W3OGA7DgCtML40uuKBL")
Key.Load "c:\keys\dsa.pem" ' this is only public key
i_blob.Text = "data to be signed"
crypt.Type = DSA
crypt.SecretKey = Key.PublicKey(DSAkey)
Debug.Print crypt.Verify(i_blob, sig_blob)
result:
True