utility to convert private keys into keypairs

This commit is contained in:
Jędrzej Stuczyński
2024-09-09 14:35:29 +01:00
parent fe88321a50
commit 74252269bc
2 changed files with 18 additions and 0 deletions
@@ -81,6 +81,15 @@ impl KeyPair {
}
}
impl From<PrivateKey> for KeyPair {
fn from(private_key: PrivateKey) -> Self {
KeyPair {
public_key: (&private_key).into(),
private_key,
}
}
}
impl PemStorableKeyPair for KeyPair {
type PrivatePemKey = PrivateKey;
type PublicPemKey = PublicKey;
@@ -91,6 +91,15 @@ impl KeyPair {
}
}
impl From<PrivateKey> for KeyPair {
fn from(private_key: PrivateKey) -> Self {
KeyPair {
public_key: (&private_key).into(),
private_key,
}
}
}
impl PemStorableKeyPair for KeyPair {
type PrivatePemKey = PrivateKey;
type PublicPemKey = PublicKey;