Enum libp2p::identity::Keypair [−][src]
Expand description
Identity keypair of a node.
Example: Generating RSA keys with OpenSSL
openssl genrsa -out private.pem 2048
openssl pkcs8 -in private.pem -inform PEM -topk8 -out private.pk8 -outform DER -nocrypt
rm private.pem # optional
Loading the keys:
let mut bytes = std::fs::read("private.pk8").unwrap();
let keypair = Keypair::rsa_from_pkcs8(&mut bytes);
Variants
Ed25519(Keypair)
An Ed25519 keypair.
Rsa(Keypair)
An RSA keypair.
Secp256k1(Keypair)
A Secp256k1 keypair.
Implementations
Generate a new Ed25519 keypair.
Generate a new Secp256k1 keypair.
Decode an keypair from a DER-encoded secret key in PKCS#8 PrivateKeyInfo format (i.e. unencrypted) as defined in RFC5208.
Decode a keypair from a DER-encoded Secp256k1 secret key in an ECPrivateKey structure as defined in RFC5915.
Sign a message using the private key of this keypair, producing a signature that can be verified using the corresponding public key.
Decode a private key from a protobuf structure and parse it as a Keypair
.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Keypair
impl UnwindSafe for Keypair
Blanket Implementations
Mutably borrows from an owned value. Read more
pub fn vzip(self) -> V