Giter Site home page Giter Site logo

whisper's Introduction

whisper

Wraps an io.ReadWriter in a secure tunnel using modern elliptic-curve cryptography.

Disclaimer

The whisper package guarantees confidentiality, integrity and authenticity of data under non-compromised private keys. It does not, however, provide any support for:

  • Key lifecycle, including expiration or revocation.
  • Hostname verification.
  • Trust chains.

All of the above are supported by modern PKC infrastructure (x509, TLS etc.) and should be preferred for real-world scenarios.

Configuration

Three NewSecureReadWriter* methods are exposed from the whisper package:

  • NewSecureReadWriterWithPublicKey
  • NewSecureReadWriterWithPrivateKey
  • NewSecureReadWriterWithPrivateAndPublicKey

If a SecureReadWriter has a public key, that public key will be used to verify the remote end of the tunnel.

If a SecureReadWriter has a private key, that private key will be used to provide verification to the remote end of the tunnel.

This allows for two possible configurations:

  • An exclusive tunnel where only one side is verified. This is analogous to a typical TLS connection where the server must prove its identity but not the client.

  • A mutual tunnel where both sides are verified. This is analogous to mutual TLS where both the client and the server are expected to prove their identities.

Usage Example

The below example demonstrates how a mutual tunnel might be configured at both ends.

// These are acquired and/or generated previously.
var remotePublicKey ed25519.PublicKey
var localPrivateKey ed25519.PrivateKey

// The underlying io.ReadWriter can be anything, but in this example, it is a
// net.Conn.
conn, _ := net.Dial("tcp", ":1234")

// We create the *whisper.SecureReadWriter.
srw := whisper.NewSecureReadWriterWithPrivateAndPublicKey(conn, localPrivateKey, remotePublicKey)

// We can now use srw anywhere io.ReadWriter is supported.
lineReader := bufio.NewReader(srw)
line, _ := lineReader.ReadString('\n')

whisper's People

Contributors

lukejoshuapark avatar

Watchers

 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.