當前位置: 首頁>>代碼示例>>C#>>正文


C# X509Certificate.VerifySignature方法代碼示例

本文整理匯總了C#中Mono.Security.X509.X509Certificate.VerifySignature方法的典型用法代碼示例。如果您正苦於以下問題:C# X509Certificate.VerifySignature方法的具體用法?C# X509Certificate.VerifySignature怎麽用?C# X509Certificate.VerifySignature使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Mono.Security.X509.X509Certificate的用法示例。


在下文中一共展示了X509Certificate.VerifySignature方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: VerifyDSASignature_Bad

		public void VerifyDSASignature_Bad ()
		{
			X509Certificate ca = new X509Certificate (DSACACert_crt);
			X509Certificate signed = new X509Certificate (InvalidDSASignatureTest6EE_crt);
			Assert.IsFalse (signed.VerifySignature (ca.DSA), "VerifySignature(dsa)");
		}
開發者ID:carrie901,項目名稱:mono,代碼行數:6,代碼來源:X509CertificateTest.cs

示例2: Verify

    /// <summary>True if this certificate is signed by a CA whose cetificate
    /// we have, false otherwise.</summary>
    public bool Verify(X509Certificate x509) {
      MemBlock sn = MemBlock.Reference(x509.SerialNumber);
      lock(_sync) {
        if(!_cas.ContainsKey(sn)) {
          throw new Exception("Unsupported CA!");
        }
        if(!x509.VerifySignature(_cas[sn].RSA)) {
          throw new Exception("Unable to verify certificate, bad signature!");
        }
      }

      foreach(ICertificateVerification icv in _certificate_verifiers) {
        if(!icv.Verify(x509)) {
          throw new Exception("Certificate not valid, reason unsure");
        }
      }

      return true;
    }
開發者ID:twchoi,項目名稱:tmp-brunet-deetoo,代碼行數:21,代碼來源:CertificateHandler.cs

示例3: InheritedDSAParameters

		public void InheritedDSAParameters ()
		{
			X509Certificate ca = new X509Certificate (DSACACert_crt);
			X509Certificate subca = new X509Certificate (DSAParametersInheritedCACert_crt);
			subca.KeyAlgorithmParameters = ca.KeyAlgorithmParameters;
			Assert.AreEqual ("<DSAKeyValue><P>3+URPtrptm4Q1uqd4p06sEe9RADHVsjMbtAzhFZHNT32VMjjwq27unXzLzMMpvkx7Gfj5Zlt/CluqleIcjTijgCQ4KOsZI7A9jwdj7TISkgwXn+qnHYmC9sTczODl8DFs+Y39T7/FQ3UoS66Mfirh9gLzHeYQm6sk5jCvS57NAs=</P><Q>zwYE2P+L6wDp9lwHlnP9lmU6Lwc=</Q><G>zOF8sM6SX2PsOLtEut2SNLZevmV72HF3BJ3sZnw7BM6281L+D5JVAu9OEqtdmi4vblbzcOxq7ZsiuKgTywycFurBCo4hJkSlDPmg7GLgcDHMaPULhaRKG2559MH5Nlo4b07vhFPfZ/3M91lij5yczRCPXKQPnLcH7GDzvq9+OZg=</G><Y>Z4xH2gw2gWQ5+Bo3C/C71BP9Zz1AyJyS4TqJVLDyl6Vw0GQXpKd8qeknCWXfoKUc/ATaPt1ia/AM7YFXT10pyAhZGQxfjYjw/4y26HUBvhAKZN9Xe4tsVvBTzkOIuQmZCDyQrwHo2TJd7VYCz2DSATrjCiuekUH2x3zebJljAA4=</Y></DSAKeyValue>", subca.DSA.ToXmlString (false), "DSA");
			Assert.IsTrue (subca.VerifySignature (ca.DSA), "CA signed SubCA");

			X509Certificate ee = new X509Certificate (ValidDSAParameterInheritanceTest5EE_crt);
			ee.KeyAlgorithmParameters = subca.KeyAlgorithmParameters;
			Assert.AreEqual ("<DSAKeyValue><P>3+URPtrptm4Q1uqd4p06sEe9RADHVsjMbtAzhFZHNT32VMjjwq27unXzLzMMpvkx7Gfj5Zlt/CluqleIcjTijgCQ4KOsZI7A9jwdj7TISkgwXn+qnHYmC9sTczODl8DFs+Y39T7/FQ3UoS66Mfirh9gLzHeYQm6sk5jCvS57NAs=</P><Q>zwYE2P+L6wDp9lwHlnP9lmU6Lwc=</Q><G>zOF8sM6SX2PsOLtEut2SNLZevmV72HF3BJ3sZnw7BM6281L+D5JVAu9OEqtdmi4vblbzcOxq7ZsiuKgTywycFurBCo4hJkSlDPmg7GLgcDHMaPULhaRKG2559MH5Nlo4b07vhFPfZ/3M91lij5yczRCPXKQPnLcH7GDzvq9+OZg=</G><Y>zos22FxEQcfqmrDYlDlFs0m0bGa91p2w64m+flvQ2zMhgxtKkmrXdtKjyEvHm5V8S+QZ1zQGmhgd1rH937TFByrUbZvIrGcr5tglsmFe6+98S1AldWg1Gd4C4P5RfmwAqNrRPzTDyRMDX/YrS8kxXATG5ls4+FhuWJXXX/pu/E8=</Y></DSAKeyValue>", ee.DSA.ToXmlString (false), "DSA");
			Assert.IsTrue (ee.VerifySignature (subca.DSA), "SubCA signed EE");
		}
