aws_lc_rs::signature

Struct EcdsaKeyPair

Source
pub struct EcdsaKeyPair { /* private fields */ }
Expand description

An ECDSA key pair, used for signing.

Implementations§

Source§

impl EcdsaKeyPair

Source

pub fn generate( alg: &'static EcdsaSigningAlgorithm, ) -> Result<Self, Unspecified>

Generates a new key pair.

§Errors

error::Unspecified on internal error.

Source

pub fn from_pkcs8( alg: &'static EcdsaSigningAlgorithm, pkcs8: &[u8], ) -> Result<Self, KeyRejected>

Constructs an ECDSA key pair by parsing an unencrypted PKCS#8 v1 id-ecPublicKey ECPrivateKey key.

§Errors

error::KeyRejected if bytes do not encode an ECDSA key pair or if the key is otherwise not acceptable.

Source

pub fn generate_pkcs8( alg: &'static EcdsaSigningAlgorithm, _rng: &dyn SecureRandom, ) -> Result<Document, Unspecified>

Generates a new key pair and returns the key pair serialized as a PKCS#8 v1 document.

§ring Compatibility

Our implementation ignores the SecureRandom parameter.

§Errors

error::Unspecified on internal error.

Source

pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified>

Serializes this EcdsaKeyPair into a PKCS#8 v1 document.

§Errors

error::Unspecified on internal error.

Source

pub fn from_private_key_and_public_key( alg: &'static EcdsaSigningAlgorithm, private_key: &[u8], public_key: &[u8], ) -> Result<Self, KeyRejected>

Constructs an ECDSA key pair from the private key and public key bytes

The private key must encoded as a big-endian fixed-length integer. For example, a P-256 private key must be 32 bytes prefixed with leading zeros as needed.

The public key is encoding in uncompressed form using the Octet-String-to-Elliptic-Curve-Point algorithm in SEC 1: Elliptic Curve Cryptography, Version 2.0.

This is intended for use by code that deserializes key pairs. It is recommended to use EcdsaKeyPair::from_pkcs8() (with a PKCS#8-encoded key) instead.

§Errors

error::KeyRejected if parsing failed or key otherwise unacceptable.

Source

pub fn from_private_key_der( alg: &'static EcdsaSigningAlgorithm, private_key: &[u8], ) -> Result<Self, KeyRejected>

Deserializes a DER-encoded private key structure to produce a EcdsaKeyPair.

This function is typically used to deserialize RFC 5915 encoded private keys, but it will attempt to automatically detect other key formats. This function supports unencrypted PKCS#8 PrivateKeyInfo structures as well as key type specific formats.

See EcdsaPrivateKey::as_der.

§Errors

error::KeyRejected if parsing failed or key otherwise unacceptable.

§Panics
Source

pub fn private_key(&self) -> PrivateKey<'_>

Access functions related to the private key.

Source

pub fn sign( &self, _rng: &dyn SecureRandom, message: &[u8], ) -> Result<Signature, Unspecified>

Returns the signature of the message using a random nonce.

§ring Compatibility

Our implementation ignores the SecureRandom parameter.

§Errors

error::Unspecified on internal error.

Trait Implementations§

Source§

impl Debug for EcdsaKeyPair

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl KeyPair for EcdsaKeyPair

Source§

fn public_key(&self) -> &Self::PublicKey

Provides the public key.

Source§

type PublicKey = PublicKey

The type of the public key.
Source§

impl Send for EcdsaKeyPair

Source§

impl Sync for EcdsaKeyPair

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.