Expand description
Provide wrappers around public keys, private keys and signatures.
- Keys can be converted to/from Base58 string format.
- Signatures can be converted to/from Base64 string format.
§Generate and use ed25519 key-pair
ⓘ
use dup_crypto::keys::{KeyPair, PublicKey, Signator, Signature};
use dup_crypto::keys::ed25519::{KeyPairFromSaltedPasswordGenerator, SaltedPassword};
let generator = KeyPairFromSaltedPasswordGenerator::generate;
let keypair = generator.generate(SaltedPassword::new(
"salt".to_owned(),
"password".to_owned(),
));
let signator = keypair.generate_signator();
let message = "Hello, world!";
let signature = signator.sign(&message.as_bytes());
assert!(keypair.public_key().verify(&message.as_bytes(), &signature).is_ok());
§Format
- Base58 use the following alphabet :
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
- Base64 use the following alphabet :
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
with=
as padding character.
Re-exports§
pub use crate::seeds::Seed32;
Modules§
- bin_
signable - Generic code for signing data in binary format
- ed25519
- Provide wrappers around ed25519 keys and signatures
- text_
signable - Generic code for signing data in text format
Enums§
- KeyPair
Enum - Store a cryptographic key pair.
- Keys
Algo - Cryptographic keys algorithms list
- PubKey
Enum - Store a cryptographic public key.
- PubKey
From Bytes Error - Error when parsing pubkey bytes
- Sig
- Store a cryptographic signature.
- SigError
- Errors enumeration for signature verification.
- Sign
Error - SignError
- Signator
Enum - Store a cryptographic signator.
Traits§
- GetKeys
Algo - Get the cryptographic algorithm.
- KeyPair
- Define the operations that can be performed on a cryptographic key pair.
- Public
Key - Define the operations that can be performed on a cryptographic public key.
- Signator
- Define the operations that can be performed on a cryptographic signator.
- Signature
- Define the operations that can be performed on a cryptographic signature.