//! OpenPGP Certificates.
//!
//! Wraps [`sequoia-openpgp::Cert`] and [related functionality].
//!
//! [`sequoia-openpgp::Cert`]: ../../../sequoia_openpgp/cert/struct.Cert.html
//! [related functionality]: ../../../sequoia_openpgp/cert/index.html
use std::convert::TryFrom;
use std::ptr;
use std::slice;
use libc::{c_char, c_int, size_t, time_t};
use sequoia_openpgp as openpgp;
use self::openpgp::{
crypto,
crypto::Password,
types::ReasonForRevocation,
parse::{
PacketParserResult,
Parse,
},
cert::prelude::*,
};
use crate::error::Status;
use super::fingerprint::Fingerprint;
use super::packet::key::Key;
use super::packet::Packet;
use super::packet::signature::Signature;
use super::packet_pile::PacketPile;
use super::tsk::TSK;
use super::revocation_status::RevocationStatus;
use super::policy::Policy;
use super::amalgamation::{UserIDAmalgamation, ValidUserIDAmalgamation};
use super::key_amalgamation::{KeyAmalgamation, ValidKeyAmalgamation};
use crate::Maybe;
use crate::RefRaw;
use crate::MoveFromRaw;
use crate::MoveIntoRaw;
use crate::MoveResultIntoRaw;
use crate::maybe_time;
/// An OpenPGP Certificate.
///
/// A Certificate (see [RFC 4880, section 11.1]) can be used to verify
/// signatures and encrypt data. It can be stored in a keystore and
/// uploaded to keyservers.
///
/// Certs are always canonicalized in the sense that only elements
/// (user id, user attribute, subkey) with at least one valid
/// self-signature are preserved. Also, invalid self-signatures are
/// dropped. The self-signatures are sorted so that the newest
/// self-signature comes first. User IDs are sorted so that the first
/// `UserID` is the primary User ID. Third-party certifications are
/// *not* validated, as the keys are not available; they are simply
/// passed through as is.
///
/// [RFC 4880, section 11.1]: https://tools.ietf.org/html/rfc4880#section-11.1
#[crate::ffi_wrapper_type(
prefix = "pgp_", name = "cert",
derive = "Clone, Debug, Display, PartialEq, Parse, Serialize")]
pub struct Cert(openpgp::Cert);
/// Returns the first Cert found in `m`.
///
/// Consumes `m`.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
fn pgp_cert_from_packet_pile(errp: Option<&mut *mut crate::error::Error>,
m: *mut PacketPile)
-> Maybe