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
impl EncodePublicKey for PublicKeyBytes
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.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 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
impl FromStr for PublicKeyBytes
Source§impl PartialEq for PublicKeyBytes
impl PartialEq for PublicKeyBytes
Source§impl ToString for PublicKeyBytes
impl ToString for PublicKeyBytes
Source§impl TryFrom<&[u8]> for PublicKeyBytes
impl TryFrom<&[u8]> for PublicKeyBytes
Source§impl TryFrom<&KeypairBytes> for PublicKeyBytes
impl TryFrom<&KeypairBytes> for PublicKeyBytes
Source§impl TryFrom<&PublicKeyBytes> for VerifyingKey
impl TryFrom<&PublicKeyBytes> for VerifyingKey
Source§impl TryFrom<KeypairBytes> for PublicKeyBytes
impl TryFrom<KeypairBytes> for PublicKeyBytes
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 Freeze for PublicKeyBytes
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DecodePublicKey for T
impl<T> DecodePublicKey for T
Source§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).Source§fn from_public_key_pem(s: &str) -> Result<Self, Error>
fn from_public_key_pem(s: &str) -> Result<Self, Error>
Deserialize PEM-encoded [
SubjectPublicKeyInfo
]. Read more