Skip to main content

RsaParameters

Struct RsaParameters 

Source
pub struct RsaParameters {
    digest_alg: &'static Algorithm,
    padding: &'static RsaPadding,
    pss_salt_length: RsaPssSaltLength,
    range: RangeInclusive<u32>,
    verification_alg: &'static RsaVerificationAlgorithmId,
}
Expand description

Parameters for RSA verification.

Two values are equal when they denote the same verification algorithm, e.g. RSA_PKCS1_2048_8192_SHA256. Algorithms differing in digest algorithm, padding scheme, RSA PSS salt length, or modulus size range compare unequal. In short, it is equality of configuration, not equality of effective behavior.

Fields§

§digest_alg: &'static Algorithm§padding: &'static RsaPadding§pss_salt_length: RsaPssSaltLength§range: RangeInclusive<u32>§verification_alg: &'static RsaVerificationAlgorithmId

Implementations§

Source§

impl RsaParameters

Source

pub(crate) fn digest_algorithm(&self) -> &'static Algorithm

Source

pub(crate) fn padding(&self) -> &'static RsaPadding

Source

pub(crate) fn pss_salt_length(&self) -> RsaPssSaltLength

Source

pub(crate) fn bit_size_range(&self) -> &RangeInclusive<u32> ⓘ

Source§

impl RsaParameters

Source

pub(crate) const fn new( digest_alg: &'static Algorithm, padding: &'static RsaPadding, range: RangeInclusive<u32>, verification_alg: &'static RsaVerificationAlgorithmId, ) -> Self

Source

pub const fn with_pss_salt_length(self, saltlen: RsaPssSaltLength) -> Self

Sets the RSA-PSS salt length to the given value.

This is ignored for PKCS#1 v1.5 parameters.

Due to the requirement of 'static references to the current type in verification APIs, it is not possible to directly give the result of this method to them, nor simply re-borrow it. Instead either the inline &const { rsa_param.with_pss_salt_length(...) } expression syntax should be used, or the following if Rust below 1.79 is used:

use aws_lc_rs::signature::{self, RsaPssSaltLength};

const VERIFY_ALG: signature::RsaParameters =
    signature::RSA_PSS_2048_8192_SHA256.with_pss_salt_length(RsaPssSaltLength::Custom(123));
// Now use `VERIFY_ALG` instead of `RSA_PSS_2048_8192_SHA256`.
Source

pub fn public_modulus_len(public_key: &[u8]) -> Result<u32, Unspecified>

Parses a DER-encoded RSAPublicKey structure (RFC 8017) to determine its size in bits.

§Errors

error::Unspecified on parse error.

Source

pub fn min_modulus_len(&self) -> u32

Minimum modulus length in bits.

Source

pub fn max_modulus_len(&self) -> u32

Maximum modulus length in bits.

Trait Implementations§

Source§

impl Debug for RsaParameters

Source§

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

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

impl Eq for RsaParameters

Source§

impl ParsedVerificationAlgorithm for RsaParameters

Source§

fn parsed_verify_sig( &self, public_key: &ParsedPublicKey, msg: &[u8], signature: &[u8], ) -> Result<(), Unspecified>

Source§

fn parsed_verify_digest_sig( &self, public_key: &ParsedPublicKey, digest: &Digest, signature: &[u8], ) -> Result<(), Unspecified>

Source§

impl PartialEq for RsaParameters

Source§

fn eq(&self, other: &RsaParameters) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Sealed for RsaParameters

Source§

impl StructuralPartialEq for RsaParameters

Source§

impl VerificationAlgorithm for RsaParameters

Source§

fn verify_sig( &self, public_key: &[u8], msg: &[u8], signature: &[u8], ) -> Result<(), Unspecified>

Verify the signature signature of message msg with the public key public_key. Read more
Source§

fn verify_digest_sig( &self, public_key: &[u8], digest: &Digest, signature: &[u8], ) -> Result<(), Unspecified>

Verify the signature signature of digest with the public_key. 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, 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.