static byte [] CreateStrongName (StrongNameKeyPair key_pair, byte [] hash) { const string hash_algo = "SHA1"; using (var rsa = key_pair.CreateRSA ()) { var formatter = new RSAPKCS1SignatureFormatter (rsa); formatter.SetHashAlgorithm (hash_algo); byte [] signature = formatter.CreateSignature (hash); Array.Reverse (signature); return signature; } }
public static void StrongName(Stream stream, ImageWriter writer, StrongNameKeyPair key_pair) { int num; byte[] numArray = CryptoService.CreateStrongName(key_pair, CryptoService.HashStream(stream, writer, out num)); CryptoService.PatchStrongName(stream, num, numArray); }