oneway: simple file encryption

emailoneway is a simple asymmetric encryption implementation in C++ and a tool to encrypt or decrypt files without having a complex setup like GPG. oneway uses the openssl library and can be used from the cmdline. The tool is compatible with the .NET utility (for Windows) AsymmetricCrypt.

oneway is to be used for data encryption on systems where storing password or key in plaintext is not desirable. It uses one of the strongest encryption techniques, AES256, to encrypt files and the key is randomly generated. AES256 key is encrypted using 4096 bit RSA and stored with the file. The structure of the encrypted file is:

4 bytes: signature "ASCR"
16 bytes: AES IV
512 bytes: RSA 4096-encrypted AES key
rest: encrypted file contents


oneway has to be compiled from source. However, the procedure is simple due to minimal dependencies. Get the git source and compile it:

$ git clone
$ cd oneway-cpp
$ make


  • Generate private key:
    $ oneway --genkey private.key
    $ oneway --genkey >private.key
  • Extract public key component from private key:
    $ oneway --publickey private.key public.key
    $ oneway --publickey <private.key >public.key
  • Encrypt file using public key:
    $ oneway --encrypt public.key plaintext.txt encrypted.ascr
    $ oneway --encrypt public.key plaintext.txt >encrypted.ascr
    $ oneway --encrypt public.key <plaintext.txt >encrypted.ascr
  • Decrypt file using private key:
    $ oneway --decrypt private.key encrypted.ascr plaintext.txt
    $ oneway --decrypt private.key encrypted.ascr >plaintext.txt
    $ oneway --decrypt private.key <encrypted.ascr >plaintext.txt

Webpage: oneway

Leave a Reply

Your email address will not be published. Required fields are marked *