pub struct RsaPublicKeyDocument(/* private fields */);
Expand description

PKCS#1 RSA PUBLIC KEY document.

This type provides storage for RsaPublicKey encoded as ASN.1 DER with the invariant that the contained-document is “well-formed”, i.e. it will parse successfully according to this crate’s parsing rules.

Trait Implementations§

source§

impl AsRef<[u8]> for RsaPublicKeyDocument

source§

fn as_ref(&self) -> &[u8]

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl Clone for RsaPublicKeyDocument

source§

fn clone(&self) -> RsaPublicKeyDocument

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl Debug for RsaPublicKeyDocument

source§

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

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

impl DecodeRsaPublicKey for RsaPublicKeyDocument

source§

fn from_pkcs1_der(bytes: &[u8]) -> Result<Self>

Deserialize object from ASN.1 DER-encoded [RsaPublicKey] (binary format).
source§

fn from_pkcs1_pem(s: &str) -> Result<Self>

Deserialize PEM-encoded [RsaPublicKey]. Read more
source§

fn read_pkcs1_der_file(path: impl AsRef<Path>) -> Result<Self>

Load [RsaPublicKey] from an ASN.1 DER-encoded file on the local filesystem (binary format).
source§

fn read_pkcs1_pem_file(path: impl AsRef<Path>) -> Result<Self>

Load [RsaPublicKey] from a PEM-encoded file on the local filesystem.
source§

impl<'a> Document<'a> for RsaPublicKeyDocument

§

type Message = RsaPublicKey<'a>

ASN.1 message type this document decodes to.
source§

const SENSITIVE: bool = false

Does this type contain potentially sensitive data? Read more
source§

fn as_der(&self) -> &[u8]

Borrow the inner serialized bytes of this document.
source§

fn to_der(&self) -> Box<[u8]>

Return an allocated ASN.1 DER serialization as a boxed slice.
source§

fn decode(&'a self) -> Self::Message

Decode this document as ASN.1 DER.
source§

fn from_der(bytes: &[u8]) -> Result<Self, Error>

Create a new document from the provided ASN.1 DER bytes.
source§

fn from_msg(msg: &Self::Message) -> Result<Self, Error>

Encode the provided type as ASN.1 DER.
source§

fn from_pem(s: &str) -> Result<Self, Error>
where Self: PemLabel,

Decode ASN.1 DER document from PEM.
source§

fn to_pem(&self, line_ending: LineEnding) -> Result<String, Error>
where Self: PemLabel,

Encode ASN.1 DER document as a PEM string.
source§

fn read_der_file(path: impl AsRef<Path>) -> Result<Self, Error>

Read ASN.1 DER document from a file.
source§

fn read_pem_file(path: impl AsRef<Path>) -> Result<Self, Error>
where Self: PemLabel,

Read PEM-encoded ASN.1 DER document from a file.
source§

fn write_der_file(&self, path: impl AsRef<Path>) -> Result<(), Error>

Write ASN.1 DER document to a file.
source§

fn write_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<(), Error>
where Self: PemLabel,

Write PEM-encoded ASN.1 DER document to a file.
source§

impl EncodeRsaPublicKey for RsaPublicKeyDocument

source§

fn to_pkcs1_der(&self) -> Result<RsaPublicKeyDocument>

Serialize a RsaPublicKeyDocument containing a PKCS#1-encoded public key.
source§

fn to_pkcs1_pem(&self, line_ending: LineEnding) -> Result<String>

Serialize this public key as PEM-encoded PKCS#1 with the given line ending.
source§

fn write_pkcs1_der_file(&self, path: impl AsRef<Path>) -> Result<()>

Write ASN.1 DER-encoded public key to the given path.
source§

fn write_pkcs1_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<()>

Write ASN.1 DER-encoded public key to the given path.
source§

impl FromStr for RsaPublicKeyDocument

§

type Err = Error

The associated error which can be returned from parsing.
source§

fn from_str(s: &str) -> Result<Self>

Parses a string s to return a value of this type. Read more
source§

impl PemLabel for RsaPublicKeyDocument

source§

const TYPE_LABEL: &'static str = "RSA PUBLIC KEY"

Expected PEM type label for a given document, e.g. "PRIVATE KEY"
source§

impl TryFrom<&[u8]> for RsaPublicKeyDocument

§

type Error = Error

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

fn try_from(bytes: &[u8]) -> Result<Self>

Performs the conversion.
source§

impl TryFrom<&RsaPublicKey<'_>> for RsaPublicKeyDocument

§

type Error = Error

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

fn try_from(public_key: &RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>

Performs the conversion.
source§

impl TryFrom<RsaPublicKey<'_>> for RsaPublicKeyDocument

§

type Error = Error

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

fn try_from(public_key: RsaPublicKey<'_>) -> Result<RsaPublicKeyDocument>

Performs the conversion.
source§

impl TryFrom<Vec<u8>> for RsaPublicKeyDocument

§

type Error = Error

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

fn try_from(bytes: Vec<u8>) -> Result<Self>

Performs the conversion.

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> 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

§

type Output = T

Should always be Self
source§

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

§

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>,

§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

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

§

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.