106
Security / Re: Stepping up the crypto game... How to generate bigger/more secure PGP keys??
« on: September 09, 2013, 04:29 am »
First, do yourself a favor and replace the gpg.conf that came with your app with this:
If you have multiple keys, you can set a default with:
default-key <key ID>
Command line gpg is easy to use. There are a handful of basic commands, and gpg will ask you for any input that it needs if you haven't provided it. I can give you a run down of the basic commands right now. For the commands that require input, you can either specify a file or type/paste stuff directly in the command prompt window.
I will use the "gpg" command, but on Windows you'll have to use "gpg.exe".
To import a key:
gpg --import
If you just type that, you'll see a cursor in the command window and can paste the key in the window. After pasting it in, hit CTRL+D. Otherwise you can save the key in a file and specify that:
gpg --import buddy.key
To print out your public key, so you can give it to other people:
gpg --export KEYINFO
Where KEYINFO is either the name, email address or key ID. gpg will search your key ring and use the first match. If it's a long name, you only need to supply a part of it, enough that it uniquely matches that key.
The previous command will print it in the command window. You can put the output in a file with redirection:
gpg --export KEYINFO > pub.key
Ok, with the basic importing and exporting out of the way, we're ready to do encryption. The simplest command to encrypt is:
gpg -e
Yep, that's it. If you don't supply the recipients, it will ask you for them. Just type in some key info, like above, either part of the name, email address, or key ID. You can add as many recipients as you want, and hit enter (blank recipient) to stop adding recipients.
Then you'll get a cursor to type your message. and when you're done, hit CTRL+D, and it will spit the encrypted block into the command window.
Alternatively you can type your message in a text file and specify that.
gpg -e message.txt
And you can specify the recipients too, although I'm too lazy to do that and let it prompt me.
gpg -r astor -r bedtime666 -e message.txt
It will create a file called message.txt.asc which contains the encrypted message.
To decrypt a message:
gpg -d
And you can paste the message in the command window, then hit CTRL+D. Or specify the file:
gpg -d encrypted_message.txt
That's enough to get you started.
Quote
no-greeting
no-emit-version
no-comments
utf8-strings
armor
expert
trust-model always
no-mdc-warning
personal-cipher-preferences AES256 TWOFISH CAMELLIA256 AES192 CAMELLIA192 AES CAMELLIA128 CAST5 3DES BLOWFISH
personal-digest-preferences SHA512 SHA384 SHA256 SHA224 RIPEMD160 SHA1
personal-compress-preferences BZIP2 ZLIB ZIP Uncompressed
cert-digest-algo SHA512
If you have multiple keys, you can set a default with:
default-key <key ID>
Command line gpg is easy to use. There are a handful of basic commands, and gpg will ask you for any input that it needs if you haven't provided it. I can give you a run down of the basic commands right now. For the commands that require input, you can either specify a file or type/paste stuff directly in the command prompt window.
I will use the "gpg" command, but on Windows you'll have to use "gpg.exe".
To import a key:
gpg --import
If you just type that, you'll see a cursor in the command window and can paste the key in the window. After pasting it in, hit CTRL+D. Otherwise you can save the key in a file and specify that:
gpg --import buddy.key
To print out your public key, so you can give it to other people:
gpg --export KEYINFO
Where KEYINFO is either the name, email address or key ID. gpg will search your key ring and use the first match. If it's a long name, you only need to supply a part of it, enough that it uniquely matches that key.
The previous command will print it in the command window. You can put the output in a file with redirection:
gpg --export KEYINFO > pub.key
Ok, with the basic importing and exporting out of the way, we're ready to do encryption. The simplest command to encrypt is:
gpg -e
Yep, that's it. If you don't supply the recipients, it will ask you for them. Just type in some key info, like above, either part of the name, email address, or key ID. You can add as many recipients as you want, and hit enter (blank recipient) to stop adding recipients.
Then you'll get a cursor to type your message. and when you're done, hit CTRL+D, and it will spit the encrypted block into the command window.
Alternatively you can type your message in a text file and specify that.
gpg -e message.txt
And you can specify the recipients too, although I'm too lazy to do that and let it prompt me.
gpg -r astor -r bedtime666 -e message.txt
It will create a file called message.txt.asc which contains the encrypted message.
To decrypt a message:
gpg -d
And you can paste the message in the command window, then hit CTRL+D. Or specify the file:
gpg -d encrypted_message.txt
That's enough to get you started.