private static byte[] DecryptFileSignature(byte[] imageBytes) { List <byte[]> certificates = SecondaryExecutableHelper.ExtractCertificates(imageBytes); if (certificates.Count > 0) { byte[] certificateBytes = certificates[0]; byte[] signatureBytes = SecondaryExecutableHelper.ExtractSignature(imageBytes); RSAParameters rsaParameters = CertificateHelper.GetRSAParameters(certificateBytes); byte[] decodedHash = RSAHelper.DecryptSignature(signatureBytes, rsaParameters); return(decodedHash); } else { throw new Exception("According to the header, the file does not contain a certificate"); } }