Struct RsaAesOaepParams

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

Implementations§

Source§

impl<'a> RsaAesOaepParams<'a>

Source

pub const EMPTY: &'static AlgorithmIdentifier<'static>

Source

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

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

pub fn p_source_alg(&'a self) -> &'a AlgorithmIdentifier<'a>

Return the pSourceFunc algorithm

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

Trait Implementations§

Source§

impl CheckDerConstraints for RsaAesOaepParams<'_>

Source§

impl<'a> Debug for RsaAesOaepParams<'a>

Source§

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

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

impl<'a> PartialEq for RsaAesOaepParams<'a>

Source§

fn eq(&self, other: &RsaAesOaepParams<'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 RsaAesOaepParams<'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 RsaAesOaepParams<'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 RsaAesOaepParams<'_>

Source§

impl<'a> StructuralPartialEq for RsaAesOaepParams<'a>

Auto Trait Implementations§

§

impl<'a> Freeze for RsaAesOaepParams<'a>

§

impl<'a> RefUnwindSafe for RsaAesOaepParams<'a>

§

impl<'a> Send for RsaAesOaepParams<'a>

§

impl<'a> Sync for RsaAesOaepParams<'a>

§

impl<'a> Unpin for RsaAesOaepParams<'a>

§

impl<'a> UnwindSafe for RsaAesOaepParams<'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.