npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

stringmanolo-erk

v0.1.0

Published

Cryptography for DarkMessenger: Secure end-to-end encryption and message authentication.

Downloads

11

Readme

DarkMessenger: Secure End-to-End Encryption and Message Authentication

This documentation provides an overview of the cryptographic modules used in DarkMessenger. Each module implements a different encryption method, ensuring a robust and multi-layered approach to security.

ERK Module (crypto_modules/ERK_module.js)

Combines functionalities from ECIES, RSA, and KYBER modules into a unified cryptography module.

Purpose:

  • Provides a comprehensive encryption framework leveraging multiple cryptographic algorithms.
  • Facilitates secure key generation, encryption, and decryption using ECIES, RSA, and KYBER methods.

Functionality:

  • ECIES Integration:

    • Exports: ECIES_priv_key, ECIES_pub_key, ECIES_encrypt, ECIES_decrypt
    • Implements: Elliptic Curve Integrated Encryption Scheme (ECIES) using the P-521 curve.
  • RSA Integration:

    • Exports: RSA_priv_key, RSA_pub_key, RSA_encrypt, RSA_decrypt
    • Implements: RSA encryption with 2048-bit keys and hex codification for PEM.
  • KYBER Integration:

    • Exports: KYBER_priv_key, KYBER_pub_key, KYBER_encrypt, KYBER_decrypt
    • Implements: Post-quantum encryption using the Kyber1024 KEM algorithm.

Usage:

// npm install "stringmanolo-erk", 

#!/usr/bin/env node

import {
  ECIES_priv_key, ECIES_pub_key, ECIES_encrypt, ECIES_decrypt,
  RSA_priv_key, RSA_pub_key, RSA_encrypt, RSA_decrypt,
  KYBER_priv_key, KYBER_pub_key, KYBER_encrypt, KYBER_decrypt
} from "stringmanolo-erk";

const plaintext = "Hello, World!";

// Show ouput
const debug = (algo, plaintext, encrypted, decrypted) => {
  console.log(`Data: [${plaintext}]
${algo}_encrypted: [${JSON.stringify(encrypted, null, 2)}]
${algo}_decrypted: [${decrypted}]
`);
};


/* [ START ECIES ] */
/* BOB generated it's keys a couple days ago using:
 * const bob_pub_key = ECIES_pub_key();
 * const bob_priv_key = ECIES_priv_key();
*/
// Bob keys
const bob_ECIES_pub_key = "0401c6ee9cd97ce8790cb1554551894c7ab8f51c8c64b2d90424f831ab02f4537843a0de9cef9ac8ff4de6a4fc6bb38f34a9369993dfe31b22720fe10250780daceedf00d12f021e52441f72d558c89ecf99bab8c955c6ac7cbbb38fc0bb01648acae45c9894c2ec645544ed802ef1e8d785a910f56ddd9e54a1cc9c012be283aa51b93cac";
const bob_ECIES_priv_key = "021f2ae7ba7f30a7a9726bfeeab9a45d8e8e60b9a4d98591c3adcd465bc160992d75e6f412186faf60f5bb7ea1d89cda0535356235177d62f101d853040b885fe5";

/* ALICE generated her publicKey today using:
 * const publicKey = ECIES_pub_key();
*/
const { ciphertext, iv, tag, publicKey } = ECIES_encrypt(plaintext, bob_ECIES_pub_key);
const decryptedText = ECIES_decrypt(ciphertext, iv, tag, publicKey, bob_ECIES_priv_key);

debug("ECIES", plaintext, { ciphertext, iv, tag, publicKey }, decryptedText);
/* [ END ECIES ] */


