VerifyDigitalSignature[{expr,sig},key]
verifies the digital signature sig for expr using the specified public key.
VerifyDigitalSignature[{{expr1,sig1},{expr2,sig2},…},key]
verifies the digital signatures sigi for each of the expri, all using the specified public key.
is an operator form of VerifyDigitalSignature, suitable for application to {expr,sig} or a list of such pairs.
VerifyDigitalSignature
VerifyDigitalSignature[{expr,sig},key]
verifies the digital signature sig for expr using the specified public key.
VerifyDigitalSignature[{{expr1,sig1},{expr2,sig2},…},key]
verifies the digital signatures sigi for each of the expri, all using the specified public key.
is an operator form of VerifyDigitalSignature, suitable for application to {expr,sig} or a list of such pairs.
Details
- The signature in VerifyDigitalSignature must be a DigitalSignature object generated by GenerateDigitalSignature.
- The key in VerifyDigitalSignature should be a PublicKey object.
- VerifyDigitalSignature returns True or False for each provided signature, indicating whether or not the signatures are valid.
Examples
open all close allBasic Examples (2)
Generate an elliptic curve–based key pair:
keys = GenerateAsymmetricKeyPair["EllipticCurve"]Generate a digital signature using your private key:
message = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";signature = GenerateDigitalSignature[message, keys["PrivateKey"]]Verify a digital signature using your public key:
VerifyDigitalSignature[{message, signature}, keys["PublicKey"]]Sign a message using a hashing function of your choice:
keys = GenerateAsymmetricKeyPair["EllipticCurve"]message = "Would you marry me Amélie?";signature = GenerateDigitalSignature[message, keys["PrivateKey"], Method -> <|"Type" -> "EllipticCurve", "HashingMethod" -> "RIPEMD160"|>]Verification will automatically consider the hashing function used for signing:
VerifyDigitalSignature[{message, signature}, keys["PublicKey"]]Scope (3)
Single Signature (1)
Generate a digital signature of an existing message digest:
digest = "03b55d86a0c211f943d1e333f53d1b17f6fc66079a15926b51613560f6f5dcf8";keys = GenerateAsymmetricKeyPair["EllipticCurve"]signature = GenerateDigitalSignature[digest, keys["PrivateKey"], Method -> <|"Type" -> "EllipticCurve", "HashingMethod" -> None|>]When verifying the signature, the digest will not be hashed again:
VerifyDigitalSignature[{digest, signature}, keys["PublicKey"]]Multiple Signatures (1)
Create signatures of several messages:
keys = GenerateAsymmetricKeyPair["EllipticCurve"]messages = {"Would you marry me Amélie?", "Let's meet tomorrow at noon"};signatures = GenerateDigitalSignature[#, keys["PrivateKey"]]& /@ messagesVerifyDigitalSignature[Transpose[{messages, signatures}], keys["PublicKey"]]Operator Form (1)
Generate an elliptic curve–based key pair:
keys = GenerateAsymmetricKeyPair["EllipticCurve"]Generate a digital signature using your private key:
message = "The Times 03/Jan/2009 Chancellor on brink of second bailout for banks";signature = GenerateDigitalSignature[message, keys["PrivateKey"]]Verify a digital signature using your public key:
VerifyDigitalSignature[keys["PublicKey"]][{message, signature}]Applications (5)
Security Certificates (1)
Verify the signature in a self-signed certificate. Import the certificate:
cert = First[Import[**"ExampleData/selfcertified.cer"**]]In a self-signed certificate, the issuer and the subject of the certificate are the same entity:
SameQ[cert["Issuer"], cert["Subject"]]Verify if the signature is valid for the key and the information on the certificate:
VerifyDigitalSignature[{cert["SignedData"], cert["DigitalSignature"]}, cert["PublicKey"]]Cryptocurrencies Networks (2)
Generate a digital signature compatible with Bitcoin network requirements:
keys = GenerateAsymmetricKeyPair["Bitcoin"]digest = ByteArray["A4AaBgAEzCrPVgQzww83CF1KOa1UOwwACkJXIFN1cHBvcnQgOE0gCmZpc2hlciBqaW54aW4JL0JXIFBvb2wv"];signature = GenerateDigitalSignature[digest, keys["PrivateKey"], Method -> <|"Type" -> "EllipticCurve", "CurveName" -> "Bitcoin", "HashingMethod" -> "SHA256SHA256", "SignatureType" -> "Deterministic"|>]VerifyDigitalSignature[{digest, signature}, keys["PublicKey"]]Generate a digital signature compatible with Ethereum network requirements:
keys = GenerateAsymmetricKeyPair["Ethereum"]digest = ByteArray[
"A4AaBgAEzCrPVgQzww83CF1KOa1UOwwACkJXIFN1cHBvcnQgOE0gCmZpc2hlciBqaW54aW4JL0JXIFBvb2wvChQerJZv"];signature = GenerateDigitalSignature[digest, keys["PrivateKey"], Method -> <|"Type" -> "EllipticCurve", "CurveName" -> "Ethereum", "HashingMethod" -> "Keccak256", "SignatureType" -> "Deterministic"|>]VerifyDigitalSignature[{digest, signature}, keys["PublicKey"]]Byte Arrays (1)
Use raw ByteArray data directly:
digest = ByteArray["ertiQstapidT0pBswTgCFlkAAQ2DPTN9YW6m0Ffeg9k="];keys = GenerateAsymmetricKeyPair["EllipticCurve"]Use "HashingMethod"->None if you have an already hashed digest:
signature = GenerateDigitalSignature[digest, keys["PrivateKey"], Method -> <|"Type" -> "EllipticCurve", "HashingMethod" -> None|>]When verifying the signature, the digest will not be hashed again:
VerifyDigitalSignature[{digest, signature}, keys["PublicKey"]]Sign Files (1)
Generate a pair of elliptic curve keys:
keys = GenerateAsymmetricKeyPair["EllipticCurve"]Import the contents of the file you wish to sign:
file = FindFile["ExampleData/ocelot.jpg"];
bytes = ByteArray[Import[file, "Byte"]];Create a signature for the imported bytes of the file:
signature1 = GenerateDigitalSignature[bytes, keys["PrivateKey"]]Equivalently, this can be done using GenerateFileSignature on the file directly:
signature2 = GenerateFileSignature[file, keys["PrivateKey"]]Both signatures are verifiable:
VerifyDigitalSignature[keys["PublicKey"]][{
{bytes, signature1},
{bytes, signature2}
}]VerifyFileSignature[keys["PublicKey"]][{
{file, signature1},
{file, signature2}
}]Related Guides
Related Workflows
- Create and Verify a Cryptographic Digital Signature
History
Text
Wolfram Research (2019), VerifyDigitalSignature, Wolfram Language function, https://reference.wolfram.com/language/ref/VerifyDigitalSignature.html.
CMS
Wolfram Language. 2019. "VerifyDigitalSignature." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/VerifyDigitalSignature.html.
APA
Wolfram Language. (2019). VerifyDigitalSignature. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/VerifyDigitalSignature.html
BibTeX
@misc{reference.wolfram_2026_verifydigitalsignature, author="Wolfram Research", title="{VerifyDigitalSignature}", year="2019", howpublished="\url{https://reference.wolfram.com/language/ref/VerifyDigitalSignature.html}", note=[Accessed: 13-June-2026]}
BibLaTeX
@online{reference.wolfram_2026_verifydigitalsignature, organization={Wolfram Research}, title={VerifyDigitalSignature}, year={2019}, url={https://reference.wolfram.com/language/ref/VerifyDigitalSignature.html}, note=[Accessed: 13-June-2026]}