Struct aws_lc_rs::signature::EcdsaKeyPair
source · pub struct EcdsaKeyPair { /* private fields */ }Expand description
An ECDSA key pair, used for signing.
Implementations§
source§impl EcdsaKeyPair
impl EcdsaKeyPair
sourcepub fn generate(
alg: &'static EcdsaSigningAlgorithm
) -> Result<Self, Unspecified>
pub fn generate( alg: &'static EcdsaSigningAlgorithm ) -> Result<Self, Unspecified>
sourcepub fn from_pkcs8(
alg: &'static EcdsaSigningAlgorithm,
pkcs8: &[u8]
) -> Result<Self, KeyRejected>
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.
sourcepub 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>
sourcepub fn to_pkcs8v1(&self) -> Result<Document, Unspecified>
pub fn to_pkcs8v1(&self) -> Result<Document, Unspecified>
Serializes this EcdsaKeyPair into a PKCS#8 v1 document.
§Errors
error::Unspecified on internal error.
sourcepub fn from_private_key_and_public_key(
alg: &'static EcdsaSigningAlgorithm,
private_key: &[u8],
public_key: &[u8]
) -> Result<Self, KeyRejected>
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.
sourcepub fn from_private_key_der(
alg: &'static EcdsaSigningAlgorithm,
private_key: &[u8]
) -> Result<Self, KeyRejected>
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
sourcepub fn private_key(&self) -> PrivateKey<'_>
pub fn private_key(&self) -> PrivateKey<'_>
Access functions related to the private key.