/* [ START RSA ] */
/* BOB generated it's keys a couple days ago using:
 * const bob_RSA_pub_key = RSA_pub_key();
 * const bob_RSA_priv_key = RSA_priv_key();
*/
// Bob keys
const bob_RSA_pub_key = "30820122300d06092a864886f70d01010105000382010f003082010a0282010100bae4a70f90ebff858e6549b1b4d088310fd97b3fa0d1a14f9a929e2a6bb02e4e8af1faa236ef2b43a066743025c6ef83f776b09dddcc5a13198563d26dab6ae10a78f53cd40d0bd9102e303e331b2cedd6941503bab7600c19594322ebd7d691debfd472d4f150701bd3c1eecb7af30a8117169178d9afdb77acd1d3cf9c38fd7e4c62dafd3ea39c822fbee7570eec6fc0e43ec6e067dd186fd6592ce772a30bde2e07a1a0c1d491ff4a03acf1347f7af021a91c00a79bddfaf2b1bc2476dd0fa288b824560a870e55b27e1f637a838288524be9c48a8c7cad6ef1fff87d8bf5c5c913747174939a06051fa15c449578ee95222ce0fdc88e679b949a8d21e2a50203010001";
const bob_RSA_priv_key = "308204a40201000282010100bae4a70f90ebff858e6549b1b4d088310fd97b3fa0d1a14f9a929e2a6bb02e4e8af1faa236ef2b43a066743025c6ef83f776b09dddcc5a13198563d26dab6ae10a78f53cd40d0bd9102e303e331b2cedd6941503bab7600c19594322ebd7d691debfd472d4f150701bd3c1eecb7af30a8117169178d9afdb77acd1d3cf9c38fd7e4c62dafd3ea39c822fbee7570eec6fc0e43ec6e067dd186fd6592ce772a30bde2e07a1a0c1d491ff4a03acf1347f7af021a91c00a79bddfaf2b1bc2476dd0fa288b824560a870e55b27e1f637a838288524be9c48a8c7cad6ef1fff87d8bf5c5c913747174939a06051fa15c449578ee95222ce0fdc88e679b949a8d21e2a502030100010282010002ee2d616784ba71af667955eae4c9d1e272a6f05136f592cadf697bf6f5765069ca2558d048313de2f60af480a477cd1cfef48226801059d42607873d36cec59f0aaa510d191eefafc582f64d5fabcac1e3cf58358aafb1438a27023fea41e01bd041b0ed93a80ecdf23a21a2a3f7a0c3f3e6f91a7392ad3c03e4195b06bdccfd85f0f15ad99fccd2c5eb43c82375993c712b304423fce9b7f6132664fd9ddec23ec165b678509a721bd07502e66f3ab31628729bc3a89893a7a4f019bf30d8a2d35cb38b3c13b34b8feb6d9fd9546192b45197ae796f788c530f23d6b99a3c432629119e972b353763d5b7bf3f7ea358863c918b958c632591e047f584133902818100e341a3216dc3e52686e929f81170e46a927adf440d46f6a3ab8d86d88f6025e65260d2ca5548d2d26e0f90b65ba567ee0ce260732aaf48fee8cdc9a31285733a091a18a77bf29261cfd5c3f0014441922b0ab275062434ac8c2239271253b05a24c30029e41c74b56d730b1ba1d388e8ea658a66ee10993009d199ab3ed2818902818100d28816f323d1dc24154a6f0f04b36b055105cb06ad47e01d3ac13f54a97389c788a4758f59bfc8525584a1a299eea4563008f1d03fc320ccdd10f959f156a3dcb2bd672ff86513be353739ba4eb00621811e6b58b33e2f4ad07e3ec223319c877527a744139d631432550ef578874a97fd5079b42e673e844e8b81c665489d3d02818100d4d770b5aa5c428e26e4d1cde867d74689125371250e45895cef1c504f5839a6d198a553a334a55f387d938777a61f04b1448418d8ed7a6c6415f8b7a66d1e52489c0c63308f2bd23819797d9b72160794105cbb8598fb4c6fa2cdec6e19bb9d71b8c0ba7b4ebb7000a632cd1a6f4856fcd14522c9ecf9cc28260aca7bf8242102818100aca772babf5b71c01dbdc74a77be743c0df0444a1b7d606c582cf735052a7d89a7a3c7cd61fb07db8dca918bf9d55dec58c45d1b3dcf566cebb6e9e73b26a487700628438cdfc7cb2b7538e0737ba3eb822a623a81f4b37015801313bf2d0683882e96dc1b81ed293905cc98bed9a4f0f48b34e3f1523650e6e13df268499eb9028180583efe7ebaab57806dffde24feb18afb03f30fb5f716a6cf39d0a0d14935e8482115701a075d33a44157c8fc32399656cd291bcdfeb78357b803285be9bf7b1f9e97817f50dd5a83f62dbc5ab55e34f31d231422d3a182bf497014aec4cbfc1606499d8de578b9dd9d56f2bf11339428a0910ebe697345b72db7e759458174da";

