Skip to content

Instantly share code, notes, and snippets.

@roelds
Last active September 9, 2023 23:52
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save roelds/1c04360b608d515103463e8c25a8f709 to your computer and use it in GitHub Desktop.
Save roelds/1c04360b608d515103463e8c25a8f709 to your computer and use it in GitHub Desktop.
Use openssl with ed448 keys, to sign & verify shake256 digests
# will prompt for passphrase on stdin
openssl genpkey -out skey.pem -verbose -pass stdin -aes-256-cbc -algorithm ed448
openssl ec -in skey.pem -pubout -out pub.pem
# create hash
openssl shake256 -xoflen 64 -out dgst thefile
openssl pkeyutl -sign -inkey skey.pem -rawin -in dgst -out dgst.sig
openssl pkeyutl -verify -rawin -inkey pub.pem -pubin -sigfile dgst.sig -in dgst
# extract only checksum from digest
cat dgst | awk 'BEGIN { FS="=" } {print $2}' | cut -c2-
# extract only checksum from digest
(gc file.dgst) | % {$_.substring(($_.IndexOf('=') + 2))}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment