pub struct Cert { /* private fields */ }Expand description
The certificate struct. It is either public or secret.
Public certificate means that it does not contain secret keys. Whereas a secret certificate is fully featured - it contains secret keys and public keys.
Each certificate has a user id (Cert::user_id) and a
(hopefully) unique fingerprint (Cert::fingerprint).
§Serialization
Certificates implement serde::Serialize and serde::Deserialize
traits, which allow for serialization and deserialization using any
serde format. Additionally for human readable formats certificates
serialize bytes as hex encoded strings to please the users’ eyes.
§A note on equality
Two certificates are equal if they have the same secrecy and serialized public forms are equal. Usually comparing fingerprints should be enough, but the blake3 hashing algorithm used for fingerprints may not be fully collision proof. Thus adding the public keys into the mix ensures equality.
Implementations§
Source§impl Cert
impl Cert
Sourcepub fn fingerprint(&self) -> &Fingerprint
pub fn fingerprint(&self) -> &Fingerprint
Returns the certificate’s fingerprint.
Sourcepub fn encryption_public(&self) -> &PublicKey
pub fn encryption_public(&self) -> &PublicKey
Returns the encryption public key of this certificate.
Sourcepub fn signing_public(&self) -> &VerifyingKey
pub fn signing_public(&self) -> &VerifyingKey
Returns the signing public key of this certificate.
Sourcepub fn encryption_secret(&self) -> Option<&StaticSecret>
pub fn encryption_secret(&self) -> Option<&StaticSecret>
Returns the encryption secret key of this certificate if Some.
Sourcepub fn signing_secret(&self) -> Option<&SecretKey>
pub fn signing_secret(&self) -> Option<&SecretKey>
Returns the signing secret key of this certificate if Some.
Sourcepub fn strip_secrets(self) -> Self
pub fn strip_secrets(self) -> Self
Consumes self and returns a public version of the certificate.
When used on a public certificate, does nothing.