/** * Return possible empty collection with recipients matching the passed in RecipientID * * @param selector a recipient id to select against. * @return a collection of RecipientInformation objects. */ public ICollection GetRecipients( RecipientID selector) { IList list = (IList)table[selector]; return(list == null?BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList() : BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(list)); }
/** * Return the first RecipientInformation object that matches the * passed in selector. Null if there are no matches. * * @param selector to identify a recipient * @return a single RecipientInformation object. Null if none matches. */ public RecipientInformation GetFirstRecipient( RecipientID selector) { IList list = (IList)table[selector]; return(list == null ? null : (RecipientInformation)list[0]); }
internal KeyAgreeRecipientInformation( KeyAgreeRecipientInfo info, RecipientID rid, Asn1OctetString encryptedKey, CmsSecureReadable secureReadable) : base(info.KeyEncryptionAlgorithm, secureReadable) { this.info = info; this.rid = rid; this.encryptedKey = encryptedKey; }
private readonly IDictionary table = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateHashtable(); // Hashtable[RecipientID, ArrayList[RecipientInformation]] public RecipientInformationStore( ICollection recipientInfos) { foreach (RecipientInformation recipientInformation in recipientInfos) { RecipientID rid = recipientInformation.RecipientID; IList list = (IList)table[rid]; if (list == null) { table[rid] = list = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(1); } list.Add(recipientInformation); } this.all = BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.CreateArrayList(recipientInfos); }
public override bool Equals( object obj) { if (obj == this) { return(true); } RecipientID id = obj as RecipientID; if (id == null) { return(false); } return(Arrays.AreEqual(keyIdentifier, id.keyIdentifier) && Arrays.AreEqual(SubjectKeyIdentifier, id.SubjectKeyIdentifier) && BestHTTP.SecureProtocol.Org.BouncyCastle.Utilities.Platform.Equals(SerialNumber, id.SerialNumber) && IssuersMatch(Issuer, id.Issuer)); }
internal static void ReadRecipientInfo(IList infos, KeyAgreeRecipientInfo info, CmsSecureReadable secureReadable) { try { foreach (Asn1Encodable rek in info.RecipientEncryptedKeys) { RecipientEncryptedKey id = RecipientEncryptedKey.GetInstance(rek.ToAsn1Object()); RecipientID rid = new RecipientID(); Asn1.Cms.KeyAgreeRecipientIdentifier karid = id.Identifier; Asn1.Cms.IssuerAndSerialNumber iAndSN = karid.IssuerAndSerialNumber; if (iAndSN != null) { rid.Issuer = iAndSN.Name; rid.SerialNumber = iAndSN.SerialNumber.Value; } else { Asn1.Cms.RecipientKeyIdentifier rKeyID = karid.RKeyID; // Note: 'date' and 'other' fields of RecipientKeyIdentifier appear to be only informational rid.SubjectKeyIdentifier = rKeyID.SubjectKeyIdentifier.GetOctets(); } infos.Add(new KeyAgreeRecipientInformation(info, rid, id.EncryptedKey, secureReadable)); } } catch (IOException e) { throw new ArgumentException("invalid rid in KeyAgreeRecipientInformation", e); } }
public RecipientInformation this[RecipientID selector] { get { return(GetFirstRecipient(selector)); } }