Git Product home page Git Product logo

encrypted-message's Introduction

encrypted-message

crates.io docs.rs "Lint & run tests" workflow License

Safely encrypt & store serializable data using XChaCha20Poly1305.

Install

[dependencies]
encrypted-message = "0.3"

Integration with Diesel

EncryptedMessage implements FromSql & ToSql, allowing you to use EncryptedMessage as a field type in your models.

  • MySQL: Enable the diesel & diesel-mysql features. Supports the Json type.
  • PostgreSQL: Enable the diesel & diesel-postgres features. Supports the Json & Jsonb types.
[dependencies]
encrypted-message = { version = "0.3", features = ["diesel", "diesel-<mysql|postgres>"] }

Examples

Security

This crate uses trusted, pure-Rust encryption using the chacha20poly1305 crate from the Rust Crypto organization.

Keys are handled safely using the secrecy crate, which internally uses the zeroize crate (also from Rust Crypto) to zero-out the keys in memory when no longer used.

encrypted-message's People

Contributors

rigoonrails avatar

Stargazers

 avatar  avatar

Watchers

 avatar

encrypted-message's Issues

Generate more secure nonces

The nonce generation for Randomized just generates a random byte sequence. Although very, very unlikely, it's still possible for nonces to collide. This would drastically reduce the security of data encrypted with the same key. The nonces should be sequential, & guaranteed to always be unique, not just 99.9999999% of the time.

As for Deterministic, it uses the first 12 bytes of an HMAC-SHA256 hash of the payload, which can also collide.

I'm not sure how I'd implement a counter state easily...

Maybe switch to AES-GCM-SIV?

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.