Skip to content

Instantly share code, notes, and snippets.

@robinchrist
Created October 15, 2024 23:56
Show Gist options
  • Save robinchrist/aeeb98d8e8e0843a5b672d67941e8985 to your computer and use it in GitHub Desktop.
Save robinchrist/aeeb98d8e8e0843a5b672d67941e8985 to your computer and use it in GitHub Desktop.
Botan Notes

Generate Ed448 Key pair

./botan keygen --algo=Ed448 | tee priv.key
./botan pkcs8 priv.key --pub-out | tee pub.key.pem
./botan pkcs8 priv.key --pub-out --der-out | tee pub.key.der
xxd -i pub.key.der > pub_key_der.h

Sign file: IMPORTANT!! Specify --hash="", otherwise Botan CLI will use --hash=SHA-256 and you won't be able to programatically verify the hashes with the default Ed448 settings, e.g. Botan::PK_Verifier verifier(*pubkey, "Pure"); or Botan::PK_Verifier verifier(*pubkey, ""); (with pubkey being an Ed448 key)

./botan sign --hash="" priv.key file_to_sign > signature
./botan verify --hash="" pub.key.pem file_to_sign signature

Sign file efficient (CANNOT verify with botan verify)

./botan sign --hash="" priv.key file_to_sign | base64 -d > signature
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment