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
impl SigPublic
pub fn import_ed25519(raw: &[u8]) -> Result<SigPublic, Error>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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 hash(&self) -> Option<&'static str>
pub fn hash(&self) -> Option<&'static str>
The mint-bound digest name (verifying-key.algorithm-hash).
pub fn length(&self) -> Option<u32>
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>>
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>
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> ⓘ
pub fn export_spki(&self) -> Vec<u8> ⓘ
The public key as a SubjectPublicKeyInfo
(verifying-key.export-key-spki).
pub fn export_jwk(&self) -> String
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>
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§
Auto Trait Implementations§
impl Freeze for SigPublic
impl RefUnwindSafe for SigPublic
impl Send for SigPublic
impl Sync for SigPublic
impl Unpin for SigPublic
impl UnsafeUnpin for SigPublic
impl UnwindSafe for SigPublic
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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