Fix all warnings & Trim (#2226)

* Fix AutoFishing crash
* Fix all warnings
* Remove DotNetZip.
* Fix the usage of HttpClient.
This commit is contained in:
BruceChen 2022-10-02 18:31:08 +08:00 committed by GitHub
parent 4aa6c1c99f
commit 1d52d1eadd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
227 changed files with 2201 additions and 43564 deletions

View file

@ -1,9 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Threading.Tasks;
using MinecraftClient.Protocol.Message;
namespace MinecraftClient.Protocol.Keys
@ -18,26 +14,26 @@ namespace MinecraftClient.Protocol.Keys
public PublicKey(string pemKey, string? sig = null, string? sigV2 = null)
{
this.Key = KeyUtils.DecodePemKey(pemKey, "-----BEGIN RSA PUBLIC KEY-----", "-----END RSA PUBLIC KEY-----");
Key = KeyUtils.DecodePemKey(pemKey, "-----BEGIN RSA PUBLIC KEY-----", "-----END RSA PUBLIC KEY-----");
this.rsa = RSA.Create();
rsa.ImportSubjectPublicKeyInfo(this.Key, out _);
rsa = RSA.Create();
rsa.ImportSubjectPublicKeyInfo(Key, out _);
if (!string.IsNullOrEmpty(sig))
this.Signature = Convert.FromBase64String(sig);
Signature = Convert.FromBase64String(sig);
if (!string.IsNullOrEmpty(sigV2))
this.SignatureV2 = Convert.FromBase64String(sigV2!);
SignatureV2 = Convert.FromBase64String(sigV2!);
}
public PublicKey(byte[] key, byte[] signature)
{
this.Key = key;
Key = key;
this.rsa = RSA.Create();
rsa.ImportSubjectPublicKeyInfo(this.Key, out _);
rsa = RSA.Create();
rsa.ImportSubjectPublicKeyInfo(Key, out _);
this.Signature = signature;
Signature = signature;
}
public bool VerifyData(byte[] data, byte[] signature)