openpgp: New function Signature4::exportable.

parent 9c25d27e
......@@ -515,6 +515,22 @@ impl Signature4 {
pub(crate) fn set_level(&mut self, level: usize) -> usize {
::std::mem::replace(&mut self.level, level)
}
/// Tests whether or not this signature is exportable.
pub fn exportable(&self) -> Result<()> {
if ! self.exportable_certification().unwrap_or(true) {
return Err(Error::InvalidOperation(
"Cannot export non-exportable certification".into()).into());
}
if self.revocation_keys().any(|r| r.sensitive()) {
return Err(Error::InvalidOperation(
"Cannot export signature with sensitive designated revoker"
.into()).into());
}
Ok(())
}
}
impl crate::packet::Signature {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment