pub struct Signature { /* private fields */ }
Expand description
NIST P-256 signature.
TODO: It seems we might be able to use the p256
machinery for this,
instead of reimplementing it ourselves.
Implementations§
Source§impl Signature
impl Signature
Sourcepub fn from_untagged_bytes(bytes: &[u8]) -> Result<Self>
pub fn from_untagged_bytes(bytes: &[u8]) -> Result<Self>
Decode signature as big-endian r, then big-endian s, without framing.
Necessarily, bytes must be of length 64, and r and s must be integers in the range 1..=n-1, otherwise decoding fails.
Sourcepub fn to_untagged_bytes(&self) -> [u8; 64]
pub fn to_untagged_bytes(&self) -> [u8; 64]
Encode signature from big-endian r, then big-endian s, without framing.
Sourcepub fn to_sec1_bytes(&self, buffer: &mut [u8; 72]) -> usize
Available on crate feature sec1-signatures
only.
pub fn to_sec1_bytes(&self, buffer: &mut [u8; 72]) -> usize
sec1-signatures
only.Encode signature as ASN.1 DER, returning length.
This means interpreting signature as a SEQUENCE of (unsigned) INTEGERs, as defined
under the name of ECDSA-Sig-Value
in SEC 1, section C.5.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Signature
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
Blanket Implementations§
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
Mutably borrows from an owned value. Read more