mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-11-07 17:36:07 +00:00
login support
This commit is contained in:
parent
e150bd569b
commit
af1485c753
11 changed files with 247 additions and 16 deletions
|
|
@ -10,19 +10,20 @@ namespace MinecraftClient.Protocol.Keys
|
|||
public class PublicKey
|
||||
{
|
||||
public byte[] Key { get; set; }
|
||||
public byte[] Signature { get; set; }
|
||||
public byte[]? Signature { get; set; }
|
||||
public byte[]? SignatureV2 { get; set; }
|
||||
|
||||
private readonly RSA rsa;
|
||||
|
||||
public PublicKey(string pemKey, string sig, string? sigV2 = null)
|
||||
public PublicKey(string pemKey, string? sig = null, string? sigV2 = null)
|
||||
{
|
||||
this.Key = KeyUtils.DecodePemKey(pemKey, "-----BEGIN RSA PUBLIC KEY-----", "-----END RSA PUBLIC KEY-----");
|
||||
|
||||
this.rsa = RSA.Create();
|
||||
rsa.ImportSubjectPublicKeyInfo(this.Key, out _);
|
||||
|
||||
this.Signature = Convert.FromBase64String(sig);
|
||||
if (!string.IsNullOrEmpty(sig))
|
||||
this.Signature = Convert.FromBase64String(sig);
|
||||
|
||||
if (!string.IsNullOrEmpty(sigV2))
|
||||
this.SignatureV2 = Convert.FromBase64String(sigV2!);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue