本文整理汇总了C#中Certificate.Template方法的典型用法代码示例。如果您正苦于以下问题:C# Certificate.Template方法的具体用法?C# Certificate.Template怎么用?C# Certificate.Template使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Certificate
的用法示例。
在下文中一共展示了Certificate.Template方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DisplayCertificate
//.........这里部分代码省略.........
{
Console.WriteLine( "Key Usage: Not present.");
}
Console.WriteLine();
if (Certificate.ExtendedKeyUsage().IsPresent)
{
if (Certificate.ExtendedKeyUsage().EKUs.Count > 0)
{
OID OID;
OID = new OIDClass();
Console.WriteLine( "Extended Key Usage:");
Console.WriteLine( " Critical = " + Certificate.ExtendedKeyUsage().IsCritical);
foreach (EKU EKU in Certificate.ExtendedKeyUsage().EKUs)
{
OID.Value = EKU.OID;
Console.WriteLine( " " + OID.FriendlyName + " (" + OID.Value + ")" );
}
OID = null;
}
else
{
Console.WriteLine( "Extended Key Usage: Not valid for any usage.");
Console.WriteLine( " Critical = " + Certificate.ExtendedKeyUsage().IsCritical );
}
}
else
{
Console.WriteLine( "Extended Key Usage: Not present (valid for all usages).");
}
Console.WriteLine();
if (Certificate.Template().IsPresent)
{
Console.WriteLine( "Template:");
Console.WriteLine( " Critical = " + Certificate.Template().IsCritical);
Console.WriteLine( " Name = " + Certificate.Template().Name);
Console.WriteLine( " OID = " + Certificate.Template().OID.FriendlyName + "(" + Certificate.Template().OID.Value + ")");
Console.WriteLine( " Major = " + Certificate.Template().MajorVersion);
Console.WriteLine( " Minor = " + Certificate.Template().MinorVersion);
}
else
{
Console.WriteLine( "Template: Not present.");
}
Console.WriteLine();
Console.WriteLine( "Public Key:");
Console.WriteLine( " Algorithm = " + Certificate.PublicKey().Algorithm.FriendlyName + "(" + Certificate.PublicKey().Algorithm.Value + ")");
Console.WriteLine( " Length = " + Certificate.PublicKey().Length + " bits");
Console.WriteLine( " Key blob = " + Certificate.PublicKey().EncodedKey.Format(true));
Console.WriteLine( " Parameters = " + Certificate.PublicKey().EncodedParameters.Format(true));
if (Certificate.HasPrivateKey())
{
Console.WriteLine( "Private Key:");
Console.WriteLine( " Container name = " + Certificate.PrivateKey.ContainerName);
//Don't display unique container name for hardware token because it may cause UI to be displayed.
if (! Certificate.PrivateKey.IsHardwareDevice())
{
Console.WriteLine( " Unique name = " + Certificate.PrivateKey.UniqueContainerName);
}
Console.WriteLine( " Provider name = " + Certificate.PrivateKey.ProviderName);
Console.WriteLine( " Provider type = " );
if (Convert.ToInt32(Certificate.PrivateKey.ProviderType) > ProviderTypes.GetUpperBound(0))