Trait casper_node::crypto::AsymmetricKeyExt
source · [−]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
fn generate_ed25519() -> Result<Self, Error>
fn generate_ed25519() -> Result<Self, Error>
Constructs a new ed25519 variant using the operating system’s cryptographically secure random number generator.
fn generate_secp256k1() -> Result<Self, Error>
fn generate_secp256k1() -> Result<Self, Error>
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.
Decodes a key from a DER-encoded slice.
Decodes a secret key from a PEM-encoded slice.
fn doc_example() -> &'static Self
fn doc_example() -> &'static Self
Returns an example value for documentation purposes.
