private OcspReq GenerateRequest(DerObjectIdentifier signingAlgorithm, AsymmetricKeyParameter privateKey, X509Certificate[] chain, SecureRandom random)
        {
            //IL_018f: Expected O, but got Unknown
            Asn1EncodableVector asn1EncodableVector = new Asn1EncodableVector();

            global::System.Collections.IEnumerator enumerator = ((global::System.Collections.IEnumerable)list).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    RequestObject requestObject = (RequestObject)enumerator.get_Current();
                    try
                    {
                        asn1EncodableVector.Add(requestObject.ToRequest());
                    }
                    catch (global::System.Exception e)
                    {
                        throw new OcspException("exception creating Request", e);
                    }
                }
            }
            finally
            {
                global::System.IDisposable disposable = enumerator as global::System.IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            TbsRequest tbsRequest        = new TbsRequest(requestorName, new DerSequence(asn1EncodableVector), requestExtensions);
            ISigner    signer            = null;
            Signature  optionalSignature = null;

            if (signingAlgorithm != null)
            {
                if (requestorName == null)
                {
                    throw new OcspException("requestorName must be specified if request is signed.");
                }
                try
                {
                    signer = SignerUtilities.GetSigner(signingAlgorithm.Id);
                    if (random != null)
                    {
                        signer.Init(forSigning: true, new ParametersWithRandom(privateKey, random));
                    }
                    else
                    {
                        signer.Init(forSigning: true, privateKey);
                    }
                }
                catch (global::System.Exception ex)
                {
                    throw new OcspException(string.Concat((object)"exception creating signature: ", (object)ex), ex);
                }
                DerBitString derBitString = null;
                try
                {
                    byte[] encoded = tbsRequest.GetEncoded();
                    signer.BlockUpdate(encoded, 0, encoded.Length);
                    derBitString = new DerBitString(signer.GenerateSignature());
                }
                catch (global::System.Exception ex2)
                {
                    throw new OcspException(string.Concat((object)"exception processing TBSRequest: ", (object)ex2), ex2);
                }
                AlgorithmIdentifier signatureAlgorithm = new AlgorithmIdentifier(signingAlgorithm, DerNull.Instance);
                if (chain != null && chain.Length > 0)
                {
                    Asn1EncodableVector asn1EncodableVector2 = new Asn1EncodableVector();
                    try
                    {
                        for (int i = 0; i != chain.Length; i++)
                        {
                            asn1EncodableVector2.Add(X509CertificateStructure.GetInstance(Asn1Object.FromByteArray(chain[i].GetEncoded())));
                        }
                    }
                    catch (IOException val)
                    {
                        IOException e2 = val;
                        throw new OcspException("error processing certs", (global::System.Exception)(object) e2);
                    }
                    catch (CertificateEncodingException e3)
                    {
                        throw new OcspException("error encoding certs", e3);
                    }
                    optionalSignature = new Signature(signatureAlgorithm, derBitString, new DerSequence(asn1EncodableVector2));
                }
                else
                {
                    optionalSignature = new Signature(signatureAlgorithm, derBitString);
                }
            }
            return(new OcspReq(new OcspRequest(tbsRequest, optionalSignature)));
        }