Struct pkcs8::PublicKeyDocument
source · [−]pub struct PublicKeyDocument(_);
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.
Implementations
sourceimpl PublicKeyDocument
impl PublicKeyDocument
sourcepub fn spki(&self) -> SubjectPublicKeyInfo<'_>
pub fn spki(&self) -> SubjectPublicKeyInfo<'_>
Parse the SubjectPublicKeyInfo
contained in this PublicKeyDocument
sourcepub fn from_pem(s: &str) -> Result<Self>
pub fn from_pem(s: &str) -> Result<Self>
Parse PublicKeyDocument
from PEM.
PEM-encoded public keys can be identified by the leading delimiter:
-----BEGIN PUBLIC KEY-----
sourcepub fn to_pem(&self) -> String
pub fn to_pem(&self) -> String
Serialize PublicKeyDocument
as PEM-encoded PKCS#8 (SPKI) string.
sourcepub fn to_pem_with_le(&self, line_ending: LineEnding) -> String
pub fn to_pem_with_le(&self, line_ending: LineEnding) -> String
Serialize PublicKeyDocument
as PEM-encoded PKCS#8 (SPKI) string
with the given LineEnding
.
sourcepub fn read_der_file(path: impl AsRef<Path>) -> Result<Self>
pub fn read_der_file(path: impl AsRef<Path>) -> Result<Self>
Load PublicKeyDocument
from an ASN.1 DER-encoded file on the local
filesystem (binary format).
sourcepub fn read_pem_file(path: impl AsRef<Path>) -> Result<Self>
pub fn read_pem_file(path: impl AsRef<Path>) -> Result<Self>
Load PublicKeyDocument
from a PEM-encoded file on the local filesystem.
Trait Implementations
sourceimpl Clone for PublicKeyDocument
impl Clone for PublicKeyDocument
sourcefn clone(&self) -> PublicKeyDocument
fn clone(&self) -> PublicKeyDocument
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 PublicKeyDocument
impl Debug for PublicKeyDocument
sourceimpl From<&'_ SubjectPublicKeyInfo<'_>> for PublicKeyDocument
impl From<&'_ SubjectPublicKeyInfo<'_>> for PublicKeyDocument
sourcefn from(spki: &SubjectPublicKeyInfo<'_>) -> PublicKeyDocument
fn from(spki: &SubjectPublicKeyInfo<'_>) -> PublicKeyDocument
Converts to this type from the input type.
sourceimpl From<SubjectPublicKeyInfo<'_>> for PublicKeyDocument
impl From<SubjectPublicKeyInfo<'_>> for PublicKeyDocument
sourcefn from(spki: SubjectPublicKeyInfo<'_>) -> PublicKeyDocument
fn from(spki: SubjectPublicKeyInfo<'_>) -> PublicKeyDocument
Converts to this type from the input type.
sourceimpl FromStr for PublicKeyDocument
impl FromStr for PublicKeyDocument
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
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> 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