public PgpEncryptedDataList(BcpgInputStream bcpgInput) { while (bcpgInput.NextPacketTag() == PacketTag.PublicKeyEncryptedSession || bcpgInput.NextPacketTag() == PacketTag.SymmetricKeyEncryptedSessionKey) { list.Add((object)bcpgInput.ReadPacket()); } data = (InputStreamPacket)bcpgInput.ReadPacket(); for (int i = 0; i != ((global::System.Collections.ICollection)list).get_Count(); i++) { if (list.get_Item(i) is SymmetricKeyEncSessionPacket) { list.set_Item(i, (object)new PgpPbeEncryptedData((SymmetricKeyEncSessionPacket)list.get_Item(i), data)); } else { list.set_Item(i, (object)new PgpPublicKeyEncryptedData((PublicKeyEncSessionPacket)list.get_Item(i), data)); } } }
protected internal void Sort() { if (((global::System.Collections.ICollection)_set).get_Count() >= 2) { Asn1Encodable[] array = new Asn1Encodable[((global::System.Collections.ICollection)_set).get_Count()]; byte[][] array2 = new byte[((global::System.Collections.ICollection)_set).get_Count()][]; for (int i = 0; i < ((global::System.Collections.ICollection)_set).get_Count(); i++) { array2[i] = (array[i] = (Asn1Encodable)_set.get_Item(i)).GetEncoded("DER"); } global::System.Array.Sort((global::System.Array)array2, (global::System.Array)array, (IComparer)(object)new DerComparer()); for (int j = 0; j < ((global::System.Collections.ICollection)_set).get_Count(); j++) { _set.set_Item(j, (object)array[j]); } } }
public static PgpSecretKeyRing InsertSecretKey(PgpSecretKeyRing secRing, PgpSecretKey secKey) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) global::System.Collections.IList list = Platform.CreateArrayList((global::System.Collections.ICollection)secRing.keys); bool flag = false; bool flag2 = false; for (int i = 0; i != ((global::System.Collections.ICollection)list).get_Count(); i++) { PgpSecretKey pgpSecretKey = (PgpSecretKey)list.get_Item(i); if (pgpSecretKey.KeyId == secKey.KeyId) { flag = true; list.set_Item(i, (object)secKey); } if (pgpSecretKey.IsMasterKey) { flag2 = true; } } if (!flag) { if (secKey.IsMasterKey) { if (flag2) { throw new ArgumentException("cannot add a master key to a ring that already has one"); } list.Insert(0, (object)secKey); } else { list.Add((object)secKey); } } return(new PgpSecretKeyRing(list, secRing.extraPubKeys)); }