Skip to main content

RsaKeyDeviation

Enum RsaKeyDeviation 

Source
pub enum RsaKeyDeviation {
    NonMinimalInteger,
    NegativeInteger,
}
Available on crate feature rsa only.
Expand description

Reading an RSA public key whose DER INTEGERs are not minimal, and saying what had to be forgiven. See rsa_public_key_lenient.

The link carries no explicit target: this pub use re-exports rsa_public_key_lenient, so the label resolves on its own and an explicit one is redundant. rustdoc says so under -D warnings and cannot say where, because a doc comment on a multi-item pub use is attached to each item – one link, two warnings, no single span. Reading an RSA public key whose DER INTEGERs are not minimal, and saying what had to be forgiven. See rsa_public_key_lenient.

The link carries no explicit target: this pub use re-exports rsa_public_key_lenient, so the label resolves on its own and an explicit one is redundant. rustdoc says so under -D warnings and cannot say where, because a doc comment on a multi-item pub use is attached to each item – one link, two warnings, no single span. Reading an RSA public key whose DER INTEGERs are not minimal, and saying what had to be forgiven. See rsa_public_key_lenient.

The link carries no explicit target: this pub use re-exports rsa_public_key_lenient, so the label resolves on its own and an explicit one is redundant. rustdoc says so under -D warnings and cannot say where, because a doc comment on a multi-item pub use is attached to each item – one link, two warnings, no single span. Decodes an RSA public key from an SPKI whose algorithm is rsaEncryption (parameters NULL or absent, RFC 3279 §2.3.1) or, when allow_pss_key is set, id-RSASSA-PSS (RFC 4055 §1.2).

Moduli from 1024 to 8192 bits are accepted (the rsa crate’s limits). What an RSA public key’s DER had to be forgiven for.

Returned beside the key by rsa_public_key_lenient, so a caller learns what was tolerated rather than only that it worked. Nothing in this crate acts on the value; it exists because silently accepting malformed input is how a lenient parser becomes a liability.

Variants§

§

NonMinimalInteger

An INTEGER carried more leading zero octets than it needs.

02 04 00 00 00 03 for the exponent 3, where DER requires the minimal 02 01 03. Unambiguous: the extra octets change no value, and X.690 §8.3.2 forbids them only so that one value has one encoding.

Austria’s a-sign Premium CA and a-sign uni, in third_party/trust-stores/eu-eidas/, both do this.

§

NegativeInteger

An INTEGER’s high bit was set without the leading zero octet that DER requires, so as written it denotes a negative number.

02 04 C0 00 00 01 for the exponent 0xC0000001, where the canonical form is 02 05 00 C0 00 00 01. Reading it as positive is a reinterpretation, not a relaxed length check – see rsa_public_key_lenient on why that is sound for this field and would not be elsewhere.

Germany’s 3R-CA 1:PN and 4R-CA 1:PN of January 1999 do this; 5R-CA of March 2000 encodes the identical exponent correctly, so it was an encoder bug they fixed within fourteen months.

Trait Implementations§

Source§

impl Clone for RsaKeyDeviation

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RsaKeyDeviation

Source§

impl Debug for RsaKeyDeviation

Source§

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

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

impl Eq for RsaKeyDeviation

Source§

impl Hash for RsaKeyDeviation

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for RsaKeyDeviation

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for RsaKeyDeviation

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.