pub struct PublicKey(/* private fields */);
Available on crate feature
rsa
and non-WebAssembly only.Expand description
An RSA public key.
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
pub fn verify(&self, msg: &[u8], sig: &[u8]) -> bool
Verify an RSA signature on a message using the public key.
Sourcepub fn encode_pkcs1(&self) -> Vec<u8>
pub fn encode_pkcs1(&self) -> Vec<u8>
Encode the RSA public key in DER as a PKCS#1 RSAPublicKey structure, as defined in RFC3447.
Sourcepub fn encode_x509(&self) -> Vec<u8>
pub fn encode_x509(&self) -> Vec<u8>
Encode the RSA public key in DER as a X.509 SubjectPublicKeyInfo structure, as defined in RFC5280.
Sourcepub fn try_decode_x509(pk: &[u8]) -> Result<PublicKey, DecodingError>
pub fn try_decode_x509(pk: &[u8]) -> Result<PublicKey, DecodingError>
Decode an RSA public key from a DER-encoded X.509 SubjectPublicKeyInfo
structure. See also encode_x509
.
Trait Implementations§
Source§impl Ord for PublicKey
impl Ord for PublicKey
Source§impl PartialOrd for PublicKey
impl PartialOrd for PublicKey
impl Eq for PublicKey
impl StructuralPartialEq for PublicKey
Auto Trait Implementations§
impl Freeze for PublicKey
impl RefUnwindSafe for PublicKey
impl Send for PublicKey
impl Sync for PublicKey
impl Unpin for PublicKey
impl UnwindSafe for PublicKey
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