GithubHelp home page GithubHelp logo

dtanner / gobox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from danderson/gobox

0.0 2.0 0.0 11 KB

Trivial CLI wrapper around go.crypto/nacl/box. Easy secure public key authenticated encryption.

License: Apache License 2.0

Go 100.00%

gobox's Introduction

gobox - authenticated encryption CLI

Gobox is a trivial CLI wrapper around the excellent golang.org/x/crypto/nacl library, itself an implementation of djb et al.'s excellent NaCl crypto library.

NaCl implements fast, secure and non-surprising authenticated encryption using either a symmetric key, or a public/private key pair.

Using secretbox, you seal a message using a symmetric key, and open it with the same key.

Using box, you seal a message to a user (with their public key) from you (with your private key). That sealed box can only be opened by that user, if they provide their private key and your public key.

The APIs are deliberately devoid of knobs and settings, allowing only those two operations, seal and open.

Gobox just surfaces two primitives (plus keygen to produce key pairs) to the commandline.

CLI

The tool is about as straightforward as the NaCl box API.

$ gobox
usage: gobox <command> [<flags>] [<args> ...]

Flags:
  --help  Show help.

Commands:
  help [<command>]
    Show help for a command.

  genkey <pubkey> <seckey>
    Generate a key pair and write them to the given files.

  encrypt <pubkey> <seckey> <input-file> <output-file>
    Encrypt a file FROM seckey (you) TO pubkey (peer)

  decrypt <pubkey> <seckey> <input-file> <output-file>
    Decrypt a file FROM pubkey (peer) TO seckey (you)

  sym-encrypt <input-file> <output-file>
    Encrypt a file with a passphrase

  sym-decrypt <input-file> <output-file>
    Decrypt a file with a passphrase

Public key crypto (box)

Generate a keypair

$ gobox keygen alice.pub alice.sec

Encrypt a file

$ echo "Eve is listening" >plaintext
$ gobox encrypt bob.pub alice.sec plaintext ciphertext

Decrypt a file

$ gobox decrypt alice.pub bob.sec ciphertext plaintext
$ cat plaintext
Eve is listening

Symmetric crypto (secretbox)

Encrypt a file

$ echo "Eve is listening" >plaintext
$ gobox sym-encrypt plaintext ciphertext

Decrypt a file

$ gobox sym-decrypt ciphertext plaintext
$ cat plaintext
Eve is listening

gobox's People

Contributors

danderson avatar dtanner avatar

Watchers

 avatar  avatar

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.