Struct ed25519_dalek::pkcs8::PublicKeyBytes
source · pub struct PublicKeyBytes(pub [u8; 32]);
Available on crate feature
pkcs8
only.Expand description
Ed25519 public key serialized as bytes.
This type is primarily useful for decoding/encoding SPKI public key files (either DER or PEM) encoded using the following traits:
DecodePublicKey
: decode DER or PEM encoded PKCS#8 private key.EncodePublicKey
: encode DER or PEM encoded PKCS#8 private key.
SPKI public key files encoded with PEM begin with:
-----BEGIN PUBLIC KEY-----
Note that this type operates on raw bytes and performs no validation that public keys represent valid compressed Ed25519 y-coordinates.
Tuple Fields§
§0: [u8; 32]
Implementations§
Trait Implementations§
source§impl Clone for PublicKeyBytes
impl Clone for PublicKeyBytes
source§fn clone(&self) -> PublicKeyBytes
fn clone(&self) -> PublicKeyBytes
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 PublicKeyBytes
impl Debug for PublicKeyBytes
source§impl EncodePublicKey for PublicKeyBytes
Available on crate feature alloc
only.
impl EncodePublicKey for PublicKeyBytes
Available on crate feature
alloc
only.source§fn to_public_key_der(&self) -> Result<Document, Error>
fn to_public_key_der(&self) -> Result<Document, Error>
Serialize a
Document
containing a SPKI-encoded public key.§fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
fn to_public_key_pem(&self, line_ending: LineEnding) -> Result<String, Error>
Available on crate feature
pem
only.Serialize this public key as PEM-encoded SPKI with the given
LineEnding
.§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>
Available on crate feature
std
only.Write ASN.1 DER-encoded public key to the given path
§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>
Available on crate features
pem
and std
only.Write ASN.1 DER-encoded public key to the given path
source§impl From<&VerifyingKey> for PublicKeyBytes
impl From<&VerifyingKey> for PublicKeyBytes
source§fn from(verifying_key: &VerifyingKey) -> PublicKeyBytes
fn from(verifying_key: &VerifyingKey) -> PublicKeyBytes
Converts to this type from the input type.
source§impl From<VerifyingKey> for PublicKeyBytes
impl From<VerifyingKey> for PublicKeyBytes
source§fn from(verifying_key: VerifyingKey) -> PublicKeyBytes
fn from(verifying_key: VerifyingKey) -> PublicKeyBytes
Converts to this type from the input type.
source§impl FromStr for PublicKeyBytes
Available on crate feature pem
only.
impl FromStr for PublicKeyBytes
Available on crate feature
pem
only.source§impl PartialEq for PublicKeyBytes
impl PartialEq for PublicKeyBytes
source§fn eq(&self, other: &PublicKeyBytes) -> bool
fn eq(&self, other: &PublicKeyBytes) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl ToString for PublicKeyBytes
Available on crate feature pem
only.
impl ToString for PublicKeyBytes
Available on crate feature
pem
only.source§impl TryFrom<&[u8]> for PublicKeyBytes
impl TryFrom<&[u8]> for PublicKeyBytes
source§impl TryFrom<&KeypairBytes> for PublicKeyBytes
impl TryFrom<&KeypairBytes> for PublicKeyBytes
source§fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes, Error>
fn try_from(keypair: &KeypairBytes) -> Result<PublicKeyBytes, Error>
Performs the conversion.
source§impl TryFrom<&PublicKeyBytes> for VerifyingKey
impl TryFrom<&PublicKeyBytes> for VerifyingKey
source§impl TryFrom<KeypairBytes> for PublicKeyBytes
impl TryFrom<KeypairBytes> for PublicKeyBytes
source§fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes, Error>
fn try_from(keypair: KeypairBytes) -> Result<PublicKeyBytes, Error>
Performs the conversion.
source§impl TryFrom<PublicKeyBytes> for VerifyingKey
impl TryFrom<PublicKeyBytes> for VerifyingKey
source§impl TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for PublicKeyBytes
impl TryFrom<SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>> for PublicKeyBytes
source§fn try_from(
spki: SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>>
) -> Result<PublicKeyBytes, Error>
fn try_from( spki: SubjectPublicKeyInfo<AnyRef<'_>, BitStringRef<'_>> ) -> Result<PublicKeyBytes, Error>
Performs the conversion.
impl Copy for PublicKeyBytes
impl Eq for PublicKeyBytes
impl StructuralPartialEq for PublicKeyBytes
Auto Trait Implementations§
impl RefUnwindSafe for PublicKeyBytes
impl Send for PublicKeyBytes
impl Sync for PublicKeyBytes
impl Unpin for PublicKeyBytes
impl UnwindSafe for PublicKeyBytes
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
§impl<T> DecodePublicKey for T
impl<T> DecodePublicKey for T
§fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>
fn from_public_key_der(bytes: &[u8]) -> Result<T, Error>
Deserialize object from ASN.1 DER-encoded [
SubjectPublicKeyInfo
]
(binary format).§fn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
Available on crate feature
pem
only.Deserialize PEM-encoded [
SubjectPublicKeyInfo
]. Read more