public bool ValidateSignature(Signature signature, byte[] bytes)
        {
            bool                     valid     = false;
            KeyInfo                  keyInfo   = signature.KeyInfo;
            CspParameters            parameter = new CspParameters();
            RSACryptoServiceProvider rsa;
            DSACryptoServiceProvider dsa;
            XmlElement               KeyInfoXml = keyInfo.GetXml();
            Type                     type       = keyInfo.GetType();

            if (KeyInfoXml.FirstChild.FirstChild.Name.Equals("RSAKeyValue"))
            {
                rsa = new RSACryptoServiceProvider(parameter);
                rsa.FromXmlString(keyInfo.GetXml().InnerXml);
                RSAParameters param            = rsa.ExportParameters(false);
                byte[]        digestSignedInfo = this.DigestElement(signature.SignedInfo.GetXml(), "", "");
                XmlElement    signed           = signature.SignedInfo.GetXml();
                string        oid = CryptoConfig.MapNameToOID("SHA1");
                valid = rsa.VerifyHash(digestSignedInfo, oid, this._signedXml.SignatureValue);
            }
            else
            {
                dsa = new DSACryptoServiceProvider(parameter);
                dsa.FromXmlString(KeyInfoXml.InnerXml);
                byte[] digestSignedInfo = this.DigestElement(signature.SignedInfo.GetXml(), "", "");
                string oid = CryptoConfig.MapNameToOID("SHA1");
                valid = dsa.VerifyHash(digestSignedInfo, oid, this._signedXml.SignatureValue);
            }
            return(valid);
        }