Skip to main content

SigningKey

Struct SigningKey 

Source
pub struct SigningKey { /* private fields */ }
Expand description

A private key. sign is one-shot on the immutable key, mirroring mac-key.sign. The extractability contract in README.md applies.

Implementations§

Source§

impl SigningKey

Source

pub async fn sign(&self, data: StreamReader<u8>) -> Result<Vec<u8>, Error>

Sign an entire byte stream. A success resolves only after the stream is fully drained (its writer dropped). The minting interface documents the signature’s wire format.

Fails only for operational reasons (error.other).

Source§

impl SigningKey

Source

pub fn algorithm_name(&self) -> String

See verifying-key.algorithm-name.

Source§

impl SigningKey

Source

pub fn algorithm_curve(&self) -> Option<String>

See verifying-key.algorithm-curve.

Source§

impl SigningKey

Source

pub fn algorithm_hash(&self) -> Option<String>

See verifying-key.algorithm-hash.

Source§

impl SigningKey

Source

pub fn algorithm_length(&self) -> Option<u32>

See verifying-key.algorithm-length.

Source§

impl SigningKey

Source

pub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>

See verifying-key.algorithm-public-exponent.

Source§

impl SigningKey

Source

pub fn extractable(&self) -> bool

Whether the export functions may return this key’s material. Mint-time recorded policy, which platform-backed key storage also honors.

Source§

impl SigningKey

Source

pub fn can_sign(&self) -> bool

Whether this key permits sign. A refused operation fails error.not-permitted.

Source§

impl SigningKey

Source

pub async fn export_key_jwk(&self) -> Result<String, Error>

The private key as a JWK (an RFC 8037 OKP private key for Ed25519, an EC private key for ECDSA). Fails error.not-extractable unless the key was minted extractable; fallible beyond the gate like every export (README.md, “Extractability”). See mac-key.export-key-jwk for the package-wide JWK contract.

Source§

impl SigningKey

Source

pub async fn export_key_pkcs8(&self) -> Result<Vec<u8>, Error>

The private key as a PKCS#8 PrivateKeyInfo (DER), behind the same extractability gate as export-key-jwk.

Source§

impl SigningKey

Source

pub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>

The private-key JWK serialization as a wrap-input, for wrapping under another key (see the wrapping interface). Behind the same extractability gate as export-key-jwk, and fallible beyond it like every export; the material itself never reaches the caller.

Source§

impl SigningKey

Source

pub async fn to_wrap_input_pkcs8(&self) -> Result<WrapInput, Error>

The PKCS#8 serialization as a wrap-input, behind the same gate.

Trait Implementations§

Source§

impl Debug for SigningKey

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl From<SigningKey> for SigningKey

Source§

fn from(raw: SigningKey) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Resource for T
where T: 'static,

§

type Rep = Option<T>

The type which is actually stored in-memory for this resource. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.