SIGN$(file$, privatekey$)
Signs a file using a PEM private key and returns a detached escaped binary signature string.
The returned signature may be written to disk using BINWRITE and later verified using VERIFY.
Examples
REM First generate signature
SIG$ = SIGN$("editor.gz", "packages.key")
REM allocate memory for the signature as a raw buffer
m = MEMALLOC(64)
F = OPENOUT("editor.gz.sig")
REM Convert the string to a raw buffer
n = STRINGTOBUFFER(SIG$, m, 64)
REM write it to the file
BINWRITE F, m, n
CLOSE F
Notes
- file$ is the file to sign.
- privatekey$ is a PEM private key file.
- Returns an escaped detached Ed25519 signature string.
- The returned string should be converted to a binary buffer before storage.
- Detached signatures are normally stored with a .sig extension.
- Signatures generated by SIGN$ may be verified using VERIFY.
Errors
- File not found
- Error reading file
- Error reading private key
- Error signing package
- Out of memory reading file
- Out of memory reading private key
See also: VERIFY ยท BINWRITE