Struct jwt_compact::alg::RsaPublicKey
source · pub struct RsaPublicKey { /* private fields */ }Available on crate feature
rsa only.Expand description
Represents the public part of an RSA key.
Implementations§
source§impl RsaPublicKey
impl RsaPublicKey
sourcepub const MIN_PUB_EXPONENT: u64 = 2u64
pub const MIN_PUB_EXPONENT: u64 = 2u64
Minimum value of the public exponent e.
sourcepub const MAX_PUB_EXPONENT: u64 = 8_589_934_591u64
pub const MAX_PUB_EXPONENT: u64 = 8_589_934_591u64
Maximum value of the public exponent e.
sourcepub fn new(n: BigUint, e: BigUint) -> Result<RsaPublicKey, Error>
pub fn new(n: BigUint, e: BigUint) -> Result<RsaPublicKey, Error>
Create a new public key from its components.
This function accepts public keys with a modulus size up to 4096-bits,
i.e. RsaPublicKey::MAX_SIZE.
sourcepub fn new_with_max_size(
n: BigUint,
e: BigUint,
max_size: usize
) -> Result<RsaPublicKey, Error>
pub fn new_with_max_size( n: BigUint, e: BigUint, max_size: usize ) -> Result<RsaPublicKey, Error>
Create a new public key from its components.
sourcepub fn new_unchecked(n: BigUint, e: BigUint) -> RsaPublicKey
pub fn new_unchecked(n: BigUint, e: BigUint) -> RsaPublicKey
Create a new public key, bypassing checks around the modulus and public exponent size.
This method is not recommended, and only intended for unusual use cases.
Most applications should use RsaPublicKey::new or
RsaPublicKey::new_with_max_size instead.
Trait Implementations§
source§impl Clone for RsaPublicKey
impl Clone for RsaPublicKey
source§fn clone(&self) -> RsaPublicKey
fn clone(&self) -> RsaPublicKey
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moresource§impl Debug for RsaPublicKey
impl Debug for RsaPublicKey
source§impl DecodePublicKey for RsaPublicKey
impl DecodePublicKey for RsaPublicKey
§fn from_public_key_der(bytes: &[u8]) -> Result<Self, Error>
fn from_public_key_der(bytes: &[u8]) -> Result<Self, Error>
Deserialize object from ASN.1 DER-encoded [
SubjectPublicKeyInfo]
(binary format).source§impl EncodePublicKey for RsaPublicKey
impl EncodePublicKey for RsaPublicKey
source§fn to_public_key_der(&self) -> Result<Document, Error>
fn to_public_key_der(&self) -> Result<Document, Error>
Serialize a [
Document] containing a SPKI-encoded public key.source§impl<'a> From<&'a RsaPublicKey> for JsonWebKey<'a>
impl<'a> From<&'a RsaPublicKey> for JsonWebKey<'a>
source§fn from(key: &'a RsaPublicKey) -> JsonWebKey<'a>
fn from(key: &'a RsaPublicKey) -> JsonWebKey<'a>
Converts to this type from the input type.
source§impl From<&RsaPrivateKey> for RsaPublicKey
impl From<&RsaPrivateKey> for RsaPublicKey
source§fn from(private_key: &RsaPrivateKey) -> RsaPublicKey
fn from(private_key: &RsaPrivateKey) -> RsaPublicKey
Converts to this type from the input type.
source§impl From<RsaPrivateKey> for RsaPublicKey
impl From<RsaPrivateKey> for RsaPublicKey
source§fn from(private_key: RsaPrivateKey) -> RsaPublicKey
fn from(private_key: RsaPrivateKey) -> RsaPublicKey
Converts to this type from the input type.
source§impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere D: Digest,
source§fn from(key: VerifyingKey<D>) -> RsaPublicKey
fn from(key: VerifyingKey<D>) -> RsaPublicKey
Converts to this type from the input type.
source§impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere D: Digest,
source§fn from(key: VerifyingKey<D>) -> RsaPublicKey
fn from(key: VerifyingKey<D>) -> RsaPublicKey
Converts to this type from the input type.
source§impl Hash for RsaPublicKey
impl Hash for RsaPublicKey
source§impl PartialEq<RsaPublicKey> for RsaPublicKey
impl PartialEq<RsaPublicKey> for RsaPublicKey
source§fn eq(&self, other: &RsaPublicKey) -> bool
fn eq(&self, other: &RsaPublicKey) -> bool
This method tests for
self and other values to be equal, and is used
by ==.source§impl PublicKey for RsaPublicKey
impl PublicKey for RsaPublicKey
source§impl PublicKeyParts for RsaPublicKey
impl PublicKeyParts for RsaPublicKey
source§impl TryFrom<&JsonWebKey<'_>> for RsaPublicKey
impl TryFrom<&JsonWebKey<'_>> for RsaPublicKey
source§impl TryFrom<RsaPublicKey> for StrongKey<RsaPublicKey>
impl TryFrom<RsaPublicKey> for StrongKey<RsaPublicKey>
§type Error = WeakKeyError<RsaPublicKey>
type Error = WeakKeyError<RsaPublicKey>
The type returned in the event of a conversion error.
source§impl TryFrom<SubjectPublicKeyInfo<'_>> for RsaPublicKey
impl TryFrom<SubjectPublicKeyInfo<'_>> for RsaPublicKey
impl Eq for RsaPublicKey
impl StructuralEq for RsaPublicKey
impl StructuralPartialEq for RsaPublicKey
Auto Trait Implementations§
impl RefUnwindSafe for RsaPublicKey
impl Send for RsaPublicKey
impl Sync for RsaPublicKey
impl Unpin for RsaPublicKey
impl UnwindSafe for RsaPublicKey
Blanket Implementations§
§impl<T> DecodeRsaPublicKey for Twhere
T: DecodePublicKey,
impl<T> DecodeRsaPublicKey for Twhere T: DecodePublicKey,
§fn from_pkcs1_der(public_key: &[u8]) -> Result<T, Error>
fn from_pkcs1_der(public_key: &[u8]) -> Result<T, Error>
Deserialize object from ASN.1 DER-encoded [
RsaPublicKey]
(binary format).§impl<T> EncodeRsaPublicKey for Twhere
T: EncodePublicKey,
impl<T> EncodeRsaPublicKey for Twhere T: EncodePublicKey,
§fn to_pkcs1_der(&self) -> Result<Document, Error>
fn to_pkcs1_der(&self) -> Result<Document, Error>
Serialize a [
Document] containing a PKCS#1-encoded public key.