protected virtual byte[] GetLSub(int n) { while (n >= ((global::System.Collections.ICollection)L).get_Count()) { L.Add((object)OCB_double((byte[])L.get_Item(((global::System.Collections.ICollection)L).get_Count() - 1))); } return((byte[])L.get_Item(n)); }
public void Init(byte[] x) { uint[] array = GcmUtilities.AsUints(x); if (lookupPowX2 == null || !Arrays.AreEqual(array, (uint[])lookupPowX2.get_Item(0))) { lookupPowX2 = Platform.CreateArrayList(8); lookupPowX2.Add((object)array); } }
internal void ContributeFragment(byte msg_type, int length, byte[] buf, int off, int fragment_offset, int fragment_length) { int num = fragment_offset + fragment_length; if (mMsgType != msg_type || mBody.Length != length || num > length) { return; } if (fragment_length == 0) { if (fragment_offset == 0 && ((global::System.Collections.ICollection)mMissing).get_Count() > 0) { Range range = (Range)mMissing.get_Item(0); if (range.End == 0) { mMissing.RemoveAt(0); } } return; } for (int i = 0; i < ((global::System.Collections.ICollection)mMissing).get_Count(); i++) { Range range2 = (Range)mMissing.get_Item(i); if (range2.Start >= num) { break; } if (range2.End <= fragment_offset) { continue; } int num2 = Math.Max(range2.Start, fragment_offset); int num3 = Math.Min(range2.End, num); int num4 = num3 - num2; global::System.Array.Copy((global::System.Array)buf, off + num2 - fragment_offset, (global::System.Array)mBody, num2, num4); if (num2 == range2.Start) { if (num3 == range2.End) { mMissing.RemoveAt(i--); } else { range2.Start = num3; } continue; } if (num3 != range2.End) { mMissing.Insert(++i, (object)new Range(num3, range2.End)); } range2.End = num2; } }
public virtual byte[] ProcessBlock(byte[] inBytes, int inOff, int length) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (key == null) { throw new InvalidOperationException("NaccacheStern engine not initialised"); } if (length > GetInputBlockSize() + 1) { throw new DataLengthException("input too large for Naccache-Stern cipher.\n"); } if (!forEncryption && length < GetInputBlockSize()) { throw new InvalidCipherTextException("BlockLength does not match modulus for Naccache-Stern cipher.\n"); } BigInteger bigInteger = new BigInteger(1, inBytes, inOff, length); if (forEncryption) { return(Encrypt(bigInteger)); } global::System.Collections.IList list = Platform.CreateArrayList(); NaccacheSternPrivateKeyParameters naccacheSternPrivateKeyParameters = (NaccacheSternPrivateKeyParameters)key; global::System.Collections.IList smallPrimesList = naccacheSternPrivateKeyParameters.SmallPrimesList; for (int i = 0; i < ((global::System.Collections.ICollection)smallPrimesList).get_Count(); i++) { BigInteger bigInteger2 = bigInteger.ModPow(naccacheSternPrivateKeyParameters.PhiN.Divide((BigInteger)smallPrimesList.get_Item(i)), naccacheSternPrivateKeyParameters.Modulus); global::System.Collections.IList list2 = lookup[i]; if (((global::System.Collections.ICollection)lookup[i]).get_Count() != ((BigInteger)smallPrimesList.get_Item(i)).IntValue) { throw new InvalidCipherTextException(string.Concat(new object[6] { "Error in lookup Array for ", ((BigInteger)smallPrimesList.get_Item(i)).IntValue, ": Size mismatch. Expected ArrayList with length ", ((BigInteger)smallPrimesList.get_Item(i)).IntValue, " but found ArrayList of length ", ((global::System.Collections.ICollection)lookup[i]).get_Count() })); } int num = list2.IndexOf((object)bigInteger2); if (num == -1) { throw new InvalidCipherTextException("Lookup failed"); } list.Add((object)BigInteger.ValueOf(num)); } BigInteger bigInteger3 = chineseRemainder(list, smallPrimesList); return(bigInteger3.ToByteArray()); }
public virtual void Init(bool forEncryption, ICipherParameters parameters) { this.forEncryption = forEncryption; if (parameters is ParametersWithRandom) { parameters = ((ParametersWithRandom)parameters).Parameters; } key = (NaccacheSternKeyParameters)parameters; if (this.forEncryption) { return; } NaccacheSternPrivateKeyParameters naccacheSternPrivateKeyParameters = (NaccacheSternPrivateKeyParameters)key; global::System.Collections.IList smallPrimesList = naccacheSternPrivateKeyParameters.SmallPrimesList; lookup = new global::System.Collections.IList[((global::System.Collections.ICollection)smallPrimesList).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)smallPrimesList).get_Count(); i++) { BigInteger bigInteger = (BigInteger)smallPrimesList.get_Item(i); int intValue = bigInteger.IntValue; lookup[i] = Platform.CreateArrayList(intValue); lookup[i].Add((object)BigInteger.One); BigInteger bigInteger2 = BigInteger.Zero; for (int j = 1; j < intValue; j++) { bigInteger2 = bigInteger2.Add(naccacheSternPrivateKeyParameters.PhiN); BigInteger e = bigInteger2.Divide(bigInteger); lookup[i].Add((object)naccacheSternPrivateKeyParameters.G.ModPow(e, naccacheSternPrivateKeyParameters.Modulus)); } } }
public global::System.Collections.IEnumerable GetSignaturesForId(string id) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (id == null) { throw new ArgumentNullException("id"); } for (int i = 0; i != ((global::System.Collections.ICollection)ids).get_Count(); i++) { if (id.Equals(ids.get_Item(i))) { return(new EnumerableProxy((global::System.Collections.IEnumerable)(global::System.Collections.IList) idSigs.get_Item(i))); } } return(null); }
public bool IsRevoked() { int num = 0; bool flag = false; if (IsMasterKey) { while (!flag && num < ((global::System.Collections.ICollection)keySigs).get_Count()) { if (((PgpSignature)keySigs.get_Item(num++)).SignatureType == 32) { flag = true; } } } else { while (!flag && num < ((global::System.Collections.ICollection)subSigs).get_Count()) { if (((PgpSignature)subSigs.get_Item(num++)).SignatureType == 40) { flag = true; } } } return(flag); }
public TbsCertificateList GenerateTbsCertList() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) if (signature == null || issuer == null || thisUpdate == null) { throw new InvalidOperationException("Not all mandatory fields set in V2 TbsCertList generator."); } Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(version, signature, issuer, thisUpdate); if (nextUpdate != null) { asn1EncodableVector.Add(nextUpdate); } if (crlEntries != null) { Asn1Sequence[] array = new Asn1Sequence[((global::System.Collections.ICollection)crlEntries).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)crlEntries).get_Count(); i++) { array[i] = (Asn1Sequence)crlEntries.get_Item(i); } asn1EncodableVector.Add(new DerSequence(array)); } if (extensions != null) { asn1EncodableVector.Add(new DerTaggedObject(0, extensions)); } return(new TbsCertificateList(new DerSequence(asn1EncodableVector))); }
public virtual void Encode(Stream output) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown if (mResponderIDList == null || ((global::System.Collections.ICollection)mResponderIDList).get_Count() < 1) { TlsUtilities.WriteUint16(0, output); } else { MemoryStream val = new MemoryStream(); for (int i = 0; i < ((global::System.Collections.ICollection)mResponderIDList).get_Count(); i++) { ResponderID responderID = (ResponderID)mResponderIDList.get_Item(i); byte[] encoded = responderID.GetEncoded("DER"); TlsUtilities.WriteOpaque16(encoded, (Stream)(object)val); } TlsUtilities.CheckUint16(((Stream)val).get_Length()); TlsUtilities.WriteUint16((int)((Stream)val).get_Length(), output); val.WriteTo(output); } if (mRequestExtensions == null) { TlsUtilities.WriteUint16(0, output); return; } byte[] encoded2 = mRequestExtensions.GetEncoded("DER"); TlsUtilities.CheckUint16(encoded2.Length); TlsUtilities.WriteUint16(encoded2.Length, output); output.Write(encoded2, 0, encoded2.Length); }
public static Certificate Parse(Stream input) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown int num = TlsUtilities.ReadUint24(input); if (num == 0) { return(EmptyChain); } byte[] array = TlsUtilities.ReadFully(num, input); MemoryStream val = new MemoryStream(array, false); global::System.Collections.IList list = Platform.CreateArrayList(); while (((Stream)val).get_Position() < ((Stream)val).get_Length()) { byte[] encoding = TlsUtilities.ReadOpaque24((Stream)(object)val); Asn1Object obj = TlsUtilities.ReadDerObject(encoding); list.Add((object)X509CertificateStructure.GetInstance(obj)); } X509CertificateStructure[] array2 = new X509CertificateStructure[((global::System.Collections.ICollection)list).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { array2[i] = (X509CertificateStructure)list.get_Item(i); } return(new Certificate(array2)); }
internal static void AddAdditionalStoresFromAltNames(X509Certificate cert, PkixParameters pkixParams) { if (cert.GetIssuerAlternativeNames() == null) { return; } global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)cert.GetIssuerAlternativeNames()).GetEnumerator(); while (enumerator.MoveNext()) { global::System.Collections.IList list = (global::System.Collections.IList)enumerator.get_Current(); if (list.get_Item(0).Equals((object)6)) { string location = (string)list.get_Item(1); AddAdditionalStoreFromLocation(location, pkixParams); } } }
private void ResendOutboundFlight() { mRecordLayer.ResetWriteEpoch(); for (int i = 0; i < ((global::System.Collections.ICollection)mOutboundFlight).get_Count(); i++) { WriteMessage((Message)mOutboundFlight.get_Item(i)); } }
public virtual byte[] GetEncoded(string encoding) { //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown if (Platform.EqualsIgnoreCase(encoding, "PkiPath")) { Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector(); for (int num = ((global::System.Collections.ICollection)certificates).get_Count() - 1; num >= 0; num--) { asn1EncodableVector.Add(ToAsn1Object((X509Certificate)certificates.get_Item(num))); } return(ToDerEncoded(new DerSequence(asn1EncodableVector))); } if (Platform.EqualsIgnoreCase(encoding, "PKCS7")) { ContentInfo contentInfo = new ContentInfo(PkcsObjectIdentifiers.Data, null); Asn1EncodableVector asn1EncodableVector2 = new Asn1EncodableVector(); for (int i = 0; i != ((global::System.Collections.ICollection)certificates).get_Count(); i++) { asn1EncodableVector2.Add(ToAsn1Object((X509Certificate)certificates.get_Item(i))); } SignedData content = new SignedData(new DerInteger(1), new DerSet(), contentInfo, new DerSet(asn1EncodableVector2), null, new DerSet()); return(ToDerEncoded(new ContentInfo(PkcsObjectIdentifiers.SignedData, content))); } if (Platform.EqualsIgnoreCase(encoding, "PEM")) { MemoryStream val = new MemoryStream(); PemWriter pemWriter = new PemWriter((TextWriter) new StreamWriter((Stream)(object)val)); try { for (int j = 0; j != ((global::System.Collections.ICollection)certificates).get_Count(); j++) { pemWriter.WriteObject(certificates.get_Item(j)); } Platform.Dispose(pemWriter.Writer); } catch (global::System.Exception) { throw new CertificateEncodingException("can't encode certificate for PEM encoded path"); } return(val.ToArray()); } throw new CertificateEncodingException("unsupported encoding: " + encoding); }
public virtual PgpUserAttributeSubpacketVector Generate() { UserAttributeSubpacket[] array = new UserAttributeSubpacket[((global::System.Collections.ICollection)list).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { array[i] = (UserAttributeSubpacket)list.get_Item(i); } return(new PgpUserAttributeSubpacketVector(array)); }
public PgpSignatureSubpacketVector Generate() { SignatureSubpacket[] array = new SignatureSubpacket[((global::System.Collections.ICollection)list).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { array[i] = (SignatureSubpacket)list.get_Item(i); } return(new PgpSignatureSubpacketVector(array)); }
public SignerInformation GetFirstSigner(SignerID selector) { global::System.Collections.IList list = (global::System.Collections.IList)table.get_Item((object)selector); if (list != null) { return((SignerInformation)list.get_Item(0)); } return(null); }
public RecipientInformation GetFirstRecipient(RecipientID selector) { global::System.Collections.IList list = (global::System.Collections.IList)table.get_Item((object)selector); if (list != null) { return((RecipientInformation)list.get_Item(0)); } return(null); }
private DerSequence CreateSequence(global::System.Collections.IList subtrees) { GeneralSubtree[] array = new GeneralSubtree[((global::System.Collections.ICollection)subtrees).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)subtrees).get_Count(); i++) { array[i] = (GeneralSubtree)subtrees.get_Item(i); } return(new DerSequence(array)); }
public override Asn1Object ToAsn1Object() { AttributeX509[] array = new AttributeX509[((global::System.Collections.ICollection)attributes).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)attributes).get_Count(); i++) { array[i] = (AttributeX509)attributes.get_Item(i); } return(new DerSequence(array)); }
public X509Certificate[] GetCerts() { global::System.Collections.IList certList = GetCertList(); X509Certificate[] array = new X509Certificate[((global::System.Collections.ICollection)certList).get_Count()]; for (int i = 0; i < ((global::System.Collections.ICollection)certList).get_Count(); i++) { array[i] = (X509Certificate)certList.get_Item(i); } return(array); }
private static BigInteger chineseRemainder(global::System.Collections.IList congruences, global::System.Collections.IList primes) { BigInteger bigInteger = BigInteger.Zero; BigInteger bigInteger2 = BigInteger.One; for (int i = 0; i < ((global::System.Collections.ICollection)primes).get_Count(); i++) { bigInteger2 = bigInteger2.Multiply((BigInteger)primes.get_Item(i)); } for (int j = 0; j < ((global::System.Collections.ICollection)primes).get_Count(); j++) { BigInteger bigInteger3 = (BigInteger)primes.get_Item(j); BigInteger bigInteger4 = bigInteger2.Divide(bigInteger3); BigInteger val = bigInteger4.ModInverse(bigInteger3); BigInteger bigInteger5 = bigInteger4.Multiply(val); bigInteger5 = bigInteger5.Multiply((BigInteger)congruences.get_Item(j)); bigInteger = bigInteger.Add(bigInteger5); } return(bigInteger.Mod(bigInteger2)); }
internal static AsymmetricKeyParameter GetNextWorkingKey(global::System.Collections.IList certs, int index) { X509Certificate x509Certificate = (X509Certificate)certs.get_Item(index); AsymmetricKeyParameter publicKey = x509Certificate.GetPublicKey(); if (!(publicKey is DsaPublicKeyParameters)) { return(publicKey); } DsaPublicKeyParameters dsaPublicKeyParameters = (DsaPublicKeyParameters)publicKey; if (dsaPublicKeyParameters.Parameters != null) { return(dsaPublicKeyParameters); } for (int i = index + 1; i < ((global::System.Collections.ICollection)certs).get_Count(); i++) { X509Certificate x509Certificate2 = (X509Certificate)certs.get_Item(i); publicKey = x509Certificate2.GetPublicKey(); if (!(publicKey is DsaPublicKeyParameters)) { throw new PkixCertPathValidatorException("DSA parameters cannot be inherited from previous certificate."); } DsaPublicKeyParameters dsaPublicKeyParameters2 = (DsaPublicKeyParameters)publicKey; if (dsaPublicKeyParameters2.Parameters != null) { DsaParameters parameters = dsaPublicKeyParameters2.Parameters; try { return(new DsaPublicKeyParameters(dsaPublicKeyParameters.Y, parameters)); } catch (global::System.Exception ex) { throw new global::System.Exception(ex.get_Message()); } } } throw new PkixCertPathValidatorException("DSA parameters cannot be inherited from previous certificate."); }
public string[] GetArmorHeaders() { if (((global::System.Collections.ICollection)headerList).get_Count() <= 1) { return(null); } string[] array = new string[((global::System.Collections.ICollection)headerList).get_Count() - 1]; for (int i = 0; i != array.Length; i++) { array[i] = (string)headerList.get_Item(i + 1); } return(array); }
public X509Name(global::System.Collections.IList oids, global::System.Collections.IList values, X509NameEntryConverter converter) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) this.converter = converter; if (((global::System.Collections.ICollection)oids).get_Count() != ((global::System.Collections.ICollection)values).get_Count()) { throw new ArgumentException("'oids' must be same length as 'values'."); } for (int i = 0; i < ((global::System.Collections.ICollection)oids).get_Count(); i++) { ordering.Add(oids.get_Item(i)); this.values.Add(values.get_Item(i)); added.Add((object)false); } }
internal static PkixPolicyNode PrepareNextCertB2(int i, global::System.Collections.IList[] policyNodes, string id_p, PkixPolicyNode validPolicyTree) { int num = 0; global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)Platform.CreateArrayList((global::System.Collections.ICollection)policyNodes[i])).GetEnumerator(); try { while (enumerator.MoveNext()) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)enumerator.get_Current(); if (pkixPolicyNode.ValidPolicy.Equals(id_p)) { PkixPolicyNode parent = pkixPolicyNode.Parent; parent.RemoveChild(pkixPolicyNode); policyNodes[i].RemoveAt(num); for (int num2 = i - 1; num2 >= 0; num2--) { global::System.Collections.IList list = policyNodes[num2]; for (int j = 0; j < ((global::System.Collections.ICollection)list).get_Count(); j++) { PkixPolicyNode pkixPolicyNode2 = (PkixPolicyNode)list.get_Item(j); if (!pkixPolicyNode2.HasChildren) { validPolicyTree = RemovePolicyNode(validPolicyTree, policyNodes, pkixPolicyNode2); if (validPolicyTree == null) { break; } } } } } else { num++; } } return(validPolicyTree); } finally { global::System.IDisposable disposable = enumerator as global::System.IDisposable; if (disposable != null) { disposable.Dispose(); } } }
internal static void ProcessCertD1ii(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier _poid, ISet _pq) { global::System.Collections.IList list = policyNodes[index - 1]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list.get_Item(i); if (ANY_POLICY.Equals(pkixPolicyNode.ValidPolicy)) { ISet set = new HashSet(); set.Add(_poid.Id); PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, _pq, _poid.Id, critical: false); pkixPolicyNode.AddChild(pkixPolicyNode2); policyNodes[index].Add((object)pkixPolicyNode2); break; } } }
public UserAttributePacket(BcpgInputStream bcpgIn) { UserAttributeSubpacketsParser userAttributeSubpacketsParser = new UserAttributeSubpacketsParser((Stream)(object)bcpgIn); global::System.Collections.IList list = Platform.CreateArrayList(); UserAttributeSubpacket userAttributeSubpacket; while ((userAttributeSubpacket = userAttributeSubpacketsParser.ReadPacket()) != null) { list.Add((object)userAttributeSubpacket); } subpackets = new UserAttributeSubpacket[((global::System.Collections.ICollection)list).get_Count()]; for (int i = 0; i != subpackets.Length; i++) { subpackets[i] = (UserAttributeSubpacket)list.get_Item(i); } }
internal static bool ProcessCertD1i(int index, global::System.Collections.IList[] policyNodes, DerObjectIdentifier pOid, ISet pq) { global::System.Collections.IList list = policyNodes[index - 1]; for (int i = 0; i < ((global::System.Collections.ICollection)list).get_Count(); i++) { PkixPolicyNode pkixPolicyNode = (PkixPolicyNode)list.get_Item(i); ISet expectedPolicies = pkixPolicyNode.ExpectedPolicies; if (expectedPolicies.Contains(pOid.Id)) { ISet set = new HashSet(); set.Add(pOid.Id); PkixPolicyNode pkixPolicyNode2 = new PkixPolicyNode(Platform.CreateArrayList(), index, set, pkixPolicyNode, pq, pOid.Id, critical: false); pkixPolicyNode.AddChild(pkixPolicyNode2); policyNodes[index].Add((object)pkixPolicyNode2); return(true); } } return(false); }
public static PgpSecretKeyRing RemoveSecretKey(PgpSecretKeyRing secRing, PgpSecretKey secKey) { global::System.Collections.IList list = Platform.CreateArrayList((global::System.Collections.ICollection)secRing.keys); bool flag = 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.RemoveAt(i); } } if (!flag) { return(null); } return(new PgpSecretKeyRing(list, secRing.extraPubKeys)); }
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)); }