WOLFRAM

Enable JavaScript to interact with content and submit forms on Wolfram websites. Learn how
Wolfram Language & System Documentation Center

GenerateFileSignature ["file",key]

generates a digital signature of file using the specified private key.

GenerateFileSignature [{"file",range},key]

generates a digital signature of the specified range of bytes in the file.

GenerateFileSignature [{{"file1",range1},{"file2",range2},},key]

generates digital signatures for each specified filei and rangei.

GenerateFileSignature [key]

represents an operator form of GenerateFileSignature that can be applied to files.

Details and Options
Details and Options Details and Options
Examples  
Basic Examples  
Scope  
File Types  
Byte Ranges  
Operator Form  
Multiple Files  
Options  
Method  
Properties & Relations  
Possible Issues  
See Also
Related Guides
History
Cite this Page

GenerateFileSignature ["file",key]

generates a digital signature of file using the specified private key.

GenerateFileSignature [{"file",range},key]

generates a digital signature of the specified range of bytes in the file.

GenerateFileSignature [{{"file1",range1},{"file2",range2},},key]

generates digital signatures for each specified filei and rangei.

GenerateFileSignature [key]

represents an operator form of GenerateFileSignature that can be applied to files.

Details and Options

  • GenerateFileSignature returns a DigitalSignature object.
  • Values produced by GenerateFileSignature are based on the raw bytes in a file.
  • The type of signature is determined by the type of the key.
  • The key is a PrivateKey object. Possible types of keys are "EllipticCurve" and "RSA".
  • GenerateFileSignature supports the following range specifications:
  • n first n bytes
    -n last n bytes
    {m,n} bytes m through n
    0 no bytes
    All all bytes
  • Range specification All is equivalent to {1,-1}.
  • GenerateFileSignature [File ["file"],] and GenerateFileSignature [CloudObject [],] are also supported.
  • GenerateFileSignature has the following option:
  • Method Automatic details of signature method
  • With the setting Method assoc, the association assoc gives details of the signature method to use.
  • For "RSA", the following elements may be included in the association:
  • "HashingMethod" "SHA256" how to hash the contents of the file
    "Padding" "PKCS1" padding scheme to use
  • Currently supported padding schemes are "PKCS1" and "X931".
  • For "RSA", supported values of "HashingMethod" are the same as in GenerateDigitalSignature .
  • For "EllipticCurve" and "Schnorr", the following elements may be included in the association:
  • "CurveName" "secp256k1" elliptic curve to use
    "HashingMethod" "SHA256" how to hash the contents of the file
    "SignatureType" Automatic mode of digital signature generation
  • Possible settings for "CurveName" are listed in $CryptographicEllipticCurveNames .
  • The only elliptic curve currently supported is "secp256k1".
  • "HashingMethod""h" effectively hashes the bytes in the file using Hash [...,"h"].
  • Possible settings for "SignatureType" include:
  • "Deterministic" use expr as a source of pseudorandomness
    "NonDeterministic" use a system-specific source of randomness
    Automatic use non-deterministic methods when possible, and deterministic otherwise
  • For hashing methods "Adler32" and "CRC32", "SignatureType""Deterministic" uses "SHA256" to derive pseudorandomness from the input.
  • See GenerateDigitalSignature for full general information.

Examples

open all close all

Basic Examples  (2)

Choose a file to generate a digital signature for:

Generate an elliptic curvebased key pair:

Generate a digital signature using your private key:

Verify a digital signature using your public key:

Sign and verify the signature for a file using an RSA key pair:

Scope  (5)

File Types  (2)

Digitally sign a CloudObject :

Create a signature of the file specified by a File object:

Byte Ranges  (1)

Sign different parts of the file separately:

Compute a signature for the first 100 bytes of a file:

Compute a signature for the last 100 bytes:

Compute a signature for bytes 100 through 200:

Compute a signature for all bytes except for the first 100:

Verify them all at once:

Operator Form  (1)

Generate an elliptic curvebased key pair:

Apply the operator form of GenerateDigitalSignature to a file:

Verify a digital signature using your public key:

Multiple Files  (1)

Sign several files with the same set of keys:

Verify their signatures:

Options  (1)

Method  (1)

Use a full Method option layout to generate a deterministic digital signature based on pseudorandomness derived from your input using the SHA512 hashing function:

Generate a signature using double SHA256 hashing:

Properties & Relations  (1)

Uploading a file to the Wolfram Cloud keeps the contents of the file intact. When verifying the digital signatures of the original file and the cloud copy, they are both valid:

Copy a file to the cloud:

Create the signature for the local file:

Create the signature for the file in the cloud:

All possible combinations of files and signatures are valid:

Possible Issues  (1)

If the selected ranges of bytes are identical for two files, then the file signatures will be the same:

Find the first file and digitally sign the first 150 bytes of it:

Find and sign the first 150 bytes of the second file:

The signatures produced are verifiable for either file:

For RSA the signatures are also the same:

Wolfram Research (2020), GenerateFileSignature, Wolfram Language function, https://reference.wolfram.com/language/ref/GenerateFileSignature.html (updated 2020).

Text

Wolfram Research (2020), GenerateFileSignature, Wolfram Language function, https://reference.wolfram.com/language/ref/GenerateFileSignature.html (updated 2020).

CMS

Wolfram Language. 2020. "GenerateFileSignature." Wolfram Language & System Documentation Center. Wolfram Research. Last Modified 2020. https://reference.wolfram.com/language/ref/GenerateFileSignature.html.

APA

Wolfram Language. (2020). GenerateFileSignature. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/GenerateFileSignature.html

BibTeX

@misc{reference.wolfram_2025_generatefilesignature, author="Wolfram Research", title="{GenerateFileSignature}", year="2020", howpublished="\url{https://reference.wolfram.com/language/ref/GenerateFileSignature.html}", note=[Accessed: 05-December-2025]}

BibLaTeX

@online{reference.wolfram_2025_generatefilesignature, organization={Wolfram Research}, title={GenerateFileSignature}, year={2020}, url={https://reference.wolfram.com/language/ref/GenerateFileSignature.html}, note=[Accessed: 05-December-2025]}

Top [フレーム]

AltStyle によって変換されたページ (->オリジナル) /