diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2020-08-12 16:10:30 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2020-08-12 16:10:30 +0200 |
commit | 7b479e811a42cc3537e5934fa9f43690b44c7232 (patch) | |
tree | f52b45306f4b9fd30fbb7ec5a9a953c25544d62f | |
parent | 33d23cd76a6342faf2b809c665a91772112d43b3 (diff) |
openpgp: New function S2K::is_supported.
-rw-r--r-- | openpgp/src/crypto/s2k.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/openpgp/src/crypto/s2k.rs b/openpgp/src/crypto/s2k.rs index 1210aa8b..b58da5d3 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 |