開發者ID:carrie901,項目名稱:mono,代碼行數:13,代碼來源:X509CertificateTest.cs

示例4: VerifyDSASignature

		public void VerifyDSASignature ()
		{
			X509Certificate ca = new X509Certificate (DSACACert_crt);
			// note: the DSA signature has 41 bytes because part1 first byte would be 
			// negative (bad for ASN.1) so a 0x00 was prepended
			X509Certificate signed = new X509Certificate (ValidDSASignaturesTest4EE_crt);
			Assert.IsTrue (signed.VerifySignature (ca.DSA), "VerifySignature(dsa)");
		}
開發者ID:carrie901,項目名稱:mono,代碼行數:8,代碼來源:X509CertificateTest.cs

示例5: IsParent

		private bool IsParent (X509Certificate child, X509Certificate parent) 
		{
			if (child.IssuerName != parent.SubjectName)
				return false;

			// parent MUST have the Basic Constraint CA=true (except for trusted roots)
			// see why at http://www.microsoft.com/technet/security/bulletin/MS02-050.asp
			if ((parent.Version > 2) && (!IsTrusted (parent))) {
				// TODO: we do not support pathLenConstraint
				X509Extension ext = parent.Extensions ["2.5.29.19"];
				if (ext != null) {
					BasicConstraintsExtension bc = new BasicConstraintsExtension (ext);
					if (!bc.CertificateAuthority)
						_status = X509ChainStatusFlags.InvalidBasicConstraints;
				}
				else
					_status = X509ChainStatusFlags.InvalidBasicConstraints;
			}

			if (!child.VerifySignature (parent.RSA)) {
				_status = X509ChainStatusFlags.NotSignatureValid;
				return false;
			}
			return true;
		}
開發者ID:jjenki11,項目名稱:blaze-chem-rendering,代碼行數:25,代碼來源:X509Chain.cs

示例6: Verify

 /// <summary>True if this certificate is signed by a CA whose cetificate
 /// we have, false otherwise.</summary>
 public bool Verify(X509Certificate x509) {
   MemBlock sn = MemBlock.Reference(x509.SerialNumber);
   if(!_cas.ContainsKey(sn)) {
     throw new Exception("Unsupported CA!");
   }
   if(!x509.VerifySignature(_cas[sn].RSA)) {
     throw new Exception("Unable to verify certificate, bad signature!");
   }
   return true;
 }
開發者ID:kyungyonglee,項目名稱:BrunetTutorial,代碼行數:12,代碼來源:CertificateHandler.cs

示例7: RipeMd160

		public void RipeMd160 ()
		{
			X509Certificate c = new X509Certificate (ripemd160_data);
			Assert.AreEqual ("1.3.36.3.3.1.2", c.SignatureAlgorithm, "SignatureAlgorithm");
			Assert.IsTrue (c.VerifySignature (c.RSA), "hash mapping");
			Assert.IsTrue (c.IsSelfSigned, "IsSelfSigned");
		}
開發者ID:Jakosa,項目名稱:MonoLibraries,代碼行數:7,代碼來源:X509CertificateTest.cs

示例8: Sha512

		public void Sha512 ()
		{
			X509Certificate c = new X509Certificate (sha512_data);
			Assert.AreEqual ("1.2.840.113549.1.1.13", c.SignatureAlgorithm, "SignatureAlgorithm");
			Assert.IsTrue (c.VerifySignature (c.RSA), "hash mapping");
			Assert.IsTrue (c.IsSelfSigned, "IsSelfSigned");
		}
開發者ID:Jakosa,項目名稱:MonoLibraries,代碼行數:7,代碼來源:X509CertificateTest.cs

示例9: Sha256

		public void Sha256 ()
		{
			X509Certificate c = new X509Certificate (sha256_data);
			Assert.AreEqual ("1.2.840.113549.1.1.11", c.SignatureAlgorithm, "SignatureAlgorithm");
			Assert.IsFalse (c.VerifySignature (c.RSA), "hash mapping");
		}
開發者ID:Jakosa,項目名稱:MonoLibraries,代碼行數:6,代碼來源:X509CertificateTest.cs


注:本文中的Mono.Security.X509.X509Certificate.VerifySignature方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。