From e384fdd946147b981247385d3725b20bdf2ebdb1 Mon Sep 17 00:00:00 2001 From: Lucas Teske Date: Thu, 17 Jan 2019 16:55:50 -0200 Subject: [PATCH] Hot fix for keys not being loaded --- RemoteSigner/KeyRingManager.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/RemoteSigner/KeyRingManager.cs b/RemoteSigner/KeyRingManager.cs index 1a4008e..2f0d13e 100644 --- a/RemoteSigner/KeyRingManager.cs +++ b/RemoteSigner/KeyRingManager.cs @@ -39,7 +39,7 @@ public void AddKey(string publicKey, bool nonErasable = false) { public void AddKey(PgpPublicKey publicKey, bool nonErasable = false) { - var fingerPrint = Tools.H16FP(publicKey.GetFingerprint().ToHexString()); + var fingerPrint = Tools.H16FP(publicKey.KeyId.ToString("X16")); if (!publicKeys.ContainsKey(fingerPrint)) { publicKeys[fingerPrint] = publicKey; FP8TO16[Tools.H8FP(fingerPrint)] = fingerPrint; @@ -78,6 +78,12 @@ public PgpPublicKey GetKey(string fingerPrint) { return null; } AddKey(key); + using (var s = Tools.GenerateStreamFromString(key)) { + var pgpPub = new PgpPublicKeyRing(PgpUtilities.GetDecoderStream(s)); + foreach (PgpPublicKey pubKey in pgpPub.GetPublicKeys()) { + return pubKey; + } + } } return fingerPrint.Length == 8 ? publicKeys[FP8TO16[fingerPrint]] : publicKeys[fingerPrint];