Exemplo n.º 1
0
        private static void TamperSignature(string packageFilePath)
        {
            var packageSignature = ReadPackageSignature(packageFilePath);
            var randomBytes      = new byte[packageSignature.Length];

            using (var rng = RandomNumberGenerator.Create())
            {
                rng.GetBytes(randomBytes);
            }

            var fileBytes    = File.ReadAllBytes(packageFilePath);
            var newFileBytes = SignatureTestUtility.FindAndReplaceSequence(
                fileBytes,
                packageSignature,
                randomBytes);

            File.WriteAllBytes(packageFilePath, newFileBytes);
        }