# Command Line Encryption

## wswartzendruber

I'm looking for a solid method to encryption files (or stdio) via the command line.  It can be either symmetric or asymmetric.

----------

## Telemin

Surely gpg is the best one?

----------

## wswartzendruber

 *freestyling wrote:*   

> Surely gpg is the best one?

 

That's the thinking on #gentoo-chat.  I'm trying to find a way to set a default symmetric algorithm and disable compression.

----------

## Telemin

Well to encrypt from stdin:

```

gpg --symmetric -a > myencryptedfilename

```

And to decrypt to stdout:

```

gpg --decrypt -a myencryptedfilename

```

-Freestyling-

----------

## John R. Graham

Or, use openssl, which you already have installed.  For example

```
openssl enc -e -aes-128-cbc -in cleartext.foo -out ciphertext.bar
```

openssl supports lots of ciphers and encryption modes.  See "man openssl-enc".    :Smile: 

- John

----------

