I am trying to implement a connection between
On the server side of python, I encrypt the string with ivand passphraseand send iv with base64 encrypted text encoded on the client side javascript. Then I want a decryptline with a passphrase that the user can enter.
python - server
from Crypto.Cipher import AES
from Crypto import Random
iv = Random.get_random_bytes(16)
key = "1234567812345678"
aes = AES.new(key, AES.MODE_CFB, iv)
encrypted_text = base64.b64encode(aes.encrypt("this is a test.."))
iv = base64.b64encode(iv)
javascript - client
// <script type="text/javascript"
src="http://crypto-js.googlecode.com/files/2.5.3-crypto-sha1-hmac-pbkdf2-blockmodes-aes.js">
</script>
// text, and iv is base64encoded from the python script
// key is a string from an <input type='text'>
decrypted = Crypto.AES.decrypt(text, key, {iv: iv, mode: new Crypto.mode.CFB});
In this example, I get a javascript error
Uncaught URIError: URI malformed
But this is just one example - I tried all the base64 encoding / decoding constellations that I could think of. I also tried changing the mode. But these are all random tests, and I want to understand what I really need to do.
- What encoding does crypt require?
- ?
- -, python?
- ? ?
- javascript, ?
reagards,
samuirai