Struct EcdsaKeyPair
pub struct EcdsaKeyPair { /* private fields */ }crypto and ring and std only.Expand description
An ECDSA key pair, used for signing.
Implementations§
§impl EcdsaKeyPair
impl EcdsaKeyPair
pub fn generate_pkcs8(
alg: &'static EcdsaSigningAlgorithm,
rng: &dyn SecureRandom,
) -> Result<Document, Unspecified>
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 document.
The PKCS#8 document will be a v1 OneAsymmetricKey with the public key
included in the ECPrivateKey structure, as described in
RFC 5958 Section 2 and RFC 5915. The ECPrivateKey structure will
not have a parameters field so the generated key is compatible with
PKCS#11.
pub fn from_pkcs8(
alg: &'static EcdsaSigningAlgorithm,
pkcs8: &[u8],
rng: &dyn SecureRandom,
) -> Result<EcdsaKeyPair, KeyRejected>
pub fn from_pkcs8( alg: &'static EcdsaSigningAlgorithm, pkcs8: &[u8], rng: &dyn SecureRandom, ) -> Result<EcdsaKeyPair, KeyRejected>
Constructs an ECDSA key pair by parsing an unencrypted PKCS#8 v1
id-ecPublicKey ECPrivateKey key.
The input must be in PKCS#8 v1 format. It must contain the public key in
the ECPrivateKey structure; from_pkcs8() will verify that the public
key and the private key are consistent with each other. The algorithm
identifier must identify the curve by name; it must not use an
“explicit” encoding of the curve. The parameters field of the
ECPrivateKey, if present, must be the same named curve that is in the
algorithm identifier in the PKCS#8 header.
pub fn from_private_key_and_public_key(
alg: &'static EcdsaSigningAlgorithm,
private_key: &[u8],
public_key: &[u8],
rng: &dyn SecureRandom,
) -> Result<EcdsaKeyPair, KeyRejected>
pub fn from_private_key_and_public_key( alg: &'static EcdsaSigningAlgorithm, private_key: &[u8], public_key: &[u8], rng: &dyn SecureRandom, ) -> Result<EcdsaKeyPair, 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.
pub fn sign(
&self,
rng: &dyn SecureRandom,
message: &[u8],
) -> Result<Signature, Unspecified>
pub fn sign( &self, rng: &dyn SecureRandom, message: &[u8], ) -> Result<Signature, Unspecified>
Returns the signature of the message using a random nonce generated by rng.
Trait Implementations§
§impl Debug for EcdsaKeyPair
impl Debug for EcdsaKeyPair
§impl KeyPair for EcdsaKeyPair
impl KeyPair for EcdsaKeyPair
§fn public_key(&self) -> &<EcdsaKeyPair as KeyPair>::PublicKey
fn public_key(&self) -> &<EcdsaKeyPair as KeyPair>::PublicKey
Auto Trait Implementations§
impl Freeze for EcdsaKeyPair
impl RefUnwindSafe for EcdsaKeyPair
impl Send for EcdsaKeyPair
impl Sync for EcdsaKeyPair
impl Unpin for EcdsaKeyPair
impl UnsafeUnpin for EcdsaKeyPair
impl UnwindSafe for EcdsaKeyPair
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
fn with_context(self, otel_cx: Context) -> WithContext<Self> ⓘ
§fn with_current_context(self) -> WithContext<Self> ⓘ
fn with_current_context(self) -> WithContext<Self> ⓘ
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a rama_grpc::Request§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§fn and<P, B, E>(self, other: P) -> And<T, P>
fn and<P, B, E>(self, other: P) -> And<T, P>
Policy that returns Action::Follow only if self and other return
Action::Follow. Read more