in net/JetBrains.SignatureVerifier/src/Crypt/BC/SignerInformation.cs [687:722]
private Asn1Object GetSingleValuedSignedAttribute(
DerObjectIdentifier attrOID, string printableName)
{
AttributeTable unsignedAttrTable = this.UnsignedAttributes;
if (unsignedAttrTable != null
&& unsignedAttrTable.GetAll(attrOID).Count > 0)
{
throw new CmsException("The " + printableName
+ " attribute MUST NOT be an unsigned attribute");
}
AttributeTable signedAttrTable = this.SignedAttributes;
if (signedAttrTable == null)
{
return null;
}
Asn1EncodableVector v = signedAttrTable.GetAll(attrOID);
switch (v.Count)
{
case 0:
return null;
case 1:
Attribute t = (Attribute)v[0];
Asn1Set attrValues = t.AttrValues;
if (attrValues.Count != 1)
throw new CmsException("A " + printableName
+ " attribute MUST have a single attribute value");
return attrValues[0].ToAsn1Object();
default:
throw new CmsException("The SignedAttributes in a signerInfo MUST NOT include multiple instances of the "
+ printableName + " attribute");
}
}