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];