Struct rsa::RsaPublicKey
source · [−]pub struct RsaPublicKey { /* private fields */ }
Expand description
Represents the public part of an RSA key.
Implementations
sourceimpl 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
.
Trait Implementations
sourceimpl<D> AsRef<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
impl<D> AsRef<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
sourcefn as_ref(&self) -> &RsaPublicKey
fn as_ref(&self) -> &RsaPublicKey
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl<D> AsRef<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
impl<D> AsRef<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
sourcefn as_ref(&self) -> &RsaPublicKey
fn as_ref(&self) -> &RsaPublicKey
Converts this type into a shared reference of the (usually inferred) input type.
sourceimpl Clone for RsaPublicKey
impl Clone for RsaPublicKey
sourcefn clone(&self) -> RsaPublicKey
fn clone(&self) -> RsaPublicKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresourceimpl Debug for RsaPublicKey
impl Debug for RsaPublicKey
sourceimpl 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). Read morefn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded [
SubjectPublicKeyInfo
]. Read morefn read_public_key_der_file(path: impl AsRef<Path>) -> Result<Self, Error>
fn read_public_key_der_file(path: impl AsRef<Path>) -> Result<Self, Error>
Load public key object from an ASN.1 DER-encoded file on the local
filesystem (binary format). Read more
fn read_public_key_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>
fn read_public_key_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>
Load public key object from a PEM-encoded file on the local filesystem.
sourceimpl<'de> Deserialize<'de> for RsaPublicKey
impl<'de> Deserialize<'de> for RsaPublicKey
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl EncodePublicKey for RsaPublicKey
impl EncodePublicKey for RsaPublicKey
sourcefn to_public_key_der(&self) -> Result<Document>
fn to_public_key_der(&self) -> Result<Document>
Serialize a [
Document
] containing a SPKI-encoded public key.fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
Serialize this public key as PEM-encoded SPKI with the given [
LineEnding
].fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_public_key_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path
fn write_public_key_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
fn write_public_key_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path
sourceimpl From<&RsaPrivateKey> for RsaPublicKey
impl From<&RsaPrivateKey> for RsaPublicKey
sourcefn from(private_key: &RsaPrivateKey) -> Self
fn from(private_key: &RsaPrivateKey) -> Self
Converts to this type from the input type.
sourceimpl From<RsaPrivateKey> for RsaPublicKey
impl From<RsaPrivateKey> for RsaPublicKey
sourcefn from(private_key: RsaPrivateKey) -> Self
fn from(private_key: RsaPrivateKey) -> Self
Converts to this type from the input type.
sourceimpl<D> From<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
impl<D> From<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
sourcefn from(key: RsaPublicKey) -> Self
fn from(key: RsaPublicKey) -> Self
Converts to this type from the input type.
sourceimpl<D> From<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
impl<D> From<RsaPublicKey> for VerifyingKey<D>where
D: Digest,
sourcefn from(key: RsaPublicKey) -> Self
fn from(key: RsaPublicKey) -> Self
Converts to this type from the input type.
sourceimpl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
sourcefn from(key: VerifyingKey<D>) -> Self
fn from(key: VerifyingKey<D>) -> Self
Converts to this type from the input type.
sourceimpl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
impl<D> From<VerifyingKey<D>> for RsaPublicKeywhere
D: Digest,
sourcefn from(key: VerifyingKey<D>) -> Self
fn from(key: VerifyingKey<D>) -> Self
Converts to this type from the input type.
sourceimpl Hash for RsaPublicKey
impl Hash for RsaPublicKey
sourceimpl PartialEq<RsaPublicKey> for RsaPublicKey
impl PartialEq<RsaPublicKey> for RsaPublicKey
sourcefn eq(&self, other: &RsaPublicKey) -> bool
fn eq(&self, other: &RsaPublicKey) -> bool
sourceimpl PublicKey for RsaPublicKey
impl PublicKey for RsaPublicKey
sourcefn encrypt<R: RngCore + CryptoRng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
fn encrypt<R: RngCore + CryptoRng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
Encrypt the given message.
sourcefn verify(&self, padding: PaddingScheme, hashed: &[u8], sig: &[u8]) -> Result<()>
fn verify(&self, padding: PaddingScheme, hashed: &[u8], sig: &[u8]) -> Result<()>
Verify a signed message.
hashed
must be the result of hashing the input using the hashing function
passed in through hash
.
If the message is valid Ok(())
is returned, otherwiese an Err
indicating failure. Read moresourceimpl PublicKeyParts for RsaPublicKey
impl PublicKeyParts for RsaPublicKey
sourceimpl Serialize for RsaPublicKey
impl Serialize for RsaPublicKey
sourceimpl 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> DecodeRsaPublicKey for Twhere
T: DecodePublicKey,
impl<T> DecodeRsaPublicKey for Twhere
T: DecodePublicKey,
sourcefn 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). Read moresourcefn from_pkcs1_pem(s: &str) -> Result<Self, Error>
fn from_pkcs1_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded
RsaPublicKey
. Read moresourcefn read_pkcs1_der_file(path: impl AsRef<Path>) -> Result<Self, Error>
fn read_pkcs1_der_file(path: impl AsRef<Path>) -> Result<Self, Error>
Load
RsaPublicKey
from an ASN.1 DER-encoded file on the local
filesystem (binary format). Read moresourcefn read_pkcs1_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>
fn read_pkcs1_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>
Load
RsaPublicKey
from a PEM-encoded file on the local filesystem.sourceimpl<T> EncodeRsaPublicKey for Twhere
T: EncodePublicKey,
impl<T> EncodeRsaPublicKey for Twhere
T: EncodePublicKey,
sourcefn 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.sourcefn to_pkcs1_pem(&self, line_ending: LineEnding) -> Result<String, Error>
fn to_pkcs1_pem(&self, line_ending: LineEnding) -> Result<String, Error>
Serialize this public key as PEM-encoded PKCS#1 with the given line ending.