Type Alias sequoia_openpgp::cert::amalgamation::key::ValidPrimaryKeyAmalgamation
source · pub type ValidPrimaryKeyAmalgamation<'a, P> = ValidKeyAmalgamation<'a, P, PrimaryRole, ()>;
Expand description
A Valid primary Key, and its associated data.
A specialized version of ValidKeyAmalgamation
.
Aliased Type§
struct ValidPrimaryKeyAmalgamation<'a, P> { /* private fields */ }
Implementations§
source§impl<'a, P> ValidPrimaryKeyAmalgamation<'a, P>where
P: KeyParts,
impl<'a, P> ValidPrimaryKeyAmalgamation<'a, P>where
P: KeyParts,
sourcepub fn parts_into_public(self) -> ValidPrimaryKeyAmalgamation<'a, PublicParts>
pub fn parts_into_public(self) -> ValidPrimaryKeyAmalgamation<'a, PublicParts>
Changes the key’s parts tag to PublicParts
.
sourcepub fn parts_as_public(
&'a self,
) -> &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
pub fn parts_as_public( &'a self, ) -> &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
Changes the key’s parts tag to PublicParts
.
sourcepub fn parts_as_public_mut(
&'a mut self,
) -> &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
pub fn parts_as_public_mut( &'a mut self, ) -> &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
Changes the key’s parts tag to PublicParts
.
sourcepub fn parts_into_secret(
self,
) -> Result<ValidPrimaryKeyAmalgamation<'a, SecretParts>>
pub fn parts_into_secret( self, ) -> Result<ValidPrimaryKeyAmalgamation<'a, SecretParts>>
Changes the key’s parts tag to SecretParts
.
sourcepub fn parts_as_secret(
&'a self,
) -> Result<&'a ValidPrimaryKeyAmalgamation<'a, SecretParts>>
pub fn parts_as_secret( &'a self, ) -> Result<&'a ValidPrimaryKeyAmalgamation<'a, SecretParts>>
Changes the key’s parts tag to SecretParts
.
sourcepub fn parts_as_secret_mut(
&'a mut self,
) -> Result<&'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>>
pub fn parts_as_secret_mut( &'a mut self, ) -> Result<&'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>>
Changes the key’s parts tag to SecretParts
.
sourcepub fn parts_into_unspecified(
self,
) -> ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
pub fn parts_into_unspecified( self, ) -> ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
Changes the key’s parts tag to UnspecifiedParts
.
sourcepub fn parts_as_unspecified(
&'a self,
) -> &ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
pub fn parts_as_unspecified( &'a self, ) -> &ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
Changes the key’s parts tag to UnspecifiedParts
.
sourcepub fn parts_as_unspecified_mut(
&'a mut self,
) -> &mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
pub fn parts_as_unspecified_mut( &'a mut self, ) -> &mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
Changes the key’s parts tag to UnspecifiedParts
.
source§impl<'a, P> ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
impl<'a, P> ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
sourcepub fn set_expiration_time(
&self,
primary_signer: &mut dyn Signer,
expiration: Option<SystemTime>,
) -> Result<Vec<Signature>>
pub fn set_expiration_time( &self, primary_signer: &mut dyn Signer, expiration: Option<SystemTime>, ) -> Result<Vec<Signature>>
Creates signatures that cause the key to expire at the specified time.
This function creates new binding signatures that cause the key to expire at the specified time when integrated into the certificate. For the primary key, it is necessary to create a new self-signature for each non-revoked User ID, and to create a direct key signature. This is needed, because the primary User ID is first consulted when determining the primary key’s expiration time, and certificates can be distributed with a possibly empty subset of User IDs.
Setting a key’s expiry time means updating an existing binding
signature—when looking up information, only one binding
signature is normally considered, and we don’t want to drop
the other information stored in the current binding signature.
This function uses the binding signature determined by
ValidKeyAmalgamation
’s policy and reference time for this.
§Examples
use std::time;
use openpgp::policy::StandardPolicy;
let p = &StandardPolicy::new();
let vc = cert.with_policy(p, None)?;
// Assert that the primary key is not expired.
assert!(vc.primary_key().alive().is_ok());
// Make the primary key expire in a week.
let t = time::SystemTime::now()
+ time::Duration::from_secs(7 * 24 * 60 * 60);
// We assume that the secret key material is available, and not
// password protected.
let mut signer = vc.primary_key()
.key().clone().parts_into_secret()?.into_keypair()?;
let sigs = vc.primary_key().set_expiration_time(&mut signer, Some(t))?;
let cert = cert.insert_packets(sigs)?;
// The primary key isn't expired yet.
let vc = cert.with_policy(p, None)?;
assert!(vc.primary_key().alive().is_ok());
// But in two weeks, it will be...
let t = time::SystemTime::now()
+ time::Duration::from_secs(2 * 7 * 24 * 60 * 60);
let vc = cert.with_policy(p, t)?;
assert!(vc.primary_key().alive().is_err());
Trait Implementations§
source§impl<'a> From<&'a ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<&'a ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
source§impl<'a> From<&'a ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<&'a ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<&'a ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<&'a ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<&'a ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<&'a ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
fn from(p: &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
source§impl<'a> From<&'a mut ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<&'a mut ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
source§impl<'a> From<&'a mut ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<&'a mut ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<&'a mut ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<&'a mut ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<&'a mut ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<&'a mut ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
fn from(p: &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
source§impl<'a> From<ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
fn from(p: ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Self
source§impl<'a> From<ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
impl<'a> From<ValidKeyAmalgamation<'a, SecretParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>
source§fn from(p: ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
fn from(p: ValidPrimaryKeyAmalgamation<'a, SecretParts>) -> Self
source§impl<'a> From<ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, PublicParts>
impl<'a> From<ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, PublicParts>
source§fn from(p: ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
fn from(p: ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>) -> Self
source§impl<'a, P> PrimaryKey<'a, P, PrimaryRole> for ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
impl<'a, P> PrimaryKey<'a, P, PrimaryRole> for ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
source§impl<'a> TryFrom<&'a ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<&'a ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(p: &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Result<Self>
fn try_from(p: &'a ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Result<Self>
source§impl<'a> TryFrom<&'a ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<&'a ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(
p: &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>,
) -> Result<Self>
fn try_from( p: &'a ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>, ) -> Result<Self>
source§impl<'a> TryFrom<&'a mut ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<&'a mut ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(
p: &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>,
) -> Result<Self>
fn try_from( p: &'a mut ValidPrimaryKeyAmalgamation<'a, PublicParts>, ) -> Result<Self>
source§impl<'a> TryFrom<&'a mut ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<&'a mut ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for &'a mut ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(
p: &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>,
) -> Result<Self>
fn try_from( p: &'a mut ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>, ) -> Result<Self>
source§impl<'a, P, P2> TryFrom<ValidKeyAmalgamation<'a, P, UnspecifiedRole, bool>> for ValidPrimaryKeyAmalgamation<'a, P2>
impl<'a, P, P2> TryFrom<ValidKeyAmalgamation<'a, P, UnspecifiedRole, bool>> for ValidPrimaryKeyAmalgamation<'a, P2>
source§impl<'a> TryFrom<ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<ValidKeyAmalgamation<'a, PublicParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(p: ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Result<Self>
fn try_from(p: ValidPrimaryKeyAmalgamation<'a, PublicParts>) -> Result<Self>
source§impl<'a> TryFrom<ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, SecretParts>
impl<'a> TryFrom<ValidKeyAmalgamation<'a, UnspecifiedParts, PrimaryRole, ()>> for ValidPrimaryKeyAmalgamation<'a, SecretParts>
source§fn try_from(
p: ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>,
) -> Result<Self>
fn try_from( p: ValidPrimaryKeyAmalgamation<'a, UnspecifiedParts>, ) -> Result<Self>
source§impl<'a, P> ValidateAmalgamation<'a, Key<P, PrimaryRole>> for ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
impl<'a, P> ValidateAmalgamation<'a, Key<P, PrimaryRole>> for ValidPrimaryKeyAmalgamation<'a, P>where
P: 'a + KeyParts,
§type V = ValidKeyAmalgamation<'a, P, PrimaryRole, ()>
type V = ValidKeyAmalgamation<'a, P, PrimaryRole, ()>
with_policy
. Read more