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


C# DSA.ExportParameters方法代码示例

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


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

示例1: make_pubkey

        /// <summary>
        ///     Create a public key block from a private key.
        /// </summary>
        /// <param name="privateKey">The <see cref="DSA" /> PrivateKey.</param>
        /// <returns>The <see cref="DSACryptoServiceProvider" /> PublicKey.</returns>
        public static DSACryptoServiceProvider make_pubkey(DSA privateKey)
        {
            var publicKey = new DSACryptoServiceProvider(1024);
            publicKey.ImportParameters(privateKey.ExportParameters(false));

            if (!publicKey.PublicOnly)
            {
                publicKey.Dispose();
                throw new Exception("PublicKey contains PrivateKey information, cancelling.");
            }

            return publicKey;
        }
开发者ID:eXcomm,项目名称:otr-1,代码行数:18,代码来源:BasePrivateKey.cs

示例2: Encode

			static public byte[] Encode (DSA dsa) 
			{
				DSAParameters param = dsa.ExportParameters (true);
				return ASN1Convert.FromUnsignedBigInteger (param.X).GetBytes ();
			}
开发者ID:calumjiao,项目名称:Mono-Class-Libraries,代码行数:5,代码来源:PKCS8.cs

示例3: ToCapiPublicKeyBlob

		static public byte[] ToCapiPublicKeyBlob (DSA dsa)
		{
			DSAParameters p = dsa.ExportParameters (false);
			int keyLength = p.P.Length; // in bytes

			// header + P + Q + G + Y + count + seed
			byte[] blob = new byte [16 + keyLength + 20 + keyLength + keyLength + 4 + 20];

			blob [0] = 0x06;	// Type - PUBLICKEYBLOB (0x06)
			blob [1] = 0x02;	// Version - Always CUR_BLOB_VERSION (0x02)
			// [2], [3]		// RESERVED - Always 0
			blob [5] = 0x22;	// ALGID
			blob [8] = 0x44;	// Magic
			blob [9] = 0x53;
			blob [10] = 0x53;
			blob [11] = 0x31;

			byte[] bitlen = GetBytesLE (keyLength << 3);
			blob [12] = bitlen [0];
			blob [13] = bitlen [1];
			blob [14] = bitlen [2];
			blob [15] = bitlen [3];

			int pos = 16;
			byte[] part;

			part = p.P;
			Array.Reverse (part);
			Buffer.BlockCopy (part, 0, blob, pos, keyLength);
			pos += keyLength;

			part = p.Q;
			Array.Reverse (part);
			Buffer.BlockCopy (part, 0, blob, pos, 20);
			pos += 20;

			part = p.G;
			Array.Reverse (part);
			Buffer.BlockCopy (part, 0, blob, pos, keyLength);
			pos += keyLength;

			part = p.Y;
			Array.Reverse (part);
			Buffer.BlockCopy (part, 0, blob, pos, keyLength);
			pos += keyLength;

			Buffer.BlockCopy (GetBytesLE (p.Counter), 0, blob, pos, 4);
			pos += 4;

			part = p.Seed;
			Array.Reverse (part);
			Buffer.BlockCopy (part, 0, blob, pos, 20);

			return blob;
		}
开发者ID:Jakosa,项目名称:MonoLibraries,代码行数:55,代码来源:CryptoConvert.cs

示例4: GetDsaPublicKey

		public static DsaPublicKeyParameters GetDsaPublicKey(
			DSA dsa)
		{
			return GetDsaPublicKey(dsa.ExportParameters(false));
		}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:5,代码来源:DotNetUtilities.cs

示例5: GetDsaKeyPair

		public static AsymmetricCipherKeyPair GetDsaKeyPair(
			DSA dsa)
		{
			return GetDsaKeyPair(dsa.ExportParameters(true));
		}
开发者ID:Niladri24dutta,项目名称:itextsharp,代码行数:5,代码来源:DotNetUtilities.cs


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