[−][src]Struct sequoia_openpgp::cert::CertRevocationBuilder
A Cert
revocation builder.
Note: a Cert revocation has two degrees of freedom: the Cert, and the key used to generate the revocation.
Normally, the key used to generate the revocation is the Cert's primary key. However, this is not required.
If Alice has marked Robert's key (R) as a designated revoker for her key (A), then R can revoke A or parts of A. In this case, the Cert is A, and the key used to generate the revocation comes from R.
Example
use openpgp::RevocationStatus; use openpgp::types::{ReasonForRevocation, SignatureType}; use openpgp::cert::{CipherSuite, CertBuilder, CertRevocationBuilder}; use openpgp::crypto::KeyPair; use openpgp::parse::Parse; let (cert, _) = CertBuilder::new() .set_cipher_suite(CipherSuite::Cv25519) .generate()?; assert_eq!(RevocationStatus::NotAsFarAsWeKnow, cert.revoked(None)); let mut signer = cert.primary().clone() .mark_parts_secret()?.into_keypair()?; let sig = CertRevocationBuilder::new() .set_reason_for_revocation(ReasonForRevocation::KeyCompromised, b"It was the maid :/")? .build(&mut signer, &cert, None)?; assert_eq!(sig.typ(), SignatureType::KeyRevocation); let cert = cert.merge_packets(vec![sig.clone().into()])?; assert_eq!(RevocationStatus::Revoked(vec![&sig]), cert.revoked(None));
Methods
impl CertRevocationBuilder
[src]
pub fn new() -> Self
[src]
Returns a new CertRevocationBuilder
.
pub fn set_reason_for_revocation(
self,
code: ReasonForRevocation,
reason: &[u8]
) -> Result<Self>
[src]
self,
code: ReasonForRevocation,
reason: &[u8]
) -> Result<Self>
Sets the reason for revocation.
pub fn set_signature_creation_time(
self,
creation_time: SystemTime
) -> Result<Self>
[src]
self,
creation_time: SystemTime
) -> Result<Self>
Sets the revocation signature's creation time.
pub fn build<H>(
self,
signer: &mut dyn Signer,
cert: &Cert,
hash_algo: H
) -> Result<Signature> where
H: Into<Option<HashAlgorithm>>,
[src]
self,
signer: &mut dyn Signer,
cert: &Cert,
hash_algo: H
) -> Result<Signature> where
H: Into<Option<HashAlgorithm>>,
Returns a revocation certificate for the cert Cert
signed by
signer
.
Methods from Deref<Target = Builder>
pub fn version(&self) -> u8
[src]
Gets the version.
pub fn typ(&self) -> SignatureType
[src]
Gets the signature type.
pub fn pk_algo(&self) -> PublicKeyAlgorithm
[src]
Gets the public key algorithm.
pub fn hash_algo(&self) -> HashAlgorithm
[src]
Gets the hash algorithm.
Trait Implementations
impl Deref for CertRevocationBuilder
[src]
Auto Trait Implementations
impl RefUnwindSafe for CertRevocationBuilder
impl Send for CertRevocationBuilder
impl Sync for CertRevocationBuilder
impl Unpin for CertRevocationBuilder
impl UnwindSafe for CertRevocationBuilder
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,