

Return base64.b64encode(ciphertext).decode('ascii')Ĭiphertext = base64.b64decode(msg.encode('ascii')) JLcSymgrWa02QQIhAMJFvPvcilGkYl1atCHHt3LN0mTjd+N0/OXq3SvblIsBAiAcĨRzaV1GmjMEJxw9vM/tQwQg0kyAPlITMRXnwGA6E0A=Ĭiphertext = cipher.encrypt(msg.encode('utf8')) UV15Ian4ZbkME1IbAvDPcWuNGHxdsaMBAiBoz0K/S44yDfp4lj+bCUmeglTqhrVn MIIBOwIBAAJBANBOMQo9wX55+w1ijEaPoYRP2T4BOjoFv3ma0QWqYYQ8FH0z14Zcī/jb0j2PWpyNcsUUBovj+yWxQnQohCck64kCAwEAAQJBAL4s9PbNpO9MfFkfBMSSĨzoyEDtcsYUxpDtojbandDpdXfvn5D279QaOVLb1C3DgQTTEmroYB8dbeZBc5YJCĢAECIQDqyUn68ehRcx/EyLMUB1IuckZBWCIApgfn7phgVwSwiQIhAOMgY4bN+xrx from _future_ import unicode_literals, print_function # python2

I have only tested with python 3, but I believe it should work the same in python 2 with the _future_ imports. Run a quick encryption/decryption when they click.Ĭonsole.log("ENCRYPTED data:", enc_from_python) ĭtPrivateKey($('#privkey').val()) Call this code when the page is done loading.Ĭonsole.log("msg:" + JSON.stringify(msg)) Key = RSA.generate(1024, random_generator) The problem is that when I do encryption by random_generator = Random.new().read But before that I am testing the scenario by simply encrypting data in python and sending in to index.html file via pubnub and trying to decrypt it in JavaScript. I want to generate RSA key pairs from server side and send it to all of the clients (browsers).