const { RSA_ciphertext, RSA_iv, RSA_tag, RSA_publicKey } = RSA_encrypt(plaintext, bob_RSA_pub_key);
const RSA_decryptedText = RSA_decrypt(RSA_ciphertext, RSA_iv, RSA_tag, RSA_publicKey, bob_RSA_priv_key);

debug("RSA", plaintext, { RSA_ciphertext, RSA_iv, RSA_tag, RSA_publicKey }, RSA_decryptedText);
/* [ END RSA ] */


/* [ START KYBER ] */
/* BOB generated it's keys a couple days ago using:
 * const bob_KYBER_pub_key = KYBER_pub_key;
 * const bob_KYBER_priv_key = KYBER_priv_key;
*/
// Bob keys
const bob_KYBER_pub_key = "5f14a19db08f60b5bfd2390c3508a9672574784575611bb28c387a6eea01d6c164314b7cb59ca7c9396a26b143772680c749056e8b56a0037e27d0266d8242ea451c6509668eeb52c9f5bd17754885c2c7ee53b139e292a2184b0f207e43b13162f5cfd86286b0d961a889450705a5b8130fc89466f5234c7970aa99db28e656acbd983184d9956ef25bfa1269ecd08ae3118108b167c28a9dc9d26a177376ea09c029985cfed78b9769a146c89e788a9f34e49134b6102059267178a97be57f0c19a1f5801ca017ab944146cce4918d1c0000a9878d55a26233c77529c6cfc1cb9bb20428770ef9083e88c90081b46d1fd17386d4233c347855921842861218d687f7861ec2996e20a3c5b10664f4c19dd58963482128b13756e9b49290a0c0a303156ac84556aac136dcb47f5bb6d6fc66b851a2c7442cf0763a40cb09f2f8393f4aa525b293c2a54292361ce139616f41913a70afc38a28ad492003ea9c3763a2c3c112f743806bcb0bebba79a06855bc1a8535b2b742459efb84cbb0b6052593881101730ae6085ea8690a84228b7135df3ac159531308635bc03b8cfd76cced9318da21c8447a172ba3895e965075d1056d39344e6582fda048c6961cee99641b2b16c41bb9c5e9be36c179a8b66769eab80fa42f7ab8595cf6ac8669a42444416b78061f285a0a3a700166015593ca6ec68e2c0aa5921aa231512d0886492619c3fc2c6c6ef422c343518645379409aae7b2af16a202b94936e8e455d09c972c94c424293766a46e50e7189e24b4e67a93923506033958622a3264cb3b4fdb9643c776823a3002d39d9a794cb8082803196ff7b926b126739f45246110a2221784b115bd277c2d6e4487c3ebab065cb43e7c9287fca99fa395270b01a70a427b37615f1712093a3b67160be8a7c4b1309f45e59cb1e45adc582b9c3c002bec94ccdbc69d000ed852acfe543f495759141794fbcccc771aa3251c29cabc2c70a022c0f0b722f9890186c00072999be657727989a16069f74b3ae9601d6669b07eb07c317373db93445d62c7da96b324f520dd65720c6cae6eb9bff2400dcc0aa2e86585b4807531b1713fd04f8154838718b616b8706f12abd9430df755a00c5c9b34b735d6b65d59696aef0508b28a1bf702762248ac91f0062ba8cdc4f43991262b046266e3f71c0477837d5bafe9e961b1a78cac6c95f930518465c70b69888b83cd9db05662104b45ab9fe8f1ccf18b45deb23f8622c3fefb24aa362ae981b48eeac1b6182649b8a77fd50b1a5a042ac22117524b2f526881a6943701586390101919352e5a1a24cc8841139349524676360276f01814841ddd72b8406783298434dc40b91a087e9da689fda0cf02b3512653cd480c525b4a10ab34c67c179981791cde14a0c9a0843b6b331a171f99eb05aa9218ae71590af02d1c4b989459c2430689f8c907ebc344cee11ef6b602610a9c7694afc61625c59031ac517774b275be684885957699b35a9c571e3a4839fd722d41d6cf2f337bc71793d8f74f4e90922755a764856922f149e5e61917e4b6f4d8aa231541a017acf928cd337253604a09d53716bb20b99857038de79858ca28afb74f5c490bed891ba8b2a3f41817efe83cea506dca3ba8594b23b4b36f3ffa36e2490ba69aabb5c09a0ea505f361188fd25ab7c7b0ffa70296d4cd80e98a7837c60522cfe456c3c4c24a4131080e24ab74567253173598fc27ae850a74a828f02c2de256a6ad8401d3d6bc1ffa0987b9a0a0176b945579d3fcb9b00c758543836c92cb5ef11aac83ae360496cd561ccfd831bed298c7c8711be94c1a4432f72247abb811f58b9db4d12490276843d22952343c7ab1637c771ff8ab849789383347cc2f06b0b21ab5373199a149acae819b07f0b8b5f4a46c029264bb5ef4ec9d3cba7620d8a3f8226a4997101dd97eefa4333c82c73289794bc52662f401c9bc148f130464310c319587ed0a0efe2b5f0de4c82d313bc9089dcf328df4a3862cc435b46b87976b8c14fb5a2dc5b64f4074ce8203452b67b21cce3bb987541aab11b84421628c6ea249aec08dbef03dcca9a79b604443e186298792732b5009ab8bf0d0930b1588935151bab7702a409c8b566d0081c48c7800186646295c4c221cc89d0047bb445c1976ad9b8c6e671742b0f6ea7598ec03cb865f3800318acd1d8e95ec69059e1e";
const bob_KYBER_priv_key = "1deba582b4860658440e52213f831177f708d3f9be346707f5432b62a28edd4207be83c63583c11b4466aed1b2ec8052ebd900be2794696c10774081b05ba0a2b58ef44507750223bf128934204f13750e3bc26d25bb6789f22ae66b41500342df96b08a970827341c958132bf3bc40fe44f1af925d245728361921baaa8b5aba18b3252a981b55c24204b38b6aea871dba4ce126a03c28894ce235fa25bc1470598af5201e460a4194ab2f9b6267bd2973d5a0860533406c22c42872a606508ee02c276292db80aa3b85a463e7340a206083f2370f08507132607af587a0721497aca15a9067ac3e02f9a915a46819093cca12f693e3a2654e8d6964cb6652a5acc1de837395921ee898a513726fa87489dca23f2526ef5a77bc1881ffa86553fb5a15aa38dfa23587180c5d46a290113320ab77656f0cd42416ba8f614996140faeb4f74c34e379a959916a4ff5cae29452afcf3adbfabcc4728198b778958a6c159a23e29448d7974319bf235c740637deac80dc9bff694872c7c2857e913e5080907eb09bb154067c492be6bc0a20aa83cac7c551177a8e0532a486cb5c5a78df3238464cf49e509e5497bc5c971ec7b2af10c83cf83a7a278a533678cfd1c6de1d77822b515a0b11b14b8182d51c790c09d12144f86624d43a2a3daf3372c4636a574911b9a2c4e85b5e0262b56d4054f210108da3d0fc6a06244ae8993120d11546a59a5ae27a7bd82c6df4660e272271c55983362221d80ab15bc52a6b5b6031b39beaa0f3d14722f08622d6ba251466b9d23c4a03c78ba217ba0698fabc10f3e413981e662e11136436219a2e9a57ffca936772956f2a4080b8500d8b2553a3e3dc9696a8608d6aab1f761836ae2bd96b0b996793283aa52ac08bdbab9853ec6153e05b22adb49189129bb0415636b2156b9776937b9ceec47ed185ba5d72bfdd05a4ba77fc22654310372f886c53569a9c55936b264721bd1a4cb9b22bc316fc98796b6330c78f37fc40ba191665a764243cf3231d327c6c859cb8408b4e4a3cc36d04289a6a3cee1212b5582f454b228eab81ef95720444714982ac2a8686a68413fe238acf4cc766187b05ab56b830d988233d29542d6e588ffbc243ad56bf9aa3c76e8c440092c889849b0ac809578608bfb8ad235af1a2ab7968524d3e6c694897878dc7024125136bb3c17c85e1be40999943326e6c7f6a468a178c821d0521ec9462ac928c2b6c9452bc600175a0fa41ee5565992e5327b91c6ec147a1753977fd187a922abb5874e4c128e431ba9b1179557c2572de6b08c911b115a1513e1a4baf8a6a79c8d86951cf9b62a5cc8534fd40f14d4b2929c4c2c51675c8acd876ac6c6bcb2e82a1c3f37b3c4981c366cab894cca08449cf51710b1a7b9761a086b6675712a591a34022363588cab0b03c329b2d70437366a49d5c2d5ec5453a11e6fd9bd9209bb555c9d19a8494f900a2c9c63d601bdffa16d73e608e2427c9c83a4eb88910fe4918ff11862495f6b017263f2937dd144fe89b47494af0dcbbbea03417979485654a4d232446b565b244cadf9b40b61eba123c32b1c888b8642b23381a7200ba92cb7903ca3731b0444f2ab58835047d398cc3977367dd8a69ce471b6e08c68bc6ed6253fdc9bbf0e2921a7e382f66a9cd59b08bb010167d445b38383b62c38acb4c3676215ce1aacac5310e01a360a7792802c5009f34eb4c3802a3b4f0bd26fc3e2c0b2676226a51f0d37529e198fd5628a05426a3376cb72cc4469800bd19659bbe51c48b3260086be17074f4330c262e440ad64c94e82323d220a34f02548a6003f17602e7cb13f326116a52edfc5c5020444db166d0ce48612743f0d47cd11602788953ffbd3911fd6a0fe37137b68c73b36af83dccc35a0a8dc2aa83aaa172c991c3cc6a1c6b0592af736833cc5d511abf765cf0190be1347117d053f37244ea5ba04a20a0e1e598e65884ff72197495820eab89889422e0fb856823c89b711579035521d19ce48e43181664de5d96c8cd0a36cd064cb57c645d07499f126bb19c7ce4b5687c10f48739baf70cf3e649196e021b9f456aab7ae4d35151239c6cf7077b8244b19458564b64c0127b383651f00a4c6f1859202bb723a848ecf783bd393c8b4dc58502a3e68e34bc518135f14a19db08f60b5bfd2390c3508a9672574784575611bb28c387a6eea01d6c164314b7cb59ca7c9396a26b143772680c749056e8b56a0037e27d0266d8242ea451c6509668eeb52c9f5bd17754885c2c7ee53b139e292a2184b0f207e43b13162f5cfd86286b0d961a889450705a5b8130fc89466f5234c7970aa99db28e656acbd983184d9956ef25bfa1269ecd08ae3118108b167c28a9dc9d26a177376ea09c029985cfed78b9769a146c89e788a9f34e49134b6102059267178a97be57f0c19a1f5801ca017ab944146cce4918d1c0000a9878d55a26233c77529c6cfc1cb9bb20428770ef9083e88c90081b46d1fd17386d4233c347855921842861218d687f7861ec2996e20a3c5b10664f4c19dd58963482128b13756e9b49290a0c0a303156ac84556aac136dcb47f5bb6d6fc66b851a2c7442cf0763a40cb09f2f8393f4aa525b293c2a54292361ce139616f41913a70afc38a28ad492003ea9c3763a2c3c112f743806bcb0bebba79a06855bc1a8535b2b742459efb84cbb0b6052593881101730ae6085ea8690a84228b7135df3ac159531308635bc03b8cfd76cced9318da21c8447a172ba3895e965075d1056d39344e6582fda048c6961cee99641b2b16c41bb9c5e9be36c179a8b66769eab80fa42f7ab8595cf6ac8669a42444416b78061f285a0a3a700166015593ca6ec68e2c0aa5921aa231512d0886492619c3fc2c6c6ef422c343518645379409aae7b2af16a202b94936e8e455d09c972c94c424293766a46e50e7189e24b4e67a93923506033958622a3264cb3b4fdb9643c776823a3002d39d9a794cb8082803196ff7b926b126739f45246110a2221784b115bd277c2d6e4487c3ebab065cb43e7c9287fca99fa395270b01a70a427b37615f1712093a3b67160be8a7c4b1309f45e59cb1e45adc582b9c3c002bec94ccdbc69d000ed852acfe543f495759141794fbcccc771aa3251c29cabc2c70a022c0f0b722f9890186c00072999be657727989a16069f74b3ae9601d6669b07eb07c317373db93445d62c7da96b324f520dd65720c6cae6eb9bff2400dcc0aa2e86585b4807531b1713fd04f8154838718b616b8706f12abd9430df755a00c5c9b34b735d6b65d59696aef0508b28a1bf702762248ac91f0062ba8cdc4f43991262b046266e3f71c0477837d5bafe9e961b1a78cac6c95f930518465c70b69888b83cd9db05662104b45ab9fe8f1ccf18b45deb23f8622c3fefb24aa362ae981b48eeac1b6182649b8a77fd50b1a5a042ac22117524b2f526881a6943701586390101919352e5a1a24cc8841139349524676360276f01814841ddd72b8406783298434dc40b91a087e9da689fda0cf02b3512653cd480c525b4a10ab34c67c179981791cde14a0c9a0843b6b331a171f99eb05aa9218ae71590af02d1c4b989459c2430689f8c907ebc344cee11ef6b602610a9c7694afc61625c59031ac517774b275be684885957699b35a9c571e3a4839fd722d41d6cf2f337bc71793d8f74f4e90922755a764856922f149e5e61917e4b6f4d8aa231541a017acf928cd337253604a09d53716bb20b99857038de79858ca28afb74f5c490bed891ba8b2a3f41817efe83cea506dca3ba8594b23b4b36f3ffa36e2490ba69aabb5c09a0ea505f361188fd25ab7c7b0ffa70296d4cd80e98a7837c60522cfe456c3c4c24a4131080e24ab74567253173598fc27ae850a74a828f02c2de256a6ad8401d3d6bc1ffa0987b9a0a0176b945579d3fcb9b00c758543836c92cb5ef11aac83ae360496cd561ccfd831bed298c7c8711be94c1a4432f72247abb811f58b9db4d12490276843d22952343c7ab1637c771ff8ab849789383347cc2f06b0b21ab5373199a149acae819b07f0b8b5f4a46c029264bb5ef4ec9d3cba7620d8a3f8226a4997101dd97eefa4333c82c73289794bc52662f401c9bc148f130464310c319587ed0a0efe2b5f0de4c82d313bc9089dcf328df4a3862cc435b46b87976b8c14fb5a2dc5b64f4074ce8203452b67b21cce3bb987541aab11b84421628c6ea249aec08dbef03dcca9a79b604443e186298792732b5009ab8bf0d0930b1588935151bab7702a409c8b566d0081c48c7800186646295c4c221cc89d0047bb445c1976ad9b8c6e671742b0f6ea7598ec03cb865f3800318acd1d8e95ec69059e1e45cb6ce709c8ff5d60d5c3fdfd981c7be9f628c0ab1977544e28aca936484e0085a70a4548575ad598ed29d689ebd2d56e533afb183c46cd12522169068f41f1";


