本文整理汇总了C#中Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKey.GetSignaturesForUserAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# PgpPublicKey.GetSignaturesForUserAttribute方法的具体用法?C# PgpPublicKey.GetSignaturesForUserAttribute怎么用?C# PgpPublicKey.GetSignaturesForUserAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Org.BouncyCastle.Bcpg.OpenPgp.PgpPublicKey
的用法示例。
在下文中一共展示了PgpPublicKey.GetSignaturesForUserAttribute方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RemoveCertification
/// <summary>Remove a certification from the key.</summary>
/// <param name="key">The key the certifications are to be removed from.</param>
/// <param name="certification">The certfication to be removed.</param>
/// <returns>The modified key, null if the certification was not found.</returns>
public static PgpPublicKey RemoveCertification(PgpPublicKey key, PgpSignature certification)
{
var returnKey = new PgpPublicKey(key);
var sigs = returnKey.SubSigs ?? returnKey.KeySigs;
// bool found = sigs.Remove(certification);
var pos = sigs.IndexOf(certification);
var found = pos >= 0;
if (found)
{
sigs.RemoveAt(pos);
}
else
{
foreach (string id in key.GetUserIds())
{
foreach (var sig in key.GetSignaturesForId(id))
{
// TODO Is this the right type of equality test?
if (certification != sig)
continue;
found = true;
returnKey = PgpPublicKey.RemoveCertification(returnKey, id, certification);
}
}
if (!found)
{
foreach (IPgpUserAttributeSubpacketVector id in key.GetUserAttributes())
{
foreach (var sig in key.GetSignaturesForUserAttribute(id))
{
// TODO Is this the right type of equality test?
if (certification != sig) continue;
// found = true;
returnKey = PgpPublicKey.RemoveCertification(returnKey, id, certification);
}
}
}
}
return returnKey;
}
示例2: RemoveCertification
/// <summary>Remove a certification from the key.</summary>
/// <param name="key">The key the certifications are to be removed from.</param>
/// <param name="certification">The certfication to be removed.</param>
/// <returns>The modified key, null if the certification was not found.</returns>
public static PgpPublicKey RemoveCertification(
PgpPublicKey key,
PgpSignature certification)
{
PgpPublicKey returnKey = new PgpPublicKey(key);
IList sigs = returnKey.subSigs != null
? returnKey.subSigs
: returnKey.keySigs;
// bool found = sigs.Remove(certification);
int pos = sigs.IndexOf(certification);
bool found = pos >= 0;
if (found)
{
sigs.RemoveAt(pos);
}
else
{
foreach (String id in key.GetUserIds())
{
foreach (object sig in key.GetSignaturesForId(id))
{
// TODO Is this the right type of equality test?
if (certification == sig)
{
found = true;
returnKey = PgpPublicKey.RemoveCertification(returnKey, id, certification);
}
}
}
if (!found)
{
foreach (PgpUserAttributeSubpacketVector id in key.GetUserAttributes())
{
foreach (object sig in key.GetSignaturesForUserAttribute(id))
{
// TODO Is this the right type of equality test?
if (certification == sig)
{
found = true;
returnKey = PgpPublicKey.RemoveCertification(returnKey, id, certification);
}
}
}
}
}
return returnKey;
}