RsaSsaPssParams

Struct RsaSsaPssParams 

Source
pub struct RsaSsaPssParams<'a> { /* private fields */ }

Implementations§

Source§

impl<'a> RsaSsaPssParams<'a>

Source

pub fn hash_algorithm(&self) -> Option<&AlgorithmIdentifier<'_>>

Get a reference to the rsa ssa pss params’s hash algorithm.

Source

pub fn hash_algorithm_oid(&self) -> &'a Oid<'_>

Return the hash algorithm OID, or SHA1 if absent (RFC4055)

Examples found in repository?
examples/print-cert.rs (line 245)
230fn print_x509_signature_algorithm(signature_algorithm: &AlgorithmIdentifier, indent: usize) {
231    match SignatureAlgorithm::try_from(signature_algorithm) {
232        Ok(sig_alg) => {
233            print!("  Signature Algorithm: ");
234            match sig_alg {
235                SignatureAlgorithm::DSA => println!("DSA"),
236                SignatureAlgorithm::ECDSA => println!("ECDSA"),
237                SignatureAlgorithm::ED25519 => println!("ED25519"),
238                SignatureAlgorithm::RSA => println!("RSA"),
239                SignatureAlgorithm::RSASSA_PSS(params) => {
240                    println!("RSASSA-PSS");
241                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
242                    println!(
243                        "{}Hash Algorithm: {}",
244                        indent_s,
245                        format_oid(params.hash_algorithm_oid()),
246                    );
247                    print!("{indent_s}Mask Generation Function: ");
248                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
249                        println!(
250                            "{}/{}",
251                            format_oid(&mask_gen.mgf),
252                            format_oid(&mask_gen.hash),
253                        );
254                    } else {
255                        println!("INVALID");
256                    }
257                    println!("{}Salt Length: {}", indent_s, params.salt_length());
258                }
259                SignatureAlgorithm::RSAAES_OAEP(params) => {
260                    println!("RSAAES-OAEP");
261                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
262                    println!(
263                        "{}Hash Algorithm: {}",
264                        indent_s,
265                        format_oid(params.hash_algorithm_oid()),
266                    );
267                    print!("{indent_s}Mask Generation Function: ");
268                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
269                        println!(
270                            "{}/{}",
271                            format_oid(&mask_gen.mgf),
272                            format_oid(&mask_gen.hash),
273                        );
274                    } else {
275                        println!("INVALID");
276                    }
277                    println!(
278                        "{}pSourceFunc: {}",
279                        indent_s,
280                        format_oid(&params.p_source_alg().algorithm),
281                    );
282                }
283            }
284        }
285        Err(e) => {
286            eprintln!("Could not parse signature algorithm: {e}");
287            println!("  Signature Algorithm:");
288            print_x509_digest_algorithm(signature_algorithm, indent);
289        }
290    }
291}
Source

pub fn mask_gen_algorithm_raw(&self) -> Option<&AlgorithmIdentifier<'_>>

Get a reference to the rsa ssa pss params’s mask generation algorithm.

Source

pub fn mask_gen_algorithm(&self) -> Result<MaskGenAlgorithm<'_, '_>, X509Error>

Get the rsa ssa pss params’s mask generation algorithm.

If the algorithm encoding is invalid, raise an error InvalidAlgorithmIdentifier

Examples found in repository?
examples/print-cert.rs (line 248)
230fn print_x509_signature_algorithm(signature_algorithm: &AlgorithmIdentifier, indent: usize) {
231    match SignatureAlgorithm::try_from(signature_algorithm) {
232        Ok(sig_alg) => {
233            print!("  Signature Algorithm: ");
234            match sig_alg {
235                SignatureAlgorithm::DSA => println!("DSA"),
236                SignatureAlgorithm::ECDSA => println!("ECDSA"),
237                SignatureAlgorithm::ED25519 => println!("ED25519"),
238                SignatureAlgorithm::RSA => println!("RSA"),
239                SignatureAlgorithm::RSASSA_PSS(params) => {
240                    println!("RSASSA-PSS");
241                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
242                    println!(
243                        "{}Hash Algorithm: {}",
244                        indent_s,
245                        format_oid(params.hash_algorithm_oid()),
246                    );
247                    print!("{indent_s}Mask Generation Function: ");
248                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
249                        println!(
250                            "{}/{}",
251                            format_oid(&mask_gen.mgf),
252                            format_oid(&mask_gen.hash),
253                        );
254                    } else {
255                        println!("INVALID");
256                    }
257                    println!("{}Salt Length: {}", indent_s, params.salt_length());
258                }
259                SignatureAlgorithm::RSAAES_OAEP(params) => {
260                    println!("RSAAES-OAEP");
261                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
262                    println!(
263                        "{}Hash Algorithm: {}",
264                        indent_s,
265                        format_oid(params.hash_algorithm_oid()),
266                    );
267                    print!("{indent_s}Mask Generation Function: ");
268                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
269                        println!(
270                            "{}/{}",
271                            format_oid(&mask_gen.mgf),
272                            format_oid(&mask_gen.hash),
273                        );
274                    } else {
275                        println!("INVALID");
276                    }
277                    println!(
278                        "{}pSourceFunc: {}",
279                        indent_s,
280                        format_oid(&params.p_source_alg().algorithm),
281                    );
282                }
283            }
284        }
285        Err(e) => {
286            eprintln!("Could not parse signature algorithm: {e}");
287            println!("  Signature Algorithm:");
288            print_x509_digest_algorithm(signature_algorithm, indent);
289        }
290    }
291}
Source

