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 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>
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.
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 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.
ring Compatibility
Our implementation ignored the SecureRandom
parameter.
Errors
error::Unspecified
on internal error.