mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2026-08-15 13:04:36 +00:00
login support
This commit is contained in:
parent
e150bd569b
commit
af1485c753
11 changed files with 247 additions and 16 deletions
|
|
@ -65,7 +65,10 @@ namespace MinecraftClient.Protocol.Keys
|
|||
{
|
||||
List<string> datas = new List<string>();
|
||||
datas.Add(Convert.ToBase64String(PublicKey.Key));
|
||||
datas.Add(Convert.ToBase64String(PublicKey.Signature));
|
||||
if (PublicKey.Signature == null)
|
||||
datas.Add(String.Empty);
|
||||
else
|
||||
datas.Add(Convert.ToBase64String(PublicKey.Signature));
|
||||
if (PublicKey.SignatureV2 == null)
|
||||
datas.Add(String.Empty);
|
||||
else
|
||||
|
|
|
|||
|
|
@ -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