/* ALICE generated her publicKey today using:
 * const publicKey = KYBER_pub_key();
*/
const { KYBER_ciphertext, KYBER_iv, KYBER_tag, KYBER_publicKey } = await KYBER_encrypt(plaintext, bob_KYBER_pub_key);

const KYBER_decrypted = await KYBER_decrypt(KYBER_ciphertext, KYBER_iv, KYBER_tag, KYBER_publicKey, bob_KYBER_priv_key);

debug("KYBER", plaintext, { KYBER_ciphertext, KYBER_iv, KYBER_tag, KYBER_publicKey }, KYBER_decrypted);
/* [ END KYBER ] */

ECIES Module (crypto_modules/ECIES_module.js)

Implements Elliptic Curve Integrated Encryption Scheme (ECIES) with the P-521 curve.

Purpose:

  1. Generates an ECIES key pair for Bob.
  2. Allows Alice to encrypt data using Bob's public key without pre-sharing Alice public key.
  3. Allows Bob to decrypt the encrypted data using his private key.

RSA Module (crypto_modules/RSA_module.js)

Implements RSA encryption with 2048-bit keys and uses hex codification for PEM.

Purpose:

  1. Generates RSA key pairs.
  2. Allows encryption using RSA public key.
  3. Allows decryption using RSA private key.

KYBER Module (crypto_modules/KYBER_module.js)

Implements post-quantum encryption using the Kyber1024 KEM algorithm.

Purpose:

  1. Generates Kyber key pair for Bob.
  2. Allows Alice to encrypt data using Bob's public key without pre-sharing Alice public key.
  3. Allows Bob to decrypt the encrypted data using his private key.

MISC

If you get a warning about being unable to use native bindings from KYBER module, check this issue