pub struct PublicKeyRef<'a> { /* private fields */ }Expand description
A borrowed public key reference. Zero-copy over input data.
Implementations§
Source§impl<'a> PublicKeyRef<'a>
impl<'a> PublicKeyRef<'a>
Sourcepub fn new(algorithm: Algorithm, bytes: &'a [u8]) -> Result<Self>
pub fn new(algorithm: Algorithm, bytes: &'a [u8]) -> Result<Self>
Creates a new PublicKeyRef after validating key size.
Sourcepub fn from_spki(der: &'a [u8]) -> Result<Self>
pub fn from_spki(der: &'a [u8]) -> Result<Self>
Decode an SPKI DER-encoded public key (zero-copy).
Sourcepub fn encode_spki_to(&self, out: &mut Vec<u8>)
pub fn encode_spki_to(&self, out: &mut Vec<u8>)
Encode this public key as SPKI DER into the given buffer.
Sourcepub fn encode_der_to(&self, out: &mut Vec<u8>)
pub fn encode_der_to(&self, out: &mut Vec<u8>)
Encode this public key as DER into the given buffer (alias for encode_spki_to).
Sourcepub fn to_spki(&self) -> Vec<u8> ⓘ
pub fn to_spki(&self) -> Vec<u8> ⓘ
Encode this public key as SPKI DER, returning a new Vec<u8>.
Sourcepub fn to_der(&self) -> Vec<u8> ⓘ
pub fn to_der(&self) -> Vec<u8> ⓘ
Encode this public key as DER, returning a new Vec<u8> (alias for to_spki).
Sourcepub fn encode_pem_to(&self, out: &mut String)
pub fn encode_pem_to(&self, out: &mut String)
Encode this public key as PEM, appending directly to out.
Trait Implementations§
Source§impl<'a> Clone for PublicKeyRef<'a>
impl<'a> Clone for PublicKeyRef<'a>
Source§fn clone(&self) -> PublicKeyRef<'a>
fn clone(&self) -> PublicKeyRef<'a>
Returns a duplicate 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<'a> Debug for PublicKeyRef<'a>
impl<'a> Debug for PublicKeyRef<'a>
Source§impl<'a> From<PublicKeyRef<'a>> for PublicKey
impl<'a> From<PublicKeyRef<'a>> for PublicKey
Source§fn from(key: PublicKeyRef<'a>) -> Self
fn from(key: PublicKeyRef<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> PartialEq for PublicKeyRef<'a>
impl<'a> PartialEq for PublicKeyRef<'a>
impl<'a> Copy for PublicKeyRef<'a>
impl<'a> Eq for PublicKeyRef<'a>
impl<'a> StructuralPartialEq for PublicKeyRef<'a>
Auto Trait Implementations§
impl<'a> Freeze for PublicKeyRef<'a>
impl<'a> RefUnwindSafe for PublicKeyRef<'a>
impl<'a> Send for PublicKeyRef<'a>
impl<'a> Sync for PublicKeyRef<'a>
impl<'a> Unpin for PublicKeyRef<'a>
impl<'a> UnsafeUnpin for PublicKeyRef<'a>
impl<'a> UnwindSafe for PublicKeyRef<'a>
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