pub struct EcdsaP521Sha512;Expand description
ECDSA over P-521 with SHA-512.
Implementations§
Source§impl EcdsaP521Sha512
impl EcdsaP521Sha512
Sourcepub fn verify_prehash(
public_key: &[u8],
digest: &[u8],
signature: &[u8],
) -> Result<()>
pub fn verify_prehash( public_key: &[u8], digest: &[u8], signature: &[u8], ) -> Result<()>
Verify a signature over a digest the caller computed, for signatures made with a hash other than SHA-512.
digest must be one of crate::PREHASH_LENS and at least 64
bytes, so that the hash is at least as strong as the curve; narrower is
refused with InvalidLength. Which hash produced it is the caller’s to
establish: nothing here can tell.
Sourcepub fn public_key_compressed(private_key: &[u8], out: &mut [u8]) -> Result<()>
pub fn public_key_compressed(private_key: &[u8], out: &mut [u8]) -> Result<()>
Compute the public key in SEC1 compressed form (67 bytes).
Sourcepub fn normalize_s(signature: &mut [u8]) -> Result<()>
pub fn normalize_s(signature: &mut [u8]) -> Result<()>
Rewrite a signature to its low-s form, if it is not already.
ECDSA is malleable: (r, s) and (r, n - s) are both valid for the
same message, so a signature is not a unique identifier unless one form
is chosen. FIPS 186-5 and RFC 6979 accept both, and this library signs
and verifies per the standard, so normalization is offered rather than
imposed – apply it when a signature doubles as a database key or a
transaction id.
Trait Implementations§
Source§impl Algorithm for EcdsaP521Sha512
impl Algorithm for EcdsaP521Sha512
Source§impl SelfTest for EcdsaP521Sha512
impl SelfTest for EcdsaP521Sha512
Source§impl SignatureScheme for EcdsaP521Sha512
impl SignatureScheme for EcdsaP521Sha512
Source§const PUBLIC_KEY_LEN: usize = 133
const PUBLIC_KEY_LEN: usize = 133
SEC1 uncompressed: 0x04 || X || Y.
Source§const SIGNATURE_LEN: usize = 132
const SIGNATURE_LEN: usize = 132
Fixed-width r || s.