GenerateFileSignature
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.
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 Methodassoc, 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 allclose allBasic Examples (2)
Scope (5)
File Types (2)
Byte Ranges (1)
Operator Form (1)
Generate an elliptic curve–based key pair:
Apply the operator form of GenerateDigitalSignature to a file:
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:
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:
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:
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