Mono.Cecil.CryptoService.CreateStrongName C# (CSharp) Method

CreateStrongName() static private method

static private CreateStrongName ( StrongNameKeyPair key_pair, Array hash ) : byte[]
key_pair StrongNameKeyPair
hash Array
return byte[]
		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;
			}
		}

Usage Example

示例#1
0
        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);
        }