Topics   All   Mac OS X (Only)   Windows (Only)   Linux (Only, Not)   iOS (Only, Not)  
Components   Crossplatform Mac & Win   Server (Not)   Client   Old   Guides   Examples
New in version: 6.2   6.3   6.4   6.5   7.0   7.1   7.2   7.3   7.4   7.5    Statistic  

RSA.Verify

Verifies RSA digital signature.

Component Version macOS Windows Server FileMaker Cloud FileMaker iOS SDK
Sign 6.2 Yes Yes Yes Yes Yes

MBS( "RSA.Verify"; Algorithm; InputType; InputData; InputEncoding; KeyType; KeyData; KeyEncoding; SigType; SigData; SigEncoding { ; PasswordType; PasswordData; PasswordEncoding } )

Parameters

Parameter Description Example value
Algorithm Which algorithm to use. Can be MD4, MD5, SHA, SHA1, MDC2, RIPEMD160, SHA224, SHA256, SHA384 or SHA512. "SHA512"
InputType The type of input data.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Text"
InputData The actual input data.
Text, container or file path.
"Hello World"
InputEncoding The text encoding for text input.
Parameter is ignored for other cases.
"UTF-8"
KeyType The type of input for private or public key.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Text"
KeyData The actual input data for the key.
Text, container or file path. Must not be longer than the maximum key length of the given algorithm. If key is too short, we pad it with zero bytes.
"Hello World"
KeyEncoding The text encoding for text input for the key.
Parameter is ignored for other cases.
"UTF-8"
SigType The type of input data for signature.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Text"
SigData The actual input data for signature.
Text, container or file path.
"Hello World"
SigEncoding The text encoding for text input.
Parameter is ignored for other cases.
"UTF-8"
PasswordType Optional
The type of input for the password of the private key.
Can be Text, Container, Image, Path, PDF, Data, base64 or Hex.
"Text"
PasswordData Optional
The actual input data for the password of the private key.
Text, container or file path. Must not be longer than the maximum key length of the given algorithm. If key is too short, we pad it with zero bytes.
"Hello World"
PasswordEncoding Optional
The text encoding for text input.
Parameter is ignored for other cases.
"UTF-8"

Result

Returns 1, 0 or error.

Description

Verifies RSA digital signature.
Returns 1 if signature is valid or 0 if not or an error if parameters are wrong.
Key can be the public or private key, but of course normally you use the public key.
A hash is created with given algorithm and verified with the signature.
Signature must be the string returned like from RSA.Sign function.

Optional you can pass a password to read password protected keys.

Examples

Verify with all data in files:

MBS( "RSA.Verify";
"SHA1";
"Path"; "/Users/cs/Desktop/Sign and Verify/Create Keys.rtf"; "";
"Path"; "/Users/cs/Desktop/Sign and Verify/test.pub"; "";
"Path"; "/Users/cs/Desktop/Sign and Verify/signature.sha1"; "";
"Text"; ""; "" )

Verify with passing signature as hex text:

MBS( "RSA.Verify";
"SHA512";
"Text"; "Hello World. This is test data to sign."; "UTF8";
"Path"; "/Users/cs/Desktop/Sign and Verify/test.pub"; "";
"Hex"; "CD603612768BD33F2C0C0DE1E71658F91914DCE083D96F0CE69490AE53F8711853D1589E08E67956812AA47B4FB20F91F4A25D3D1E9CF10827664D6D2DEF807118FF5A96CBE5538AB66351D5CC39457573DB54C5C5D990EDA15F9A977C47EDB213419CC949D40007F08D6847405BA01F7D9512017A8B99A8C8E768FB9FE300F2E42311078A75717340531B1AB5D81F948387C1866F766A19DEA976F04821393E6560099F89E7E7C9064FE4AEEEA8AE47047C4AA9C24DF207031A1EAE2049C7EE62272493804559BA87A7C67B514D85998C4F54E504F56FE6772A93E325BC2964EFBBBD4E4C454862F15B68F4DEDC2A58EC15CF1150405E5F92A679CDEC1266AE87B5E78F63C4F46FAFA56502BE6BB2CD500B290EEE94D592C6E60B003C7A6E5D2BC5A7D524C9F078F350BFCDC5CB16EDA07283456732A6BE302EB7D9B599FC3AC4E741048E325FD7C9A358138EB6586703DE8F5BFAF6BF303F251519D4B7EDAC64C1E3E687815BF92A1C729B74EE1F7A856383FF22C9328C6576EB232B015531170755C67207AC92BDCCEE93882CECF43F427A7FC536ACD8E0D773D7BDD4BE9012B76FA628B27AA9EB521F8F42138858A6C8158FF9A46DC476D0A2CB5B396CD6133CDAFD22073FAA80DA91642AE75E7B6B30F700A6EC941A00835BC2EF0FE7688F78C79A15941678B2629B51D9D9BACC1BB832E82DEDFA02565685444821B0BA"; "";
"Text"; ""; "" )

Verify some text:

Set Variable [$r; Value:MBS( "RSA.Verify"; Table::Algorithm; "Text"; Table::Text to Sign; "UTF8"; "Text"; Table::PublicKey; "UTF8"; "Hex"; Table::Signature )]
If [$r = 1]
    Show Custom Dialog ["Signature valid"]
Else If [$r = 0]
    Show Custom Dialog ["Signature invalid"]
Else
    Show Custom Dialog ["Error"; MBS("Text.RemovePrefix"; $r; "[MBS] ")]
End If

See also

Example Databases


RSA.Sign   -   RegEx.CaptureCount

Feedback: Report problem or ask question.




Links
MBS Xojo Chart Plugins