Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RSAPKCS1SignatureDeformatter.cs
Go to the documentation of this file.
3
5
6[UnsupportedOSPlatform("browser")]
8{
9 private RSA _rsaKey;
10
11 private string _algName;
12
14 {
15 }
16
18 {
19 if (key == null)
20 {
21 throw new ArgumentNullException("key");
22 }
23 _rsaKey = (RSA)key;
24 }
25
26 public override void SetKey(AsymmetricAlgorithm key)
27 {
28 if (key == null)
29 {
30 throw new ArgumentNullException("key");
31 }
32 _rsaKey = (RSA)key;
33 }
34
35 public override void SetHashAlgorithm(string strName)
36 {
37 if (CryptoConfig.MapNameToOID(strName) != null)
38 {
40 }
41 else
42 {
43 _algName = null;
44 }
45 }
46
47 public override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
48 {
49 if (rgbHash == null)
50 {
51 throw new ArgumentNullException("rgbHash");
52 }
53 if (rgbSignature == null)
54 {
55 throw new ArgumentNullException("rgbSignature");
56 }
57 if (_algName == null)
58 {
60 }
61 if (_rsaKey == null)
62 {
64 }
65 return _rsaKey.VerifyHash(rgbHash, rgbSignature, new HashAlgorithmName(_algName), RSASignaturePadding.Pkcs1);
66 }
67}
static string ToUpper(string hashAlgorithName)
static string Cryptography_MissingOID
Definition SR.cs:116
static string Cryptography_MissingKey
Definition SR.cs:114
Definition SR.cs:7
static ? string MapNameToOID(string name)
override bool VerifySignature(byte[] rgbHash, byte[] rgbSignature)
virtual bool VerifyHash(byte[] hash, byte[] signature, HashAlgorithmName hashAlgorithm, RSASignaturePadding padding)
Definition RSA.cs:75