| 1 |
//! Miscellaneous utilities. |
| 2 |
|
| 3 |
use sequoia_openpgp::{ |
| 4 |
Cert, |
| 5 |
}; |
| 6 |
|
| 7 |
/// Checks if a cert is exportable *and* has an exportable user ID. |
| 8 |
/// |
| 9 |
/// Note: Versions of sequoia-openpgp earlier than 1.19 didn't have a |
| 10 |
/// nice way to create non-exportable direct key signatures using the |
| 11 |
/// CertBuilder. Therefore, we used to create shadow CAs with |
| 12 |
/// exportable direct key signatures. Hence, we also check that the |
| 13 |
/// certificates have at least one exportable user ID. |
| 14 |
pub fn cert_exportable(c: &Cert) -> bool { |
| 15 |
c.exportable() |
| 16 |
&& c.userids().any(|uid| uid.self_signatures().any( |
| 17 |
|s| s.exportable().is_ok())) |
| 18 |
} |