pub struct SigningKey(/* private fields */);Expand description
A signature.signing-key: private-key signing.
Implementations§
Source§impl SigningKey
impl SigningKey
Sourcepub fn from_raw(raw: SigningKey) -> Self
pub fn from_raw(raw: SigningKey) -> Self
Wrap a raw signing-key resource.
Sourcepub fn as_raw(&self) -> &SigningKey
pub fn as_raw(&self) -> &SigningKey
Borrow the raw signing-key resource.
Sourcepub fn into_raw(self) -> SigningKey
pub fn into_raw(self) -> SigningKey
Unwrap into the raw signing-key resource.
Source§impl SigningKey
impl SigningKey
Sourcepub async fn sign(
&self,
data: impl Into<DataSource<'_>>,
) -> Result<Vec<u8>, Error>
pub async fn sign( &self, data: impl Into<DataSource<'_>>, ) -> Result<Vec<u8>, Error>
Sign data, returning the signature in the minting interface’s
documented wire format.
Fails only for operational reasons (Error::Other, or
Error::Read for a failing DataSource::from_reader source) —
never for misuse, which is unrepresentable.
Sourcepub fn algorithm_name(&self) -> String
pub fn algorithm_name(&self) -> String
Sourcepub fn algorithm_curve(&self) -> Option<String>
pub fn algorithm_curve(&self) -> Option<String>
Sourcepub fn algorithm_hash(&self) -> Option<String>
pub fn algorithm_hash(&self) -> Option<String>
Sourcepub fn algorithm_length(&self) -> Option<u32>
pub fn algorithm_length(&self) -> Option<u32>
Sourcepub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
pub fn algorithm_public_exponent(&self) -> Option<Vec<u8>>
Sourcepub fn extractable(&self) -> bool
pub fn extractable(&self) -> bool
Whether the private key material may be exported by
export_key_jwk /
export_key_pkcs8 and the wrap inputs —
mint-time recorded policy, which platform-backed key storage also
honors.
Asking is not the same as exporting: interrogating extractability through an export alone would hand you the material whenever the answer is yes.
Sourcepub fn can_sign(&self) -> bool
pub fn can_sign(&self) -> bool
Whether the key permits sign — the usage recorded
at mint (or carried by a platform keystore key). A refused
operation fails Error::NotPermitted.
Sourcepub async fn export_key_jwk(&self) -> Result<String, Error>
pub async fn export_key_jwk(&self) -> Result<String, Error>
The private key as a JWK (JSON text — an RFC 8037 OKP private key
for Ed25519, an EC private key for ECDSA); fails with
Error::NotExtractable unless the key was minted extractable.
Extractability is an API property, not a physical one: the
guarantee is that components holding only the handle cannot obtain
the material through this API.
Sourcepub async fn export_key_pkcs8(&self) -> Result<Vec<u8>, Error>
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.
Sourcepub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>
pub async fn to_wrap_input_jwk(&self) -> Result<WrapInput, Error>
The private-key JWK serialization as a WrapInput for wrapping
under another key — the material transits neither caller. Behind
the same extractability gate as
export_key_jwk.