markus / MarkusAutoUpdate / src / NetSparkle / Interfaces / ISignatureVerifier.cs @ d8f5045e
이력 | 보기 | 이력해설 | 다운로드 (2.91 KB)
1 |
using NetSparkleUpdater.Enums; |
---|---|
2 |
using System; |
3 |
using System.Collections.Generic; |
4 |
using System.Text; |
5 |
|
6 |
namespace NetSparkleUpdater.Interfaces |
7 |
{ |
8 |
/// <summary> |
9 |
/// Interface for objects that can verify a signature for an app cast, a |
10 |
/// downloaded file, or some other item. This is used to verify that the |
11 |
/// correct data was downloaded from the internet and there wasn't any |
12 |
/// nefarious play or manipulation of items when something was delivered |
13 |
/// to the end user. |
14 |
/// </summary> |
15 |
public interface ISignatureVerifier |
16 |
{ |
17 |
/// <summary> |
18 |
/// The <see cref="SecurityMode"/> for the signature verifier. This determines |
19 |
/// the level of security for the application and the items that it downloads |
20 |
/// from the internet. |
21 |
/// </summary> |
22 |
SecurityMode SecurityMode { get; set; } |
23 |
|
24 |
/// <summary> |
25 |
/// Check to see if we have valid public (or other) key information so |
26 |
/// that we can verify signatures properly. |
27 |
/// </summary> |
28 |
/// <returns>true if this object has valid public/other key information |
29 |
/// and can safely verify the signature of a given item; false otherwise</returns> |
30 |
bool HasValidKeyInformation(); |
31 |
|
32 |
/// <summary> |
33 |
/// Verify that the given data has the same signature as the passed-in signature |
34 |
/// </summary> |
35 |
/// <param name="signature">the base 64 signature to validate against dataToVerify's signature</param> |
36 |
/// <param name="dataToVerify">the data that should be used to obtain a signature and |
37 |
/// checked against the passed-in signature</param> |
38 |
/// <returns>the <see cref="ValidationResult"/> result of the verification process</returns> |
39 |
ValidationResult VerifySignature(string signature, byte[] dataToVerify); |
40 |
|
41 |
/// <summary> |
42 |
/// Verify that the file at the given path has the same signature as the passed-in |
43 |
/// signature |
44 |
/// </summary> |
45 |
/// <param name="signature">the base 64 signature to validate against the signature of |
46 |
/// the file at binaryPath</param> |
47 |
/// <param name="binaryPath">the file path to the file whose signature you want to verify</param> |
48 |
/// <returns>the <see cref="ValidationResult"/> result of the verification process</returns> |
49 |
ValidationResult VerifySignatureOfFile(string signature, string binaryPath); |
50 |
|
51 |
/// <summary> |
52 |
/// Verify that the file at the given path has the same signature as the passed-in |
53 |
/// string |
54 |
/// </summary> |
55 |
/// <param name="signature">the base 64 signature to validate against the signature |
56 |
/// of the passed-in string</param> |
57 |
/// <param name="data">the string whose signature you want to verify</param> |
58 |
/// <returns>the <see cref="ValidationResult"/> result of the verification process</returns> |
59 |
ValidationResult VerifySignatureOfString(string signature, string data); |
60 |
} |
61 |
} |