All Projects → jedisct1 → rust-minisign

jedisct1 / rust-minisign

Licence: other
A pure Rust implementation of the Minisign signature tool.

Programming Languages

rust
11053 projects

Projects that are alternatives of or similar to rust-minisign

rsign2
A command-line tool to sign files and verify signatures in pure Rust.
Stars: ✭ 102 (+34.21%)
Mutual labels:  ed25519, signatures, minisign
Kryptor
A simple, modern, and secure encryption and signing tool that aims to be a better version of age and Minisign.
Stars: ✭ 267 (+251.32%)
Mutual labels:  ed25519, signatures
salty
25519 for Cortex-M4 microcontrollers
Stars: ✭ 50 (-34.21%)
Mutual labels:  ed25519, signatures
Exonum Client
JavaScript client for Exonum blockchain
Stars: ✭ 62 (-18.42%)
Mutual labels:  ed25519
Tweetnacl Js
Port of TweetNaCl cryptographic library to JavaScript
Stars: ✭ 1,176 (+1447.37%)
Mutual labels:  ed25519
sodalite
tweetnacl in rust
Stars: ✭ 26 (-65.79%)
Mutual labels:  ed25519
mpc
Secure Multi-Party Computation (MPC) with Go. This project implements secure two-party computation with Garbled circuit protocol.
Stars: ✭ 41 (-46.05%)
Mutual labels:  ed25519
Minisign
A dead simple tool to sign files and verify digital signatures.
Stars: ✭ 1,105 (+1353.95%)
Mutual labels:  ed25519
4bytes
List of 4byte identifiers for EVM smart contract functions
Stars: ✭ 326 (+328.95%)
Mutual labels:  signatures
Gnb
GNB is open source de-centralized VPN to achieve layer3 network via p2p with the ultimate capability of NAT Traversal.GNB是一个开源的去中心化的具有极致内网穿透能力的通过P2P进行三层网络交换的VPN。
Stars: ✭ 225 (+196.05%)
Mutual labels:  ed25519
Nsec
A modern and easy-to-use cryptographic library for .NET Core based on libsodium
Stars: ✭ 217 (+185.53%)
Mutual labels:  ed25519
Signatures
Cryptographic signature algorithms: ECDSA, Ed25519
Stars: ✭ 135 (+77.63%)
Mutual labels:  ed25519
neuralRDEs
Code for: "Neural Rough Differential Equations for Long Time Series", (ICML 2021)
Stars: ✭ 102 (+34.21%)
Mutual labels:  signatures
Sshremotekeys
Managing SSH keys remotely to control access to hosts
Stars: ✭ 70 (-7.89%)
Mutual labels:  ed25519
crypto-primitives
Interfaces and implementations of cryptographic primitives, along with R1CS constraints for them
Stars: ✭ 76 (+0%)
Mutual labels:  signatures
Stellar Hd Wallet
🔐 Key derivation for Stellar (SEP-0005) 🚀
Stars: ✭ 60 (-21.05%)
Mutual labels:  ed25519
server init harden
Server hardening on 1st login as "root"
Stars: ✭ 75 (-1.32%)
Mutual labels:  ed25519
Ed25519 Java
Pure Java implementation of EdDSA
Stars: ✭ 173 (+127.63%)
Mutual labels:  ed25519
Wasm Crypto
A WebAssembly (via AssemblyScript) set of cryptographic primitives for building authentication and key exchange protocols.
Stars: ✭ 146 (+92.11%)
Mutual labels:  ed25519
Jwt
JSON Web Token library
Stars: ✭ 242 (+218.42%)
Mutual labels:  ed25519

CI status Last version Documentation

rust-minisign

A pure Rust implementation of the Minisign signature system.

This is a crate, designed to be used within by applications.

For a command-line tool reimplementing the Minisign utility in Rust, and based on this crate, check out rsign2.

For a minimal crate that to only verify signatures, check out minisign-verify.

API documentation

API documentation on docs.rs

Example

fn main() {
    extern crate minisign;
    use minisign::{KeyPair, PublicKeyBox, SecretKeyBox, SignatureBox};
    use std::io::Cursor;

    // Generate and return a new key pair
    // The key is encrypted using a password.
    // If `None` is given, the password will be asked for interactively.
    let KeyPair { pk, sk } =
        KeyPair::generate_encrypted_keypair(Some("key password".to_string())).unwrap();

    // In order to be stored to disk, keys have to be converted to "boxes".
    // A box is just a container, with some metadata about its content.
    // Boxes can be converted to/from strings, making them convenient to use for storage.
    let pk_box_str = pk.to_box().unwrap().to_string();
    let sk_box_str = sk
        .to_box(None) // Optional comment about the key
        .unwrap()
        .to_string();

    // `pk_box_str` and `sk_box_str` can now be saved to disk.
    // This is a long-term key pair, that can be used to sign as many files as needed.
    // For conveniency, the `KeyPair::generate_and_write_encrypted_keypair()` function
    // is available: it generates a new key pair, and saves it to disk (or any `Writer`)
    // before returning it.

    // Assuming that `sk_box_str` is something we previously saved and just reloaded,
    // it can be converted back to a secret key box:
    let sk_box = SecretKeyBox::from_string(&sk_box_str).unwrap();

    // and the box can be opened using the password to reveal the original secret key:
    let sk = sk_box
        .into_secret_key(Some("key password".to_string()))
        .unwrap();

    // Now, we can use the secret key to sign anything.
    let data = b"lorem ipsum";
    let data_reader = Cursor::new(data);
    let signature_box = minisign::sign(None, &sk, data_reader, None, None).unwrap();

    // We have a signature! Let's inspect it a little bit.
    println!(
        "Untrusted comment: [{}]",
        signature_box.untrusted_comment().unwrap()
    );
    println!(
        "Trusted comment: [{}]",
        signature_box.trusted_comment().unwrap()
    );

    // Converting the signature box to a string in order to save it is easy.
    let signature_box_str = signature_box.into_string();

    // Now, let's verify the signature.
    // Assuming we just loaded it into `signature_box_str`, get the box back.
    let signature_box = SignatureBox::from_string(&signature_box_str).unwrap();

    // Load the public key from the string.
    let pk_box = PublicKeyBox::from_string(&pk_box_str).unwrap();
    let pk = pk_box.into_public_key().unwrap();

    // And verify the data.
    let data_reader = Cursor::new(data);
    let verified = minisign::verify(&pk, &signature_box, data_reader, true, false, false);
    match verified {
        Ok(()) => println!("Success!"),
        Err(_) => println!("Verification failed"),
    };
}
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].