Enum KeyPair
pub enum KeyPair {
Ed25519(KeyPair),
P256(KeyPair),
}
Expand description
pair of cryptographic keys used to sign a token’s block
Variants§
Implementations§
§impl KeyPair
impl KeyPair
pub fn new_with_algorithm(algorithm: Algorithm) -> KeyPair
pub fn new_with_algorithm(algorithm: Algorithm) -> KeyPair
Create a new keypair with a chosen algorithm and the default OS RNG
pub fn new_with_rng<T>(algorithm: Algorithm, rng: &mut T) -> KeyPair
pub fn from(key: &PrivateKey) -> KeyPair
pub fn from_bytes(bytes: &[u8], algorithm: Algorithm) -> Result<KeyPair, Format>
pub fn from_bytes(bytes: &[u8], algorithm: Algorithm) -> Result<KeyPair, Format>
deserializes from a byte array
pub fn sign(&self, data: &[u8]) -> Result<Signature, Format>
pub fn from_private_key_der_with_algorithm( bytes: &[u8], algorithm: Algorithm, ) -> Result<KeyPair, Format>
pub fn from_private_key_der(bytes: &[u8]) -> Result<KeyPair, Format>
pub fn from_private_key_pem_with_algorithm( str: &str, algorithm: Algorithm, ) -> Result<KeyPair, Format>
pub fn from_private_key_pem(str: &str) -> Result<KeyPair, Format>
pub fn to_private_key_der(&self) -> Result<Zeroizing<Vec<u8>>, Format>
pub fn to_private_key_pem(&self) -> Result<Zeroizing<String>, Format>
pub fn private(&self) -> PrivateKey
pub fn public(&self) -> PublicKey
pub fn algorithm(&self) -> Algorithm
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyPair
impl RefUnwindSafe for KeyPair
impl Send for KeyPair
impl Sync for KeyPair
impl Unpin for KeyPair
impl UnwindSafe for KeyPair
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more