summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto/s2k.rs
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-08-12 16:10:30 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-08-20 12:17:21 +0200
commit95df35ef7a29f92aba2769e11026b998ad8590bf (patch)
tree41ac6860a1578505cc8fba2883dc02d209ed5c73 /openpgp/src/crypto/s2k.rs
parent05df451257320bf8dfd86f7fdd4d63f9c78dd691 (diff)
openpgp: New function S2K::is_supported.
Diffstat (limited to 'openpgp/src/crypto/s2k.rs')
-rw-r--r--openpgp/src/crypto/s2k.rs11
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs
index 62e8c9a3..2e1fe08b 100644
--- a/openpgp/src/crypto/s2k.rs
+++ b/openpgp/src/crypto/s2k.rs
@@ -213,6 +213,17 @@ impl S2K {
}
}
+ /// Returns whether this S2K mechanism is supported.
+ pub fn is_supported(&self) -> bool {
+ use self::S2K::*;
+ #[allow(deprecated)]
+ match self {
+ Simple { .. } | Salted { .. } | Iterated { .. } => true,
+ __Nonexhaustive => unreachable!(),
+ _ => false,
+ }
+ }
+
/// This function returns an encodable iteration count.
///
/// Not all iteration counts are encodable as *Iterated and Salted