[−][src]Module dup_crypto::keys
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.
Usage
use dup_crypto::keys::{Signature, PublicKey, PrivateKey, KeyPair}; use dup_crypto::keys::ed25519::KeyPairFromSaltedPasswordGenerator; let generator = KeyPairFromSaltedPasswordGenerator::with_default_parameters(); let keypair = generator.generate( b"password", b"salt" ); let message = "Hello, world!"; let signature = keypair.sign(&message.as_bytes()); assert!(keypair.pubkey.verify(&message.as_bytes(), &signature));
Format
- Base58 use the following alphabet :
123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz
- Base64 use the following alphabet :
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/
with=
as padding character.
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
KeyPairEnum | Store a cryptographic key pair. |
KeysAlgo | Cryptographic keys algorithms list |
PrivKey | Store a cryptographic private key. |
PubKey | Store a cryptographic public key. |
Sig | Store a cryptographic signature. |
SigError | Errors enumeration for signature verification. |
SignError | SignError |
Traits
GetKeysAlgo | Get the cryptographic algorithm. |
KeyPair | Define the operations that can be performed on a cryptographic key pair. |
PrivateKey | Define the operations that can be performed on a cryptographic private key. |
PublicKey | Define the operations that can be performed on a cryptographic public key. |
Signature | Define the operations that can be performed on a cryptographic signature. |