Skip to content

DaVinci CLI tool - Fastest and secure way to encrypt and decrypt large files.

License

Notifications You must be signed in to change notification settings

eminmuhammadi/davinci

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unit tests Davinci CLI Test CodeQL

DaVinci

Fastest and secure way to encrypt and decrypt large files.

Installation

You can download binary files for each platform from the latest releases.

Usage

  • Generate passphrase (stored in a file)
davinci new-passphrase --folder ./path-to-folder

Returns a passphrase in the file passphrase.txt

  • Generate public and private key (stored in a file)
davinci new-keypair --size 2048 --passphrase ./passphrase.txt --folder ./path-to-folder

Returns the public key in the file publicKey.pem and the private key in the file privateKey.pem.

  • Generate Symmetric key (stored in a file)
davinci key --folder ./path-to-folder

Return the symmetric key in the file key.txt.

  • Encrypt a file
davinci encrypt --input ./file.ext --output ./file-decrypted.ext --key ./key.txt --passphrase ./passphrase.txt --public-key ./publicKey.pem

Encrypts the file file.ext using the key key.txt (encrypted using RSA) and stores the result in file-decrypted.ext.

  • Decrypt a file
davinci decrypt --input ./file-decrypted.ext --output ./file.ext --passphrase ./passphrase.txt --private-key ./privateKey.pem

Decrypts the file file-decrypted.ext using the key key.txt (encrypted using RSA) and stores the result in file.ext.

Building (obfuscated version)

go install
bash build.sh

# or

chmod +x build.sh
./build.sh

Algorithm Specification

Key Generation:

  • Generate the public and private key pair, afterwards we call this pubK and privK.
  • Generate the symmetric key, afterwards we call this R.

Encryption:

  • Encrypt symmetric key using the public key. Enc(R, pubK), afterwards we call this R_enc.
  • Encrypt file using the symmetric key. Enc(file, R), afterwards we call this file_enc. The generated file will be in this format: R_enc + \n + file_enc

Decryption:

  • Decrypt symmetric key using the private key. Dec(R_enc, privK)=R
  • Decrypt file using the decrypted symmetric key. Dec(file_enc, R)

Requirements

Dependencies

  • CLI Framework
    • github.com/cpuguy83/go-md2man/v2
    • github.com/russross/blackfriday/v2
    • github.com/urfave/cli/v2
    • github.com/xrash/smetrics
  • Source code
    • strconv
    • encoding/base64
    • crypto/aes
    • crypto/cipher
    • crypto/rand
    • crypto/rsa
    • crypto/sha256
    • crypto/x509
    • encoding/pem
    • fmt
    • io/ioutil
    • os
    • path/filepath