⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 validatecertificate.cs

📁 一个用于网络安全方面的SSL,TLS库.可以用来做FTPS, WEB Server等等d
💻 CS
字号:
using System;
using Org.Mentalis.Security.Certificates;

/// <summary>
/// This example shows how you can validate a certificate.
/// </summary>
class ValidateCertificate {
	static void Main(string[] args) {
		Console.WriteLine("This example shows how you can validate a certificate.");
		// load the certificate from a file
		Certificate cert = Certificate.CreateFromCerFile(@"client.cer");
		// build a certificate chain
		CertificateChain cc = new CertificateChain(cert);
		// validate the chain
		CertificateStatus status = cc.VerifyChain(null, AuthType.Client);
		// interpret the result
		if (status == CertificateStatus.ValidCertificate) {
			Console.WriteLine("The certificate is valid.");
		} else {
			Console.WriteLine("The certificate is not valid [" + status.ToString() + "].");
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -