From 8dc6a5023a0a790eafe799873401781f1368373e Mon Sep 17 00:00:00 2001 From: "Ryan X. Charles" Date: Mon, 15 Sep 2014 10:52:32 -0700 Subject: [PATCH] test the case when no fromkeypair is used ...during encryption, and make sure you can still decrypt the message. --- test/ecies.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/test/ecies.js b/test/ecies.js index 8231ae3f0..2effee140 100644 --- a/test/ecies.js +++ b/test/ecies.js @@ -41,6 +41,12 @@ describe('#ECIES', function() { messagebuf2.toString('hex').should.equal(messagebuf.toString('hex')); }); + it('should decrypt that which was encrypted if fromkeypair was randomly generated', function() { + var encbuf = ECIES.encrypt(messagebuf, tokey); + var messagebuf2 = ECIES.decrypt(encbuf, tokey); + messagebuf2.toString('hex').should.equal(messagebuf.toString('hex')); + }); + }); });