I am learning the basics of eccrypto - JavaScript Elliptic curve cryptography library. I have got the following code from documentation.
var eccrypto = require("eccrypto");
var privateKeyA = eccrypto.generatePrivate();
var publicKeyA = eccrypto.getPublic(privateKeyA);
// Encrypting the message for A.
eccrypto.encrypt(publicKeyA, Buffer.from("msg to a")).then(function (encrypted) {
console.log(encrypted)
// A decrypting the message.
eccrypto.decrypt(privateKeyA, encrypted).then(function (plaintext) {
console.log("Message to part A:", plaintext.toString());
});
});
I am afraid that I can't understand the keys of "encrypted" object properly.
There are four keys in that object : "iv", "ephemPublicKey", "ciphertext" and "mac".
How can I get the cncrypted text from this object in binary format?