GithubHelp home page GithubHelp logo

cipher's Introduction

CIPHER

cipher v0.0.1

Purpose

A project to learn basic of RSA encryption.

Generate big RSA keys (8192, 16384, 32768, ...) and encrypt file with them using RSA encryption directly and not using a faster (but less secured) symmetric key.

This project has only one external dependency, the cobra project to manage command line. It uses math/big library, but compute it-self the needed primes numbers and RSA key various numbers. It's possible to update the code to raise the prime probability to be true until the point you want. it'll be just slower.

Install

  • prerequisite: have go installed and GOPATH set
  • install glide: go get glide
  • clone this project in ĜOPATH/src/github.com/freignat91/cipher
  • execute: glide update
  • execute: make install
  • then the command cipher is available

For Ubuntu, you have a pre-build cipher.ubuntu file you can use without cloning and building the projet.

Usage

global options

  • --help help on command
  • -v verbose, display information during command execution
  • -debug: display more information during command execution

cipher createKeys [keyPath] -size [keysize]

This commande generates [keyPath].pub and [keyPath].key keys (public and private) having [keysize] bits long

cipher encryptFile [sourceFilePath] [targetFilePath] [publicKeyPath]

This command encrypt the file [sourceFilePath] and save the result in [targetFilePath] using the public key [publicKeyPath]

cipher decryptFile [sourceFilePath] [targetFilePath] [privateKeyPath]

This command decrypt the file [sourceFilePath] and save the result in [targetFilePath] using the private key [privateKeyPath]

speed

Using key size from 8192 to 32768 take time:

on a Latitude E6540 under ubuntu 16.10:

average key creation time:

  • 2048 bits: < 1s
  • 4096 bits: ~12 seconds - 20 seconds
  • 8192 bits: ~140 seconds - 300 seconds
  • 16284 bits: ~500 seconds - 2 hours
  • 32768 bits: ~9 hours - several days

it's possible to use intermediate size, all 64 bits multiple are accepted.

encryption time:

  • 2038 bits: ~60 ko/s
  • 4096 bits: ~19 ko/s
  • 8192 bits: ~6 Ko/s
  • 16284 bits: ~2 ko/s
  • 32768 bits: ~500 oct/s

decryption time:

  • 2038 bits: ~15 ko/s
  • 4096 bits: ~5 Ko/s
  • 8192 bits: ~2.5 Ko/s
  • 16284 bits: ~500 oct/s
  • 32768 bits: ~200 oct/s

ok, it's pretty slow, that's why RSA is more used to encrypt symetric key which is used to encrypt/decrypt file, but it's far more secured.

For security reason, don't share your public and private keys. They should stay secret in this context, (encrypt/decrypt your own files). The encrypt/decryption algorithm of this project don't use any padding scheme. It's not a security issue if the keys stay secret and especially are not used to authenticate.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.