Skip to main content

SigPublic

Enum SigPublic 

pub enum SigPublic {
    Ed25519(VerifyingKey),
    EcdsaP256(VerifyingKey<NistP256>, EcdsaHash),
    EcdsaP384(VerifyingKey<NistP384>, EcdsaHash),
    Rsa(RsaPublicKey, RsaScheme),
}
Expand description

The shared core’s key-material and policy types, re-exported for the embedder key constructors (SigningKey::from_material, VerifyingKey::from_material). The public key behind a signature.verifying-key resource, bound to its algorithm (and, for ECDSA and RSA, its digest parameterization) at minting. Verification is secret-free, so every arm exists on every target.

Variants§

§

Ed25519(VerifyingKey)

§

EcdsaP256(VerifyingKey<NistP256>, EcdsaHash)

§

EcdsaP384(VerifyingKey<NistP384>, EcdsaHash)

§

Rsa(RsaPublicKey, RsaScheme)

Implementations§

§

impl SigPublic

pub fn import_ed25519(raw: &[u8]) -> Result<SigPublic, Error>

Import a 32-byte RFC 8032 public key, rendering invalid-key for wrong lengths and encodings the algorithm rejects (the ed25519-verify.import-verifying-key-raw contract).

pub fn import_ecdsa( variant: EcdsaVariant, raw: &[u8], ) -> Result<SigPublic, Error>

Import an uncompressed SEC1 point for the declared variant, rendering invalid-key for anything else — including compressed encodings and points not on the curve (the ecdsa-verify.import-verifying-key-raw contract).

pub fn import_ed25519_spki(spki: &[u8]) -> Result<SigPublic, Error>

Import an Ed25519 public key from a SubjectPublicKeyInfo (the ed25519-verify.import-verifying-key-spki contract): the embedded point is subject to the raw import’s strict criterion.

pub fn import_ed25519_jwk(jwk: &str) -> Result<SigPublic, Error>

Import an Ed25519 public key from an OKP public JWK (the ed25519-verify.import-verifying-key-jwk contract).

pub fn import_ecdsa_spki( variant: EcdsaVariant, spki: &[u8], ) -> Result<SigPublic, Error>

Import an ECDSA public key from a SubjectPublicKeyInfo (the ecdsa-verify.import-verifying-key-spki contract): the encoded curve must match the declared variant’s.

pub fn import_ecdsa_jwk( variant: EcdsaVariant, jwk: &str, ) -> Result<SigPublic, Error>

Import an ECDSA public key from an EC public JWK (the ecdsa-verify.import-verifying-key-jwk contract): the JWK’s crv must match the declared variant’s curve.

pub fn import_rsassa_spki( variant: RsaVariant, spki: &[u8], ) -> Result<SigPublic, Error>

Import an RSASSA-PKCS1-v1_5 public key from a SubjectPublicKeyInfo (the rsassa-pkcs1-v15-verify.import-verifying-key-spki contract): admission follows the WIT rsa family contract.

pub fn import_rsassa_jwk( variant: RsaVariant, jwk: &str, ) -> Result<SigPublic, Error>

Import an RSASSA-PKCS1-v1_5 public key from an RSA public JWK (the rsassa-pkcs1-v15-verify.import-verifying-key-jwk contract): a present alg must be the variant’s JOSE alg.

pub fn import_pss_spki( variant: RsaVariant, salt_length: u32, spki: &[u8], ) -> Result<SigPublic, Error>

Import an RSA-PSS public key from a SubjectPublicKeyInfo (the rsa-pss-verify.import-verifying-key-spki contract): admission follows the WIT rsa family contract, and salt_length (bytes) binds at mint.

pub fn import_pss_jwk( variant: RsaVariant, salt_length: u32, jwk: &str, ) -> Result<SigPublic, Error>

Import an RSA-PSS public key from an RSA public JWK (the rsa-pss-verify.import-verifying-key-jwk contract): a present alg must be the variant’s JOSE alg, and salt_length (bytes) binds at mint.

pub fn name(&self) -> &'static str

The registry algorithm name (verifying-key.algorithm-name).

pub fn curve(&self) -> Option<&'static str>

The registry curve name (verifying-key.algorithm-curve).

pub fn hash(&self) -> Option<&'static str>

The mint-bound digest name (verifying-key.algorithm-hash).

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

The key’s length in bits (verifying-key.algorithm-length): the RSA modulus length. None for Ed25519 and ECDSA, whose key size is fixed by the algorithm or curve.

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

The RSA public exponent’s big-endian bytes (verifying-key.algorithm-public-exponent). None for Ed25519 and ECDSA, which have no such parameter.

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

The public key material in the minting interface’s documented form — raw 32 bytes for Ed25519, an uncompressed SEC1 point for ECDSA — or unsupported for the RSA family, which has no raw public form (the verifying-key.export-key-raw contract).

pub fn export_spki(&self) -> Vec<u8>

The public key as a SubjectPublicKeyInfo (verifying-key.export-key-spki).

pub fn export_jwk(&self) -> String

The public key as a JWK (verifying-key.export-key-jwk).

pub fn verify(&self, data: &[u8], sig: &[u8]) -> Result<(), Error>

One-shot verification of sig over data, failing closed with authentication-failed (the verifying-key.verify contract): the ECDSA signature format is fixed-width r ‖ s (IEEE P1363), Ed25519 uses verify_strict semantics per the ed25519-verify criterion, and the RSA schemes verify under the mint-bound parameterization (byte-exact EMSA-PKCS1-v1_5; PSS with the minted salt length).

Trait Implementations§

§

impl Debug for SigPublic

§

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

Formats the value using the given formatter. Read more

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,