public static
bool
CheckSignature(byte[] signature, string data)
{
SHA1 sha
=
SHA1.Create();
byte[] array
=
sha.ComputeHash(Encoding.ASCII.GetBytes(data));
Console.WriteLine(data);
RSACryptoServiceProvider rsacryptoServiceProvider
=
new RSACryptoServiceProvider();
RSAParameters rsaparameters
=
default(RSAParameters);
byte[] array2
=
new byte[]
{
155
,
64
,
150
,
8
,
101
,
9
,
158
,
124
,
124
,
67
,
41
,
161
,
162
,
244
,
234
,
125
,
226
,
134
,
19
,
167
,
246
,
47
,
217
,
227
,
30
,
5
,
115
,
17
,
212
,
95
,
221
,
70
,
169
,
100
,
174
,
134
,
108
,
55
,
117
,
116
,
78
,
57
,
221
,
72
,
241
,
158
,
142
,
251
,
115
,
219
,
1
,
50
,
70
,
181
,
181
,
69
,
70
,
97
,
78
,
181
,
230
,
35
,
99
,
106
,
37
,
91
,
105
,
81
,
182
,
22
,
47
,
63
,
232
,
148
,
116
,
214
,
172
,
117
,
226
,
190
,
56
,
137
,
148
,
69
,
23
,
111
,
53
,
198
,
102
,
23
,
byte.MaxValue,
196
,
172
,
117
,
84
,
145
,
0
,
152
,
39
,
48
,
219
,
197
,
160
,
134
,
222
,
74
,
57
,
232
,
35
,
213
,
220
,
65
,
168
,
149
,
55
,
178
,
196
,
140
,
207
,
225
,
109
,
69
,
63
,
172
,
148
,
162
,
43
,
13
};
byte[] array3
=
new byte[] {
1
,
0
,
1
};
rsaparameters.Modulus
=
array2;
rsaparameters.Exponent
=
array3;
rsacryptoServiceProvider.ImportParameters(rsaparameters);
RSAPKCS1SignatureDeformatter rsapkcs1SignatureDeformatter
=
new RSAPKCS1SignatureDeformatter(rsacryptoServiceProvider);
rsapkcs1SignatureDeformatter.SetHashAlgorithm(
"SHA1"
);
bool
flag
=
rsapkcs1SignatureDeformatter.VerifySignature(array, signature);
bool
flag2;
if
(flag)
{
Console.WriteLine(
"The signature is valid."
);
flag2
=
true;
}
else
{
Console.WriteLine(
"The signature is not valid."
);
flag2
=
false;
}
return
flag2;
}