Struct pkcs8::PublicKeyDocument
source · pub struct PublicKeyDocument(/* private fields */);
Expand description
SPKI public key document.
This type provides storage for SubjectPublicKeyInfo
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 PublicKeyDocument
impl AsRef<[u8]> for PublicKeyDocument
source§impl Clone for PublicKeyDocument
impl Clone for PublicKeyDocument
source§fn clone(&self) -> PublicKeyDocument
fn clone(&self) -> PublicKeyDocument
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 PublicKeyDocument
impl Debug for PublicKeyDocument
source§impl DecodePublicKey for PublicKeyDocument
impl DecodePublicKey for PublicKeyDocument
source§fn from_public_key_der(bytes: &[u8]) -> Result<PublicKeyDocument, Error>
fn from_public_key_der(bytes: &[u8]) -> Result<PublicKeyDocument, Error>
Deserialize object from ASN.1 DER-encoded
SubjectPublicKeyInfo
(binary format).source§fn from_public_key_pem(s: &str) -> Result<PublicKeyDocument, Error>
fn from_public_key_pem(s: &str) -> Result<PublicKeyDocument, Error>
Deserialize PEM-encoded
SubjectPublicKeyInfo
. Read moresource§fn read_public_key_der_file(
path: impl AsRef<Path>
) -> Result<PublicKeyDocument, Error>
fn read_public_key_der_file( path: impl AsRef<Path> ) -> Result<PublicKeyDocument, Error>
Load public key object from an ASN.1 DER-encoded file on the local
filesystem (binary format).
source§fn read_public_key_pem_file(
path: impl AsRef<Path>
) -> Result<PublicKeyDocument, Error>
fn read_public_key_pem_file( path: impl AsRef<Path> ) -> Result<PublicKeyDocument, Error>
Load public key object from a PEM-encoded file on the local filesystem.
source§fn 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
.source§impl<'a> Document<'a> for PublicKeyDocument
impl<'a> Document<'a> for PublicKeyDocument
§type Message = SubjectPublicKeyInfo<'a>
type Message = SubjectPublicKeyInfo<'a>
ASN.1 message type this document decodes to.
source§fn from_der(bytes: &[u8]) -> Result<Self, Error>
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>
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,
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,
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>
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,
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>
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,
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 EncodePublicKey for PublicKeyDocument
impl EncodePublicKey for PublicKeyDocument
source§fn to_public_key_der(&self) -> Result<PublicKeyDocument, Error>
fn to_public_key_der(&self) -> Result<PublicKeyDocument, Error>
Serialize a
PublicKeyDocument
containing a SPKI-encoded public key.source§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
.source§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
source§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
source§impl FromStr for PublicKeyDocument
impl FromStr for PublicKeyDocument
source§impl PemLabel for PublicKeyDocument
impl PemLabel for PublicKeyDocument
source§const TYPE_LABEL: &'static str = "PUBLIC KEY"
const TYPE_LABEL: &'static str = "PUBLIC KEY"
Expected PEM type label for a given document, e.g.
"PRIVATE KEY"
source§impl TryFrom<&[u8]> for PublicKeyDocument
impl TryFrom<&[u8]> for PublicKeyDocument
source§impl TryFrom<&SubjectPublicKeyInfo<'_>> for PublicKeyDocument
impl TryFrom<&SubjectPublicKeyInfo<'_>> for PublicKeyDocument
source§fn try_from(spki: &SubjectPublicKeyInfo<'_>) -> Result<PublicKeyDocument, Error>
fn try_from(spki: &SubjectPublicKeyInfo<'_>) -> Result<PublicKeyDocument, Error>
Performs the conversion.
source§impl TryFrom<SubjectPublicKeyInfo<'_>> for PublicKeyDocument
impl TryFrom<SubjectPublicKeyInfo<'_>> for PublicKeyDocument
source§fn try_from(spki: SubjectPublicKeyInfo<'_>) -> Result<PublicKeyDocument, Error>
fn try_from(spki: SubjectPublicKeyInfo<'_>) -> Result<PublicKeyDocument, Error>
Performs the conversion.
Auto Trait Implementations§
impl RefUnwindSafe for PublicKeyDocument
impl Send for PublicKeyDocument
impl Sync for PublicKeyDocument
impl Unpin for PublicKeyDocument
impl UnwindSafe for PublicKeyDocument
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