Skip to content
Simple .NET asymmetric encryption implementation
C# Shell
Branch: master
Clone or download

Latest commit

Fetching latest commit…
Cannot retrieve the latest commit at this time.

Files

Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Binary
Properties
.gitattributes
.gitignore
AsymmetricCrypt.csproj
AsymmetricCrypt.sln
LICENSE-2.0
Program.cs
README.md
unit-test.cmd

README.md

AsymmetricCrypt

Simple .NET asymmetric encryption implementation

Purpose:

data encryption on the systems, where storing password or key in cleartext is not desirable option.

Usage:

Tool will use standard io streams where possible, or files could be specified on command line

Generate private key:

AsymmetricCrypt --genkey private.key
AsymmetricCrypt --genkey >private.key

Extract public key component from private key:

AsymmetricCrypt --publickey private.key public.key
AsymmetricCrypt --publickey <private.key >public.key

Encrypt file using public key:

AsymmetricCrypt --encrypt public.key plaintext.txt encrypted.ascr
AsymmetricCrypt --encrypt public.key <plaintext.txt >encrypted.ascr

Decrypt file using private key:

AsymmetricCrypt --decrypt private.key encrypted.ascr plaintext.txt
AsymmetricCrypt --decrypt private.key <encrypted.ascr >plaintext.txt

Internals:

Each file is encrypted using AES256 with randomly generated key. AES256 key is encrypted using 4096 bit RSA and stored with the file.

File structure:

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

Installing on Ubuntu:

Install using following commands:

sudo apt-get install mono-runtime libmono-system2.0-cil wget
sudo mkdir -p /usr/lib/ascry
sudo wget https://raw.github.com/galets/AsymmetricCrypt/master/Binary/AsymmetricCrypt.exe \
          -O /usr/lib/ascry/AsymmetricCrypt.exe
sudo chmod +x /usr/lib/ascry/AsymmetricCrypt.exe
sudo ln -s /usr/lib/ascry/AsymmetricCrypt.exe /usr/bin/ascry
You can’t perform that action at this time.