Mono.Helper.CheckFileIntegrity C# (CSharp) Метод

CheckFileIntegrity() публичный статический Метод

public static CheckFileIntegrity ( string filename ) : bool
filename string
Результат bool
		public static bool CheckFileIntegrity (string filename)
		{
			if (filename == null)
				return false;

			byte [] hash = null;
			RSA rsa = CryptoConvert.FromCapiKeyBlob (codec_public_key_blob);

			byte [] signature = new byte [128];
			using (FileStream fs = File.OpenRead (filename)) {
				if (!IsSigned (fs))
					return false;

				hash = HashStream (fs, (int) fs.Length - 132);

				fs.Seek (-128, SeekOrigin.End);
				if (fs.Read (signature, 0, 128) != 128)
					return false;
			}

			RSAPKCS1SignatureDeformatter def = new RSAPKCS1SignatureDeformatter (rsa);
			def.SetHashAlgorithm ("SHA1");
			return def.VerifySignature (hash, signature);
		}
#endif