Crypto.RSAVerifySignature
From Xojo Documentation
Method
Crypto.RSAVerifySignature(Data As MemoryBlock, Signature As MemoryBlock, PublicKey As String) As Boolean
New in 2013r4
Supported for all project types and targets.
New in 2013r4
Supported for all project types and targets.
Verifies the data using the specified signature and key using PKCS v1.5 with SHA1. Returns True if the signature is verified, False if it is not.
Sample Code
Verify a message:
Var privateKey As String
Var publicKey As String
If Crypto.RSAGenerateKeyPair( 1024, privateKey, publicKey ) Then
// 1024-bit private and public keys were generated
Var msg As String = "this is a test"
Var signature As MemoryBlock = Crypto.RSASign( msg, privateKey )
If signature <> Nil Then
// msg was successfully signed
// Verify signature
If Crypto.RSAVerifySignature( msg, signature, publicKey ) Then
// signature is valid
End If
End If
End If
Var publicKey As String
If Crypto.RSAGenerateKeyPair( 1024, privateKey, publicKey ) Then
// 1024-bit private and public keys were generated
Var msg As String = "this is a test"
Var signature As MemoryBlock = Crypto.RSASign( msg, privateKey )
If signature <> Nil Then
// msg was successfully signed
// Verify signature
If Crypto.RSAVerifySignature( msg, signature, publicKey ) Then
// signature is valid
End If
End If
End If