pub fn salt_length(&self) -> u32

Return the salt length

Examples found in repository?
examples/print-cert.rs (line 257)
230fn print_x509_signature_algorithm(signature_algorithm: &AlgorithmIdentifier, indent: usize) {
231    match SignatureAlgorithm::try_from(signature_algorithm) {
232        Ok(sig_alg) => {
233            print!("  Signature Algorithm: ");
234            match sig_alg {
235                SignatureAlgorithm::DSA => println!("DSA"),
236                SignatureAlgorithm::ECDSA => println!("ECDSA"),
237                SignatureAlgorithm::ED25519 => println!("ED25519"),
238                SignatureAlgorithm::RSA => println!("RSA"),
239                SignatureAlgorithm::RSASSA_PSS(params) => {
240                    println!("RSASSA-PSS");
241                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
242                    println!(
243                        "{}Hash Algorithm: {}",
244                        indent_s,
245                        format_oid(params.hash_algorithm_oid()),
246                    );
247                    print!("{indent_s}Mask Generation Function: ");
248                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
249                        println!(
250                            "{}/{}",
251                            format_oid(&mask_gen.mgf),
252                            format_oid(&mask_gen.hash),
253                        );
254                    } else {
255                        println!("INVALID");
256                    }
257                    println!("{}Salt Length: {}", indent_s, params.salt_length());
258                }
259                SignatureAlgorithm::RSAAES_OAEP(params) => {
260                    println!("RSAAES-OAEP");
261                    let indent_s = format!("{:indent$}", "", indent = indent + 2);
262                    println!(
263                        "{}Hash Algorithm: {}",
264                        indent_s,
265                        format_oid(params.hash_algorithm_oid()),
266                    );
267                    print!("{indent_s}Mask Generation Function: ");
268                    if let Ok(mask_gen) = params.mask_gen_algorithm() {
269                        println!(
270                            "{}/{}",
271                            format_oid(&mask_gen.mgf),
272                            format_oid(&mask_gen.hash),
273                        );
274                    } else {
275                        println!("INVALID");
276                    }
277                    println!(
278                        "{}pSourceFunc: {}",
279                        indent_s,
280                        format_oid(&params.p_source_alg().algorithm),
281                    );
282                }
283            }
284        }
285        Err(e) => {
286            eprintln!("Could not parse signature algorithm: {e}");
287            println!("  Signature Algorithm:");
288            print_x509_digest_algorithm(signature_algorithm, indent);
289        }
290    }
291}
Source

pub fn trailer_field(&self) -> u32

Return the trailer field (value must be 1 according to RFC4055)

Trait Implementations§

Source§

impl CheckDerConstraints for RsaSsaPssParams<'_>

Source§

impl<'a> Debug for RsaSsaPssParams<'a>

Source§

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

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

impl<'a> PartialEq for RsaSsaPssParams<'a>

Source§

fn eq(&self, other: &RsaSsaPssParams<'a>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'a, 'b> TryFrom<&'b Any<'a>> for RsaSsaPssParams<'a>

Source§

type Error = X509Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: &'b Any<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl<'a> TryFrom<Any<'a>> for RsaSsaPssParams<'a>

Source§

type Error = X509Error

The type returned in the event of a conversion error.
Source§

fn try_from(value: Any<'a>) -> Result<Self, Self::Error>

Performs the conversion.
Source§

impl DerAutoDerive for RsaSsaPssParams<'_>

Source§

impl<'a> StructuralPartialEq for RsaSsaPssParams<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RsaSsaPssParams<'a>

§

impl<'a> RefUnwindSafe for RsaSsaPssParams<'a>

§

impl<'a> Send for RsaSsaPssParams<'a>

§

impl<'a> Sync for RsaSsaPssParams<'a>

§

impl<'a> Unpin for RsaSsaPssParams<'a>

§

impl<'a> UnwindSafe for RsaSsaPssParams<'a>

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<'a, T, E> AsTaggedExplicit<'a, E> for T
where T: 'a,

Source§

fn explicit(self, class: Class, tag: u32) -> TaggedParser<'a, Explicit, Self, E>

Source§

impl<'a, T, E> AsTaggedImplicit<'a, E> for T
where T: 'a,

Source§

fn implicit( self, class: Class, constructed: bool, tag: u32, ) -> TaggedParser<'a, Implicit, Self, E>

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<'a, T, E> FromBer<'a, E> for T
where T: TryFrom<Any<'a>, Error = E>, E: From<Error>,

Source§

fn from_ber(bytes: &'a [u8]) -> Result<(&'a [u8], T), Err<E>>

Attempt to parse input bytes into a BER object
Source§

impl<'a, T, E> FromDer<'a, E> for T
where T: TryFrom<Any<'a>, Error = E> + CheckDerConstraints + DerAutoDerive, E: From<Error> + Display + Debug,

Source§

fn from_der(bytes: &'a [u8]) -> Result<(&'a [u8], T), Err<E>>

Attempt to parse input bytes into a DER object (enforcing constraints)
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.