SignerWithChain

Struct SignerWithChain 

Source
pub struct SignerWithChain<S> { /* private fields */ }
Expand description

Signer decorator with an X.509 certificate chain associated with the key pair.

Useful in contexts which require distributing the certificate chain with the signature (e.g. the x5c JWT header parameter).

Implementations§

Source§

impl<S: Signer> SignerWithChain<S>

Source

pub fn new(signer: S, x5chain: X5Chain) -> Result<Self, CryptoError>

Construct a new instance by pairing up a Signer with the X5Chain for its public key.

§Errors

Returns an error if the public keys of the Signer and X5Chain’s leaf certificate do not match.

Currently, due to limited support for signing algorithms, returns an error if the key algorithm is not supported.

Source

pub fn certificate_chain(&self) -> &X5Chain

Returns a reference to the contained X5Chain.

Source

pub fn public_jwk(&self) -> Result<JwkPublic, CryptoError>

Get the public key in JWK format.

Trait Implementations§

Source§

impl<S: Debug> Debug for SignerWithChain<S>

Source§

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

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

impl<S: HasJwkKid> HasJwkKid for SignerWithChain<S>

Source§

fn jwk_kid(&self) -> &str

Return the kid parameter of the associated JWK. Read more
Source§

impl<S: Signer> HasX5Chain for SignerWithChain<S>

Source§

fn x5chain(&self) -> X5Chain

Return the x5c parameter of the associated JWK.
Source§

impl<S: Signer> Signer for SignerWithChain<S>

Source§

fn algorithm(&self) -> SigningAlgorithm

The algorithm this signer uses. Must be a constant function.
Source§

fn sign(&self, message: &[u8]) -> Result<Vec<u8>, BoxError>

Produce a JWS signature as a byte array, not yet base64url-encoded. Read more
Source§

fn public_jwk(&self) -> Result<JwkPublic, BoxError>

The public key of the respective Signer in the JWK format.

Auto Trait Implementations§

§

impl<S> Freeze for SignerWithChain<S>
where S: Freeze,

§

impl<S> RefUnwindSafe for SignerWithChain<S>
where S: RefUnwindSafe,

§

impl<S> Send for SignerWithChain<S>
where S: Send,

§

impl<S> Sync for SignerWithChain<S>
where S: Sync,

§

impl<S> Unpin for SignerWithChain<S>
where S: Unpin,

§

impl<S> UnwindSafe for SignerWithChain<S>
where S: UnwindSafe,

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<S> JwtSigner for S
where S: Signer + ?Sized,

Source§

fn sign_jwt<UnsignedJwt, SignedJwt>( &self, unsigned_jwt: UnsignedJwt, ) -> Result<SignedJwt, Box<dyn Error + Sync + Send>>
where UnsignedJwt: SignWithKey<SignedJwt>,

Utility function that delegates to jwt::SignWithKey while allowing proper propagation of errors from both the foreign trait and the Signer.
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.
Source§

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

Source§

fn vzip(self) -> V