simple_sign
Simple signing library.
This crate provides a small API for working with cryptographic signatures, including:
Signature: a signature wrapper that stores the raw signature bytes plus theSigningAlgorithmused.SigningAlgorithm: an enum of supported algorithms (seesrc/signing_algorithm.rs).- Signers:
Ed25519Signer,RsaSigner, andSecp256k1Signer.
Installation
Add to your Cargo.toml:
[]
= "0.1.3"
Usage
Basic construction and inspection:
use ;
let sig = new_with_algorithm;
assert_eq!;
let _bytes: & = sig.get_signature;
Signing a hash:
use ByteVec;
use ;
use ;
let signer = default;
let data = b"hello";
let bytes = new;
let hash = try_hash.unwrap;
let signature = signer.sign.unwrap;
assert_eq!;
Serialisation helpers are implemented via base_xx’s Encodable trait (see Signature’s TryFrom implementations in src/signature.rs).
Development
Run tests:
License
Licensed under either of:
- Apache License, Version 2.0
- MIT license
at your option.