From d80e68ea9c605433d5a3456d5c2c07476a1eaac2 Mon Sep 17 00:00:00 2001 From: Peter Dettman Date: Fri, 29 Apr 2016 19:04:51 +0700 Subject: Added IsCertification methods. --- crypto/src/openpgp/PgpSignature.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) (limited to 'crypto') diff --git a/crypto/src/openpgp/PgpSignature.cs b/crypto/src/openpgp/PgpSignature.cs index 3bb6f2f0e..c8c541bef 100644 --- a/crypto/src/openpgp/PgpSignature.cs +++ b/crypto/src/openpgp/PgpSignature.cs @@ -84,6 +84,12 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp get { return sigPck.HashAlgorithm; } } + /// Return true if this signature represents a certification. + public bool IsCertification() + { + return IsCertification(SignatureType); + } + public void InitVerify( PgpPublicKey pubKey) { @@ -418,5 +424,24 @@ namespace Org.BouncyCastle.Bcpg.OpenPgp throw new PgpException("exception preparing key.", e); } } + + /// + /// Return true if the passed in signature type represents a certification, false if the signature type is not. + /// + /// + /// true if signatureType is a certification, false otherwise. + public static bool IsCertification(int signatureType) + { + switch (signatureType) + { + case DefaultCertification: + case NoCertification: + case CasualCertification: + case PositiveCertification: + return true; + default: + return false; + } + } } } -- cgit 1.4.1