Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # 16 bytes of random data in hex
- openssl rand 16 -hex
- # 16 bytes of random data in base64
- openssl rand 16 -base64
- # encrypt a file
- openssl enc -aes-256-cbc -in /tmp/foo -out /tmp/foo.out
- # alt to encrypt a file, add -a to output to base64, add -salt to use salt
- openssl aes-256-cbc -in /tmp/foo -out /tmp/foo.enc
- # decrypt
- openssl aes-256-cbc -d -in /tmp/foo/enc -out /tmp/foo.dec
- # generate RSA private key
- # 4096-bit private key, protected by password with AES256
- openssl genrsa -aes256 4096
- # 4096-bit private key, no password
- openssl genrsa 4096
- # but genrsa is deprecated in favor of genpkey:
- # 4096-bit private key, protected by password with AES256
- openssl genpkey -algorithm RSA -aes-256-cbc -pkeyopt rsa_keygen_bits:4096
- # 4096-bit private key, no password
- openssl genpkey -algorithm RSA -aes-256-cbc -pkeyopt rsa_keygen_bits:4096
- # Generate the matching public key
- # Assume that we used "-out private.pem" in the generation
- openssl rsa -in private.pem -pubout
Add Comment
Please, Sign In to add comment