/** * Return possible empty collection with signers matching the passed in SignerID * * @param selector a signer id to select against. * @return a collection of SignerInformation objects. */ public ICollection GetSigners( SignerID selector) { IList list = (IList)table[selector]; return(list == null?Platform.CreateArrayList() : Platform.CreateArrayList(list)); }
/** * Return the first SignerInformation object that matches the * passed in selector. Null if there are no matches. * * @param selector to identify a signer * @return a single SignerInformation object. Null if none matches. */ public SignerInformation GetFirstSigner( SignerID selector) { IList list = (IList)table[selector]; return(list == null ? null : (SignerInformation)list[0]); }
private readonly IDictionary table = Platform.CreateHashtable(); // Hashtable[SignerID, ArrayList[SignerInformation]] /** * Create a store containing a single SignerInformation object. * * @param signerInfo the signer information to contain. */ public SignerInformationStore( SignerInformation signerInfo) { this.all = Platform.CreateArrayList(1); this.all.Add(signerInfo); SignerID sid = signerInfo.SignerID; table[sid] = all; }
/** * Create a store containing a collection of SignerInformation objects. * * @param signerInfos a collection signer information objects to contain. */ public SignerInformationStore( ICollection signerInfos) { foreach (SignerInformation signer in signerInfos) { SignerID sid = signer.SignerID; IList list = (IList)table[sid]; if (list == null) { table[sid] = list = Platform.CreateArrayList(1); } list.Add(signer); } this.all = Platform.CreateArrayList(signerInfos); }
internal SignerInformation( SignerInfo info, DerObjectIdentifier contentType, CmsProcessable content, IDigestCalculator digestCalculator) { this.info = info; this.sid = new SignerID(); this.contentType = contentType; this.isCounterSignature = contentType == null; try { SignerIdentifier s = info.SignerID; if (s.IsTagged) { Asn1OctetString octs = Asn1OctetString.GetInstance(s.ID); sid.SubjectKeyIdentifier = octs.GetEncoded(); } else { Asn1.Cms.IssuerAndSerialNumber iAnds = Asn1.Cms.IssuerAndSerialNumber.GetInstance(s.ID); sid.Issuer = iAnds.Name; sid.SerialNumber = iAnds.SerialNumber.Value; } } catch (IOException) { throw new ArgumentException("invalid sid in SignerInfo"); } this.digestAlgorithm = info.DigestAlgorithm; this.signedAttributeSet = info.AuthenticatedAttributes; this.unsignedAttributeSet = info.UnauthenticatedAttributes; this.encryptionAlgorithm = info.DigestEncryptionAlgorithm; this.signature = info.EncryptedDigest.GetOctets(); this.content = content; this.digestCalculator = digestCalculator; }
public override bool Equals( object obj) { if (obj == this) { return(false); } SignerID id = obj as SignerID; if (id == null) { return(false); } return(Arrays.AreEqual(SubjectKeyIdentifier, id.SubjectKeyIdentifier) && Platform.Equals(SerialNumber, id.SerialNumber) && IssuersMatch(Issuer, id.Issuer)); }