本文整理汇总了C#中X509Chain.Add方法的典型用法代码示例。如果您正苦于以下问题:C# X509Chain.Add方法的具体用法?C# X509Chain.Add怎么用?C# X509Chain.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类X509Chain
的用法示例。
在下文中一共展示了X509Chain.Add方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnVerifyCertThunk
private int OnVerifyCertThunk(int ok, IntPtr store)
{
var ctx = new X509StoreContext(store, false);
// build the X509Chain from the store
using (var chain = new X509Chain())
{
foreach (var obj in ctx.Store.Objects)
{
var cert = obj.Certificate;
if (cert != null)
chain.Add(cert);
}
// Call the managed delegate
return OnVerifyCert(
this,
ctx.CurrentCert,
chain,
ctx.ErrorDepth,
(VerifyResult)ctx.Error
) ? 1 : 0;
}
}
示例2: OnVerifyCertThunk
internal int OnVerifyCertThunk(int ok, IntPtr store_ctx)
{
X509StoreContext ctx = new X509StoreContext(store_ctx, false);
X509Certificate cert = ctx.CurrentCert;
int depth = ctx.ErrorDepth;
VerifyResult result = (VerifyResult)ctx.Error;
// build the X509Chain from the store
X509Store store = ctx.Store;
Core.Stack<X509Object> objStack = store.Objects;
X509Chain chain = new X509Chain();
foreach (X509Object obj in objStack)
{
X509Certificate objCert = obj.Certificate;
if (objCert != null)
{
chain.Add(objCert);
}
}
// Call the managed delegate
if (OnVerifyCert(this, cert, chain, depth, result))
{
return 1;
}
else
{
return 0;
}
}
示例3: OnVerifyCertThunk
internal int OnVerifyCertThunk(int ok, IntPtr store_ctx)
{
var ctx = new X509StoreContext(store_ctx, false);
X509Certificate cert = ctx.CurrentCert;
int depth = ctx.ErrorDepth;
var result = (VerifyResult) ctx.Error;
// build the X509Chain from the store
var store = ctx.Store;
var objStack = store.Objects;
var chain = new X509Chain();
foreach (var objCert in objStack.Select(obj => obj.Certificate).Where(objCert => objCert != null))
{
chain.Add(objCert);
}
// Call the managed delegate
return OnVerifyCert(this, cert, chain, depth, result) ? 1 : 0;
}