Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Create a private/public key pair (4096 bits RSA)
- openssl genrsa -out key.pem 4096
- # Check the private key
- openssl rsa -check -noout -in key.pem
- # Print the private key data
- openssl rsa -text -noout -in key.pem
- # Extract the public key
- openssl rsa -in key.pem -pubout > public.pem
- # Print the public key data
- openssl pkey -inform PEM -pubin -text -noout -in public.pem
- # Sign the file sample.txt
- openssl dgst -sha256 -sign key.pem -out sample.txt.sig.sha256 sample.txt
- # Verify the signature of file sample.txt
- openssl dgst -sha256 -verify public.pem -signature sample.txt.sig.sha256 sample.txt
- # You need a public key only file for the verification. If you have the certificate for the verification you
- # can extract the public key from the certificate file
- openssl x509 -in key.crt -pubkey -noout >public.pem
Advertisement
Add Comment
Please, Sign In to add comment