mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
Refactoring to asynchronous. (partially completed)
This commit is contained in:
parent
7ee08092d4
commit
096ea0c70c
72 changed files with 6033 additions and 5080 deletions
|
|
@ -1,15 +1,26 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text.Json.Serialization;
|
||||
using MinecraftClient.Protocol.Message;
|
||||
|
||||
namespace MinecraftClient.Protocol.ProfileKey
|
||||
{
|
||||
public class PublicKey
|
||||
{
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("Key")]
|
||||
public byte[] Key { get; set; }
|
||||
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("Signature")]
|
||||
public byte[]? Signature { get; set; }
|
||||
|
||||
[JsonInclude]
|
||||
[JsonPropertyName("SignatureV2")]
|
||||
public byte[]? SignatureV2 { get; set; }
|
||||
|
||||
[JsonIgnore]
|
||||
private readonly RSA rsa;
|
||||
|
||||
public PublicKey(string pemKey, string? sig = null, string? sigV2 = null)
|
||||
|
|
@ -36,6 +47,12 @@ namespace MinecraftClient.Protocol.ProfileKey
|
|||
Signature = signature;
|
||||
}
|
||||
|
||||
[JsonConstructor]
|
||||
public PublicKey(byte[] Key, byte[]? Signature, byte[]? SignatureV2) : this(Key, Signature!)
|
||||
{
|
||||
this.SignatureV2 = SignatureV2;
|
||||
}
|
||||
|
||||
public bool VerifyData(byte[] data, byte[] signature)
|
||||
{
|
||||
return rsa.VerifyData(data, signature, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue