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


C# AsymmetricKeyParameter类代码示例

本文整理汇总了C#中AsymmetricKeyParameter的典型用法代码示例。如果您正苦于以下问题:C# AsymmetricKeyParameter类的具体用法?C# AsymmetricKeyParameter怎么用?C# AsymmetricKeyParameter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: DefaultTlsAgreementCredentials

        public DefaultTlsAgreementCredentials(Certificate certificate, AsymmetricKeyParameter privateKey)
        {
            if (certificate == null)
                throw new ArgumentNullException("certificate");
            if (certificate.IsEmpty)
                throw new ArgumentException("cannot be empty", "certificate");
            if (privateKey == null)
                throw new ArgumentNullException("privateKey");
            if (!privateKey.IsPrivate)
                throw new ArgumentException("must be private", "privateKey");

            if (privateKey is DHPrivateKeyParameters)
            {
                mBasicAgreement = new DHBasicAgreement();
                mTruncateAgreement = true;
            }
            else if (privateKey is ECPrivateKeyParameters)
            {
                mBasicAgreement = new ECDHBasicAgreement();
                mTruncateAgreement = false;
            }
            else
            {
                throw new ArgumentException("type not supported: " + privateKey.GetType().FullName, "privateKey");
            }

            this.mCertificate = certificate;
            this.mPrivateKey = privateKey;
        }
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:29,代码来源:DefaultTlsAgreementCredentials.cs

示例2: CalculateRawSignature

		public virtual byte[] CalculateRawSignature(SecureRandom random,
			AsymmetricKeyParameter privateKey, byte[] md5andsha1)
		{
			ISigner s = MakeSigner(new NullDigest(), true, new ParametersWithRandom(privateKey, random));
			s.BlockUpdate(md5andsha1, 0, md5andsha1.Length);
			return s.GenerateSignature();
		}
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:7,代码来源:TlsRsaSigner.cs

示例3: VerifyRawSignature

		public virtual bool VerifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey,
			byte[] md5andsha1)
		{
			ISigner s = MakeSigner(new NullDigest(), false, publicKey);
			s.BlockUpdate(md5andsha1, 0, md5andsha1.Length);
			return s.VerifySignature(sigBytes);
		}
开发者ID:Xanagandr,项目名称:DisaOpenSource,代码行数:7,代码来源:TlsRsaSigner.cs

示例4: VerifyRawSignature

		public bool VerifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5andsha1)
		{
			ISigner s = MakeSigner(new NullDigest(), false, publicKey);
			// Note: Only use the SHA1 part of the hash
			s.BlockUpdate(md5andsha1, 16, 20);
			return s.VerifySignature(sigBytes);
		}
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:7,代码来源:TlsDsaSigner.cs

示例5: VerifyRawSignature

 public override bool VerifyRawSignature(SignatureAndHashAlgorithm algorithm, byte[] sigBytes,
     AsymmetricKeyParameter publicKey, byte[] hash)
 {
     ISigner signer = MakeSigner(algorithm, true, false, publicKey);
     signer.BlockUpdate(hash, 0, hash.Length);
     return signer.VerifySignature(sigBytes);
 }
开发者ID:JohnMalmsteen,项目名称:mobile-apps-tower-defense,代码行数:7,代码来源:TlsRsaSigner.cs

示例6: GenerateRawSignature

 public virtual byte[] GenerateRawSignature(SecureRandom random,
     AsymmetricKeyParameter privateKey, byte[] md5AndSha1)
 {
     IAsymmetricBlockCipher engine = CreateRsaImpl();
     engine.Init(true, new ParametersWithRandom(privateKey, random));
     return engine.ProcessBlock(md5AndSha1, 0, md5AndSha1.Length);
 }
开发者ID:htlp,项目名称:itextsharp,代码行数:7,代码来源:TlsRsaSigner.cs

示例7: VerifyRawSignature

 public virtual bool VerifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey,
     byte[] md5AndSha1)
 {
     IAsymmetricBlockCipher engine = CreateRsaImpl();
     engine.Init(false, publicKey);
     byte[] signed = engine.ProcessBlock(sigBytes, 0, sigBytes.Length);
     return Arrays.ConstantTimeAreEqual(signed, md5AndSha1);
 }
开发者ID:htlp,项目名称:itextsharp,代码行数:8,代码来源:TlsRsaSigner.cs

示例8: CalculateRawSignature

 public virtual byte[] CalculateRawSignature(SecureRandom random,
     AsymmetricKeyParameter privateKey, byte[] md5andsha1)
 {
     ISigner sig = new GenericSigner(new Pkcs1Encoding(new RsaBlindedEngine()), new NullDigest());
     sig.Init(true, new ParametersWithRandom(privateKey, random));
     sig.BlockUpdate(md5andsha1, 0, md5andsha1.Length);
     return sig.GenerateSignature();
 }
开发者ID:karino2,项目名称:wikipediaconv,代码行数:8,代码来源:TlsRsaSigner.cs

示例9: CalculateRawSignature

		public virtual byte[] CalculateRawSignature(SecureRandom random,
			AsymmetricKeyParameter privateKey, byte[] md5andsha1)
		{
			ISigner s = MakeSigner(new NullDigest(), true, new ParametersWithRandom(privateKey, random));
			// Note: Only use the SHA1 part of the hash
			s.BlockUpdate(md5andsha1, 16, 20);
			return s.GenerateSignature();
		}
开发者ID:ktw,项目名称:OutlookPrivacyPlugin,代码行数:8,代码来源:TlsDsaSigner.cs

示例10: GenerateRawSignature

 public override byte[] GenerateRawSignature(SignatureAndHashAlgorithm algorithm,
     AsymmetricKeyParameter privateKey, byte[] hash)
 {
     ISigner signer = MakeSigner(algorithm, true, true,
         new ParametersWithRandom(privateKey, this.mContext.SecureRandom));
     signer.BlockUpdate(hash, 0, hash.Length);
     return signer.GenerateSignature();
 }
开发者ID:JohnMalmsteen,项目名称:mobile-apps-tower-defense,代码行数:8,代码来源:TlsRsaSigner.cs

示例11: GenerateAgreement

        /// <exception cref="IOException"></exception>
        public override byte[] GenerateAgreement(AsymmetricKeyParameter peerPublicKey)
        {
            mBasicAgreement.Init(mPrivateKey);
            BigInteger agreementValue = mBasicAgreement.CalculateAgreement(peerPublicKey);

            if (mTruncateAgreement)
            {
                return BigIntegers.AsUnsignedByteArray(agreementValue);
            }

            return BigIntegers.AsUnsignedByteArray(mBasicAgreement.GetFieldSize(), agreementValue);
        }
开发者ID:ALange,项目名称:OutlookPrivacyPlugin,代码行数:13,代码来源:DefaultTlsAgreementCredentials.cs

示例12: GenerateAgreement

        public virtual byte[] GenerateAgreement(AsymmetricKeyParameter serverPublicKey)
        {
            basicAgreement.Init(clientPrivateKey);
            BigInteger agreementValue = basicAgreement.CalculateAgreement(serverPublicKey);

            if (truncateAgreement)
            {
                return BigIntegers.AsUnsignedByteArray(agreementValue);
            }

            return BigIntegers.AsUnsignedByteArray(basicAgreement.GetFieldSize(), agreementValue);
        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:12,代码来源:DefaultTlsAgreementCredentials.cs

示例13: VerifyRawSignature

 public override bool VerifyRawSignature(SignatureAndHashAlgorithm algorithm, byte[] sigBytes,
     AsymmetricKeyParameter publicKey, byte[] hash)
 {
     ISigner signer = MakeSigner(algorithm, true, false, publicKey);
     if (algorithm == null)
     {
         // Note: Only use the SHA1 part of the (MD5/SHA1) hash
         signer.BlockUpdate(hash, 16, 20);
     }
     else
     {
         signer.BlockUpdate(hash, 0, hash.Length);
     }
     return signer.VerifySignature(sigBytes);
 }
开发者ID:andibadra,项目名称:bc-csharp,代码行数:15,代码来源:TlsDsaSigner.cs

示例14: GenerateRawSignature

 public override byte[] GenerateRawSignature(SignatureAndHashAlgorithm algorithm,
     AsymmetricKeyParameter privateKey, byte[] hash)
 {
     ISigner signer = MakeSigner(algorithm, true, true,
         new ParametersWithRandom(privateKey, this.mContext.SecureRandom));
     if (algorithm == null)
     {
         // Note: Only use the SHA1 part of the (MD5/SHA1) hash
         signer.BlockUpdate(hash, 16, 20);
     }
     else
     {
         signer.BlockUpdate(hash, 0, hash.Length);
     }
     return signer.GenerateSignature();
 }
开发者ID:andibadra,项目名称:bc-csharp,代码行数:16,代码来源:TlsDsaSigner.cs

示例15: DefaultTlsSignerCredentials

        public DefaultTlsSignerCredentials(TlsClientContext context,
            Certificate clientCertificate, AsymmetricKeyParameter clientPrivateKey)
        {
            if (clientCertificate == null)
            {
                throw new ArgumentNullException("clientCertificate");
            }
            if (clientCertificate.Length == 0)
            {
                throw new ArgumentException("cannot be empty", "clientCertificate");
            }
            if (clientPrivateKey == null)
            {
                throw new ArgumentNullException("clientPrivateKey");
            }
            if (!clientPrivateKey.IsPrivate)
            {
                throw new ArgumentException("must be private", "clientPrivateKey");
            }

            if (clientPrivateKey is RsaKeyParameters)
            {
                clientSigner = new TlsRsaSigner();
            }
            else if (clientPrivateKey is DsaPrivateKeyParameters)
            {
                clientSigner = new TlsDssSigner();
            }
            else if (clientPrivateKey is ECPrivateKeyParameters)
            {
                clientSigner = new TlsECDsaSigner();
            }
            else
            {
                throw new ArgumentException("type not supported: "
                    + clientPrivateKey.GetType().FullName, "clientPrivateKey");
            }

            this.context = context;
            this.clientCert = clientCertificate;
            this.clientPrivateKey = clientPrivateKey;
        }
开发者ID:MBrekhof,项目名称:pleiobox-clients,代码行数:42,代码来源:DefaultTlsSignerCredentials.cs


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