logo
pub trait AsymmetricKeyExt: Sized {
    fn generate_ed25519() -> Result<Self, Error>;
    fn generate_secp256k1() -> Result<Self, Error>;
    fn to_file<P: AsRef<Path>>(&self, file: P) -> Result<(), Error>;
    fn from_file<P: AsRef<Path>>(file: P) -> Result<Self, Error>;
    fn to_der(&self) -> Result<Vec<u8>, Error>;
    fn from_der<T: AsRef<[u8]>>(input: T) -> Result<Self, Error>;
    fn to_pem(&self) -> Result<String, Error>;
    fn from_pem<T: AsRef<[u8]>>(input: T) -> Result<Self, Error>;
    fn doc_example() -> &'static Self;
}
Expand description

Additional operations an asymmetric key

Required Methods

Constructs a new ed25519 variant using the operating system’s cryptographically secure random number generator.

Constructs a new secp256k1 variant using the operating system’s cryptographically secure random number generator.

Attempts to write the key bytes to the configured file path.

Attempts to read the key bytes from configured file path.

DER encodes a key.

Decodes a key from a DER-encoded slice.

PEM encodes a key.

Decodes a secret key from a PEM-encoded slice.

Returns an example value for documentation purposes.

Implementations on Foreign Types

Implementors