Code Monkey home page Code Monkey logo

message_verifier's Introduction

message_verifier

Travis Build Status crates.io MIT licensed

Message Verifier library compatible with Rails' MessageVerifier and MessageEncryptor.

In a nutshell, this library provides several simple interfaces for signing and encrypting messages. These interfaces are useful when securely implementing various web application features like session cookies or signed URL tokens.

This library handles all the formatting, encoding and cryptography. It does not handle serialization aspects. The idea is to input and output raw strings to and from this library and handle serialization on another layer.

Documentation

Documentation is available on Docs.rs.

Examples

The examples directory contains two Rust examples as well as two small Ruby scripts to demonstrate interoperability between this library and ActiveSupport.

One Rust example demonstrates message signing and encryption:

$ cargo run --example generate_encrypt
eyJrZXkiOiJ2YWx1ZSJ9--fa115453dbb4a28277b1ba07ef4c7437621f5d72
MllIRUYvUFhjcXBpRk9NUWgvZ2s2UT09LS1NRmN2b2Y5SWJsaUpRNlptZFdwSlZRPT0=--2df97d947a5dc344de003715510002503fa059f1

The second reads from stdin and tries verify the first line of input and decrypt and verify the second:

$ cargo run --example generate_encrypt | cargo run --example verify_decrypt
Verified Message: {"key":"value"}
Decrypted Message: {"key":"value"}

We can use these two Rust examples with the Ruby scripts as well:

$ cargo run --example generate_encrypt | ruby examples/verify_decrypt.rb
Verified message: {"key"=>"value"}
Decrypted message: {"key"=>"value"}

$ ruby examples/generate_encrypt.rb | cargo run --example verify_decrypt
Verified Message: {"key":"value"}
Decrypted Message: {"key":"value"}

Supported Ciphers

  • AES-CBC with HMAC-SHA1
    • 256, 192, or 128 bit keys
  • AES-GCM
    • 256, 192, or 128 bit keys

If you need more cipher options, please open an issue or submit a PR!

message_verifier's People

Contributors

mjc-gh avatar seanlinsley 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.