Add doublecheck for EncryptMessageForSelf
authorThomas
Mon, 30 Nov 2020 12:35:22 +0100
changeset 3354 886a5855f5ef
parent 3353 dc0b43f80e2e
child 3355 a9d1f2d7110c
Add doublecheck for EncryptMessageForSelf
MsgProcessor.cs
--- a/MsgProcessor.cs	Mon Nov 30 10:00:23 2020 +0100
+++ b/MsgProcessor.cs	Mon Nov 30 12:35:22 2020 +0100
@@ -761,6 +761,13 @@
                     }
                 }
 
+                // Doublecheck to make sure the From identity is an own identity
+                if (PEPSettings.GetIsOwnAccount(targetIdentity) == false)
+                {
+                    Debug.Fail("Target identity isn't an own identity");
+                    throw new Exception("From identity in source message isn't an own identity");
+                }
+
                 AdapterExtensions.ExecuteWithPassphraseCheck(() => ThisAddIn.PEPEngine.EncryptMessageForSelf(targetId, src, extraKeys, out dst));
                 success = true;
             }