Blog Moved

Showing posts with label ssh. Show all posts
Showing posts with label ssh. Show all posts

Thursday, February 12, 2015

Creating, Modifying, Etc, SSH Keys

Another "remind myself how to do things" post.

To create a new ssh key:
ssh-keygen -t rsa -b 2048 -C "COMMENT"
 To change the passphrase on a key:
ssh-keygen -p -f KEYFILE [-P OLDPASS] [-N NEWPASS]
 There's a nice guide to this sort of thing here.

Simple Encryption With OpenSSL

Every once in a while, I need to transfer something from one computer to another, and emailing it to myself is an easy way to do it. But sometimes what I want to transfer isn't something I want out in the open. So the obvious thing to do is encrypt it, and the obvious tool to use to do this is openssl.

Here, so I remember it, is the command for doing this:
openssl enc -des -a -e -pass pass:PASSWORD -in INFILE -out OUTFILE
If you leave out INFILE or OUTFILE, it defaults to stdin and stdout. So you can do:
echo "This is  a secret" | openssl enc -des -a -e -pass pass:PASSWORD
and the encrypted version will be written to the terminal.

To decrypt:
openssl enc -des -a -d -pass pass:PASSWORD -in ENCRYPTED -out DECRTYPED
Or, again:
echo "U2FsdGVkX1+Kqcs+25e+6MiQBr4NT8ykx3POhv9yAf9gnvSn4D2L0A==" | openssl enc -des -a -d -pass pass:PASSWORD
And again you'll get the decrypted version written to the terminal.