pub trait PublicKeyTrait: Debug {
// Required methods
fn version(&self) -> KeyVersion;
fn fingerprint(&self) -> Fingerprint;
fn key_id(&self) -> KeyId;
fn algorithm(&self) -> PublicKeyAlgorithm;
fn created_at(&self) -> &DateTime<Utc>;
fn expiration(&self) -> Option<u16>;
fn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &SignatureBytes,
) -> Result<()>;
fn encrypt<R: CryptoRng + Rng>(
&self,
rng: R,
plain: &[u8],
typ: EskType,
) -> Result<PkeskBytes>;
fn serialize_for_hashing(&self, writer: &mut impl Write) -> Result<()>;
fn public_params(&self) -> &PublicParams;
// Provided methods
fn is_signing_key(&self) -> bool { ... }
fn is_encryption_key(&self) -> bool { ... }
}
Required Methods§
fn version(&self) -> KeyVersion
fn fingerprint(&self) -> Fingerprint
fn algorithm(&self) -> PublicKeyAlgorithm
fn created_at(&self) -> &DateTime<Utc>
fn expiration(&self) -> Option<u16>
Sourcefn verify_signature(
&self,
hash: HashAlgorithm,
data: &[u8],
sig: &SignatureBytes,
) -> Result<()>
fn verify_signature( &self, hash: HashAlgorithm, data: &[u8], sig: &SignatureBytes, ) -> Result<()>
Verify a signed message.
Data will be hashed using hash
, before verifying.
Sourcefn 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.
Sourcefn 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
Provided Methods§
fn is_signing_key(&self) -> bool
fn is_encryption_key(&self) -> bool
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.