Struct rsa::RsaPublicKey
source · [−]pub struct RsaPublicKey { /* private fields */ }
Expand description
Represents the public part of an RSA key.
Implementations
sourceimpl RsaPublicKey
impl RsaPublicKey
Trait Implementations
sourceimpl Clone for RsaPublicKey
This is supported on crate feature alloc
only.
impl Clone for RsaPublicKey
alloc
only.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 more
sourceimpl Debug for RsaPublicKey
This is supported on crate feature alloc
only.
impl Debug for RsaPublicKey
alloc
only.sourceimpl DecodePublicKey for RsaPublicKey
This is supported on crate feature alloc
only.
impl DecodePublicKey for RsaPublicKey
alloc
only.sourcefn 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 more
sourcefn from_public_key_doc(doc: &PublicKeyDocument) -> Result<Self, Error>
fn from_public_key_doc(doc: &PublicKeyDocument) -> Result<Self, Error>
Deserialize SPKI public key from a PublicKeyDocument
.
sourcefn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded SubjectPublicKeyInfo
. Read more
sourceimpl<'de> Deserialize<'de> for RsaPublicKey
This is supported on crate feature alloc
only.
impl<'de> Deserialize<'de> for RsaPublicKey
alloc
only.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
This is supported on crate feature alloc
only.
impl EncodePublicKey for RsaPublicKey
alloc
only.sourcefn to_public_key_der(&self) -> Result<PublicKeyDocument>
fn to_public_key_der(&self) -> Result<PublicKeyDocument>
Serialize a PublicKeyDocument
containing a SPKI-encoded public key.
sourcefn 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
.
sourcefn 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
sourcefn 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
This is supported on crate feature alloc
only.
impl From<&'_ RsaPrivateKey> for RsaPublicKey
alloc
only.sourcefn from(private_key: &RsaPrivateKey) -> Self
fn from(private_key: &RsaPrivateKey) -> Self
Performs the conversion.
sourceimpl From<RsaPrivateKey> for RsaPublicKey
This is supported on crate feature alloc
only.
impl From<RsaPrivateKey> for RsaPublicKey
alloc
only.sourcefn from(private_key: RsaPrivateKey) -> Self
fn from(private_key: RsaPrivateKey) -> Self
Performs the conversion.
sourceimpl Hash for RsaPublicKey
This is supported on crate feature alloc
only.
impl Hash for RsaPublicKey
alloc
only.sourceimpl PartialEq<RsaPublicKey> for RsaPublicKey
This is supported on crate feature alloc
only.
impl PartialEq<RsaPublicKey> for RsaPublicKey
alloc
only.sourcefn 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 ==
. Read more
sourcefn ne(&self, other: &RsaPublicKey) -> bool
fn ne(&self, other: &RsaPublicKey) -> bool
This method tests for !=
.
sourceimpl PublicKey for RsaPublicKey
This is supported on crate feature alloc
only.
impl PublicKey for RsaPublicKey
alloc
only.sourcefn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
fn encrypt<R: Rng>(
&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 more
sourceimpl<'a> PublicKey for &'a RsaPublicKey
This is supported on crate feature alloc
only.
impl<'a> PublicKey for &'a RsaPublicKey
alloc
only.sourcefn encrypt<R: Rng>(
&self,
rng: &mut R,
padding: PaddingScheme,
msg: &[u8]
) -> Result<Vec<u8>>
fn encrypt<R: Rng>(
&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 more
sourceimpl PublicKeyParts for RsaPublicKey
This is supported on crate feature alloc
only.
impl PublicKeyParts for RsaPublicKey
alloc
only.sourceimpl<'a> PublicKeyParts for &'a RsaPublicKey
This is supported on crate feature alloc
only.
impl<'a> PublicKeyParts for &'a RsaPublicKey
alloc
only.sourceimpl Serialize for RsaPublicKey
This is supported on crate feature alloc
only.
impl Serialize for RsaPublicKey
alloc
only.sourceimpl TryFrom<SubjectPublicKeyInfo<'_>> for RsaPublicKey
This is supported on crate feature alloc
only.
impl TryFrom<SubjectPublicKeyInfo<'_>> for RsaPublicKey
alloc
only.impl Eq for RsaPublicKey
alloc
only.impl StructuralEq for RsaPublicKey
alloc
only.impl StructuralPartialEq for RsaPublicKey
alloc
only.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 T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
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 T where
T: DecodePublicKey,
impl<T> DecodeRsaPublicKey for T where
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 more
sourcefn from_pkcs1_pem(s: &str) -> Result<Self, Error>
fn from_pkcs1_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded [RsaPublicKey
]. Read more
sourceimpl<T> EncodeRsaPublicKey for T where
T: EncodePublicKey,
impl<T> EncodeRsaPublicKey for T where
T: EncodePublicKey,
sourcefn to_pkcs1_der(&self) -> Result<RsaPublicKeyDocument, Error>
fn to_pkcs1_der(&self) -> Result<RsaPublicKeyDocument, Error>
Serialize a RsaPublicKeyDocument
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.
sourcefn write_pkcs1_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
fn write_pkcs1_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path.
sourcefn write_pkcs1_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
fn write_pkcs1_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<(), Error>
Write ASN.1 DER-encoded public key to the given path.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more