Reference > Functions reference > Container functions > CryptVerifySignature
 

CryptVerifySignature

Verifies whether a digital signature is valid for the data.

Format 

CryptVerifySignature ( data ; algorithm ; publicRSAKey ; signature )

Parameters 

data - any text expression that represents the data to verify against signature.

algorithm - the name of the cryptographic algorithm to use (see CryptAuthCode function).

publicRSAKey - text that represents the PKCS #1 RSA public key in PEM format corresponding to the private key used to generate signature.

signature - the binary RSA signature to verify against data, such as the value returned by the CryptGenerateSignature function.

Data type returned 

number

Originated in 

FileMaker Pro 18.0 Advanced

Description 

To verify a signature, this function compares the message digest of data (using the specified algorithm) to the digest obtained by decrypting signature using publicRSAKey.

An RSA public key must be in this format:

-----BEGIN PUBLIC KEY-----
MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAqqDiwrPQwVaJzOzfFVBd
...
egkXva5cYBb8PNifmlPXVb8CAwEAAQ==
-----END PUBLIC KEY-----

If the signature is valid for the data, this function returns 1 (true); if the signature is not valid, it returns 0 (false). If any of the parameters are invalid, it returns "?".

Notes 

This function is not supported in runtime solutions and returns "?".

Example 1 

Uses the SHA-512 algorithm to generate the digest of Table::SignedText. Base64-decodes the signature stored in the Table::Signature text field and returns it as container data. Decrypts the signature using the value in the Table::PublicRSAKey field and compares the signature digest with the digest based on the Table::SignedText field. If the signature is valid, returns 1.

CryptVerifySignature (
Table::SignedText ; "SHA512" ; Table::PublicRSAKey ;
Base64Decode (
Table::Signature ; "sig.data"
)
)

Related topics 

Functions reference (category list)

Functions reference (alphabetical list)

About formulas

About functions

Defining calculation fields

Using operators in formulas