pub struct PublicKey(/* private fields */);
Implementations§
Source§impl PublicKey
impl PublicKey
Sourcepub fn new(
packet_version: Version,
version: KeyVersion,
algorithm: PublicKeyAlgorithm,
created_at: DateTime<Utc>,
expiration: Option<u16>,
public_params: PublicParams,
) -> Result<Self>
pub fn new( packet_version: Version, version: KeyVersion, algorithm: PublicKeyAlgorithm, created_at: DateTime<Utc>, expiration: Option<u16>, public_params: PublicParams, ) -> Result<Self>
Create a new PublicKey
packet from underlying parameters.
Sourcepub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
pub fn from_slice(packet_version: Version, input: &[u8]) -> Result<Self>
Parses a PublicKeyKey
packet from the given slice.
pub fn sign<R: CryptoRng + Rng, F>( &self, rng: R, key: &impl SecretKeyTrait, key_pw: F, ) -> Result<Signature>
Trait Implementations§
Source§impl PacketTrait for PublicKey
impl PacketTrait for PublicKey
Source§impl PublicKeyTrait for PublicKey
impl PublicKeyTrait for PublicKey
Source§fn verify_signature(
&self,
hash: HashAlgorithm,
hashed: &[u8],
sig: &SignatureBytes,
) -> Result<()>
fn verify_signature( &self, hash: HashAlgorithm, hashed: &[u8], sig: &SignatureBytes, ) -> Result<()>
Verify a signed message.
Data will be hashed using
hash
, before verifying.Source§fn encrypt<R: CryptoRng + Rng>(
&self,
rng: R,
plain: &[u8],
typ: EskType,
) -> Result<PkeskBytes>
fn encrypt<R: CryptoRng + Rng>( &self, rng: R, plain: &[u8], typ: EskType, ) -> Result<PkeskBytes>
Encrypt the given
plain
for this key.Source§fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>
fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>
This is the data used for hashing in a signature. Only uses the public portion of the key.
fn public_params(&self) -> &PublicParams
fn version(&self) -> KeyVersion
fn fingerprint(&self) -> Fingerprint
fn algorithm(&self) -> PublicKeyAlgorithm
fn created_at(&self) -> &DateTime<Utc>
fn expiration(&self) -> Option<u16>
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
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