Struct pkcs8::PrivateKeyDocument
source · pub struct PrivateKeyDocument(/* private fields */);
Expand description
PKCS#8 private key document.
This type provides storage for PrivateKeyInfo
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 PrivateKeyDocument
impl AsRef<[u8]> for PrivateKeyDocument
source§impl Clone for PrivateKeyDocument
impl Clone for PrivateKeyDocument
source§fn clone(&self) -> PrivateKeyDocument
fn clone(&self) -> PrivateKeyDocument
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 PrivateKeyDocument
impl Debug for PrivateKeyDocument
source§impl DecodePrivateKey for PrivateKeyDocument
impl DecodePrivateKey for PrivateKeyDocument
source§fn from_pkcs8_der(bytes: &[u8]) -> Result<Self>
fn from_pkcs8_der(bytes: &[u8]) -> Result<Self>
Deserialize PKCS#8 private key from ASN.1 DER-encoded data
(binary format).
source§fn from_pkcs8_pem(s: &str) -> Result<Self>
fn from_pkcs8_pem(s: &str) -> Result<Self>
Deserialize PKCS#8-encoded private key from PEM. Read more
source§fn read_pkcs8_der_file(path: impl AsRef<Path>) -> Result<Self>
fn read_pkcs8_der_file(path: impl AsRef<Path>) -> Result<Self>
Load PKCS#8 private key from an ASN.1 DER-encoded file on the local
filesystem (binary format).
source§fn read_pkcs8_pem_file(path: impl AsRef<Path>) -> Result<Self>
fn read_pkcs8_pem_file(path: impl AsRef<Path>) -> Result<Self>
Load PKCS#8 private key from a PEM-encoded file on the local filesystem.
source§fn from_pkcs8_doc(doc: &PrivateKeyDocument) -> Result<Self>
fn from_pkcs8_doc(doc: &PrivateKeyDocument) -> Result<Self>
Deserialize PKCS#8 private key from a
PrivateKeyDocument
.source§impl<'a> Document<'a> for PrivateKeyDocument
impl<'a> Document<'a> for PrivateKeyDocument
§type Message = PrivateKeyInfo<'a>
type Message = PrivateKeyInfo<'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 EncodePrivateKey for PrivateKeyDocument
impl EncodePrivateKey for PrivateKeyDocument
source§fn to_pkcs8_der(&self) -> Result<PrivateKeyDocument>
fn to_pkcs8_der(&self) -> Result<PrivateKeyDocument>
Serialize a
PrivateKeyDocument
containing a PKCS#8-encoded private key.source§fn to_pkcs8_pem(&self, line_ending: LineEnding) -> Result<Zeroizing<String>>
fn to_pkcs8_pem(&self, line_ending: LineEnding) -> Result<Zeroizing<String>>
Serialize this private key as PEM-encoded PKCS#8 with the given
LineEnding
.source§fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<()>
fn write_pkcs8_der_file(&self, path: impl AsRef<Path>) -> Result<()>
Write ASN.1 DER-encoded PKCS#8 private key to the given path
source§fn write_pkcs8_pem_file(
&self,
path: impl AsRef<Path>,
line_ending: LineEnding
) -> Result<()>
fn write_pkcs8_pem_file( &self, path: impl AsRef<Path>, line_ending: LineEnding ) -> Result<()>
Write ASN.1 DER-encoded PKCS#8 private key to the given path
source§impl FromStr for PrivateKeyDocument
impl FromStr for PrivateKeyDocument
source§impl PemLabel for PrivateKeyDocument
impl PemLabel for PrivateKeyDocument
source§const TYPE_LABEL: &'static str = "PRIVATE KEY"
const TYPE_LABEL: &'static str = "PRIVATE KEY"
Expected PEM type label for a given document, e.g.
"PRIVATE KEY"
source§impl TryFrom<&[u8]> for PrivateKeyDocument
impl TryFrom<&[u8]> for PrivateKeyDocument
source§impl TryFrom<&PrivateKeyInfo<'_>> for PrivateKeyDocument
impl TryFrom<&PrivateKeyInfo<'_>> for PrivateKeyDocument
source§fn try_from(private_key_info: &PrivateKeyInfo<'_>) -> Result<PrivateKeyDocument>
fn try_from(private_key_info: &PrivateKeyInfo<'_>) -> Result<PrivateKeyDocument>
Performs the conversion.
source§impl TryFrom<PrivateKeyInfo<'_>> for PrivateKeyDocument
impl TryFrom<PrivateKeyInfo<'_>> for PrivateKeyDocument
source§fn try_from(private_key_info: PrivateKeyInfo<'_>) -> Result<PrivateKeyDocument>
fn try_from(private_key_info: PrivateKeyInfo<'_>) -> Result<PrivateKeyDocument>
Performs the conversion.
Auto Trait Implementations§
impl RefUnwindSafe for PrivateKeyDocument
impl Send for PrivateKeyDocument
impl Sync for PrivateKeyDocument
impl Unpin for PrivateKeyDocument
impl UnwindSafe for PrivateKeyDocument
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