Cryptography
Jump to navigation
Jump to search
Python Libs
https://cryptography.io/en/latest/hazmat/primitives/asymmetric/serialization/
pynacl
# ed25519 seems to have a bug but it is a newer commit.
from cryptography.hazmat.primitives.asymmetric import ed25519
key = ed25519.Ed25519PrivateKey.generate()
pk = key.public_key().public_bytes(serialization.Encoding.OpenSSH,
serialization.PublicFormat.OpenSSH)
Testing
url="https://portal.example.io/api/verify_jwt"
jwt_token=$(curl -s --request GET https://portal.example.io/api/get_jwt | jq .token | tr -d \")
curl ${url} \
-H "Authorization: Bearer ${jwt_token}" \
-H "Content-Type: application/json" \
-X POST -d \
'{"jsonrpc":"1.0","id":"curltext","method":"getnetworkinfo","params":[]}'
Notes
/dev/random vs /dev/urandom - know when you need or don't need it.