当前位置: 首页>>代码示例>>C#>>正文


C# PgpPublicKey.GetSignatures方法代码示例

本文整理汇总了C#中Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKey.GetSignatures方法的典型用法代码示例。如果您正苦于以下问题:C# PgpPublicKey.GetSignatures方法的具体用法?C# PgpPublicKey.GetSignatures怎么用?C# PgpPublicKey.GetSignatures使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKey的用法示例。


在下文中一共展示了PgpPublicKey.GetSignatures方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: IsSigningKey

		/// <summary>
		/// Is key allowed for signing?
		/// </summary>
		/// <remarks>
		/// Checks both key algorithm and also key flags.
		/// </remarks>
		/// <param name="key"></param>
		/// <param name="strict"></param>
		/// <returns></returns>
		public bool IsSigningKey(PgpPublicKey key)
		{
			foreach (PgpSignature sig in key.GetSignatures())
			{
				var hashedSubPackets = sig.GetHashedSubPackets();
				if (hashedSubPackets == null)
					continue;

			    if (!hashedSubPackets.HasSubpacket(SignatureSubpacketTag.KeyFlags))
			        continue;

				var keyFlags = hashedSubPackets.GetKeyFlags();
				if ((keyFlags & KeyFlags.SignData) > 0)
					return true;

				return false;
			}

			// Only use alg if keyflags is missing
			if (IsSigningAlg(key))
				return true;

			return false;
		}
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:33,代码来源:PgpCrypto.cs

示例2: IsEncryptionKey

		/// <summary>
		/// Is key allowed for encryption?
		/// </summary>
		/// <remarks>
		/// Checks both key algorithm and also key flags.
		/// </remarks>
		/// <param name="key"></param>
		/// <returns></returns>
		public bool IsEncryptionKey(PgpPublicKey key)
		{
			// First check key use flags
			foreach (PgpSignature sig in key.GetSignatures())
			{
				var hashedSubPackets = sig.GetHashedSubPackets();
				if (hashedSubPackets == null)
					continue;

                if (!hashedSubPackets.HasSubpacket(SignatureSubpacketTag.KeyFlags))
                    continue;

				var keyFlags = hashedSubPackets.GetKeyFlags();

				if ((keyFlags & KeyFlags.EncryptComms) > 0)
					return true;

				if ((keyFlags & KeyFlags.EncryptStorage) > 0)
					return true;

				return false;
			}

			// NOTE: Some keys do not have flags set. Instead use
			//       the alg type. But only those specific to encryption.

			if (IsEncryptionAlg(key))
				return true;

			return false;
		}
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:39,代码来源:PgpCrypto.cs

示例3: IsSigningKey

		/// <summary>
		/// Is key allowed for signing?
		/// </summary>
		/// <remarks>
		/// Checks both key algorithm and also key flags.
		/// </remarks>
		/// <param name="key"></param>
		/// <returns></returns>
		public bool IsSigningKey(PgpPublicKey key)
		{
			foreach (PgpSignature sig in key.GetSignatures())
			{
				var hashedSubPackets = sig.GetHashedSubPackets();
				if (hashedSubPackets == null)
					continue;

				var keyFlags = hashedSubPackets.GetKeyFlags();

				if ((keyFlags & KeyFlags.SignData) > 0)
					return true;
			}

			if (IsSigningAlg(key))
				return true;

			return false;
		}
开发者ID:korusdipl,项目名称:OutlookPrivacyPlugin,代码行数:27,代码来源:PgpCrypto.cs


注:本文中的Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKey.GetSignatures方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。