Struct pkcs1::RsaPublicKey
source · pub struct RsaPublicKey<'a> {
pub modulus: UIntBytes<'a>,
pub public_exponent: UIntBytes<'a>,
}
Expand description
PKCS#1 RSA Public Keys as defined in RFC 8017 Appendix 1.1.
ASN.1 structure containing a serialized RSA public key:
RSAPublicKey ::= SEQUENCE {
modulus INTEGER, -- n
publicExponent INTEGER -- e
}
Fields§
§modulus: UIntBytes<'a>
n
: RSA modulus
public_exponent: UIntBytes<'a>
e
: RSA public exponent
Implementations§
source§impl<'a> RsaPublicKey<'a>
impl<'a> RsaPublicKey<'a>
sourcepub fn to_der(self) -> Result<RsaPublicKeyDocument>
pub fn to_der(self) -> Result<RsaPublicKeyDocument>
Encode this RsaPublicKey
as ASN.1 DER.
sourcepub fn to_pem(self, line_ending: LineEnding) -> Result<String>
pub fn to_pem(self, line_ending: LineEnding) -> Result<String>
Encode this RsaPublicKey
as PEM-encoded ASN.1 DER with the given
LineEnding
.
Trait Implementations§
source§impl<'a> Clone for RsaPublicKey<'a>
impl<'a> Clone for RsaPublicKey<'a>
source§fn clone(&self) -> RsaPublicKey<'a>
fn clone(&self) -> RsaPublicKey<'a>
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<'a> Debug for RsaPublicKey<'a>
impl<'a> Debug for RsaPublicKey<'a>
source§impl<'a> Decodable<'a> for RsaPublicKey<'a>
impl<'a> Decodable<'a> for RsaPublicKey<'a>
source§impl<'a> From<&RsaPrivateKey<'a>> for RsaPublicKey<'a>
impl<'a> From<&RsaPrivateKey<'a>> for RsaPublicKey<'a>
source§fn from(private_key: &RsaPrivateKey<'a>) -> RsaPublicKey<'a>
fn from(private_key: &RsaPrivateKey<'a>) -> RsaPublicKey<'a>
Converts to this type from the input type.
source§impl<'a> From<RsaPrivateKey<'a>> for RsaPublicKey<'a>
impl<'a> From<RsaPrivateKey<'a>> for RsaPublicKey<'a>
source§fn from(private_key: RsaPrivateKey<'a>) -> RsaPublicKey<'a>
fn from(private_key: RsaPrivateKey<'a>) -> RsaPublicKey<'a>
Converts to this type from the input type.
source§impl<'a> PartialEq for RsaPublicKey<'a>
impl<'a> PartialEq for RsaPublicKey<'a>
source§fn eq(&self, other: &RsaPublicKey<'a>) -> bool
fn eq(&self, other: &RsaPublicKey<'a>) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl<'a> Sequence<'a> for RsaPublicKey<'a>
impl<'a> Sequence<'a> for RsaPublicKey<'a>
source§impl<'a> TryFrom<&'a [u8]> for RsaPublicKey<'a>
impl<'a> TryFrom<&'a [u8]> for RsaPublicKey<'a>
source§impl TryFrom<&RsaPublicKey<'_>> for RsaPublicKeyDocument
impl TryFrom<&RsaPublicKey<'_>> for RsaPublicKeyDocument
source§fn try_from(public_key: &RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>
fn try_from(public_key: &RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>
Performs the conversion.
source§impl TryFrom<RsaPublicKey<'_>> for RsaPublicKeyDocument
impl TryFrom<RsaPublicKey<'_>> for RsaPublicKeyDocument
source§fn try_from(public_key: RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>
fn try_from(public_key: RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>
Performs the conversion.
impl<'a> Copy for RsaPublicKey<'a>
impl<'a> Eq for RsaPublicKey<'a>
impl<'a> StructuralEq for RsaPublicKey<'a>
impl<'a> StructuralPartialEq for RsaPublicKey<'a>
Auto Trait Implementations§
impl<'a> RefUnwindSafe for RsaPublicKey<'a>
impl<'a> Send for RsaPublicKey<'a>
impl<'a> Sync for RsaPublicKey<'a>
impl<'a> Unpin for RsaPublicKey<'a>
impl<'a> UnwindSafe for RsaPublicKey<'a>
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Encodable for Twhere
T: EncodeValue + Tagged,
impl<T> Encodable for Twhere
T: EncodeValue + Tagged,
source§fn encoded_len(&self) -> Result<Length, Error>
fn encoded_len(&self) -> Result<Length, Error>
Compute the length of this value in bytes when encoded as ASN.1 DER.
source§fn encode(&self, encoder: &mut Encoder<'_>) -> Result<(), Error>
fn encode(&self, encoder: &mut Encoder<'_>) -> Result<(), Error>
Encode this value as ASN.1 DER using the provided Encoder
.
source§fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
fn encode_to_slice<'a>(&self, buf: &'a mut [u8]) -> Result<&'a [u8], Error>
Encode this value to the provided byte slice, returning a sub-slice
containing the encoded message.