Last active
September 9, 2023 23:52
-
-
Save roelds/1c04360b608d515103463e8c25a8f709 to your computer and use it in GitHub Desktop.
Use openssl with ed448 keys, to sign & verify shake256 digests
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# extract only checksum from digest | |
cat dgst | awk 'BEGIN { FS="=" } {print $2}' | cut -c2- |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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