本文整理汇总了C#中Certificate.fromBER方法的典型用法代码示例。如果您正苦于以下问题:C# Certificate.fromBER方法的具体用法?C# Certificate.fromBER怎么用?C# Certificate.fromBER使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Certificate
的用法示例。
在下文中一共展示了Certificate.fromBER方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Certificate
public void Test_Certificate()
{
try
{
BEREncoding ber = BERReader.CreateBEREncoding("test.cert.der");
BERWriter.DumpHEX(ber);
Certificate cert = new Certificate();
cert.fromBER(ber);
ResourceLoader rl = new ResourceLoader();
foreach (string fileName in ResourceLoader.fileNames)
{
Console.WriteLine("\n"+fileName);
Stream strm = rl.GetStream(fileName);
ber = BERReader.CreateBEREncoding(strm);
cert.fromBER(ber);
X509.Extensions exts =
cert.certificate.extensions.underObject
as X509.Extensions;
foreach(X509.Extension ext in exts.Elements)
{
//BERWriter.DumpHEX(ext);
//BERWriter.DumpHEX(ext.etxnId);
//Console.WriteLine(ext.etxnId.ToString());
if (ext.critical.val)
{
Console.Write("CRITICAL, ");
}
else
{
Console.Write("NON-CRITICAL, ");
}
Console.Write(OID.Helper.OIDHelper.ht.GetDescription(ext.etxnId)+", ");
ASN1OctetString os = ext.extnValue;
BEREncoding innerBER = new BEREncoding(os.asDER().GetContents());
Console.Write(ext.innerExtnValue.GetType().ToString()+", ");
BERWriter.DumpHEX(ext.innerExtnValue);
}
BERWriter.DumpHEX(cert);
}
Console.WriteLine("Success.");
}
catch (UnrecognizedObjectIdentifierException oidException)
{
Console.WriteLine(oidException.Message);
}
}