jsbn

phpseclib/jsbn: encrypt with public key in PHP, decrypt with private key in jsbn

孤街醉人 提交于 2019-12-21 20:55:07
问题 I can successfully generate a public/private keypair using jsbn on the client side. Encrypting and decrypting client side with these keys is fine. I can also transmit that public key to the server and store it in MySQL via PHP. I cannot encrypt something in PHP using the jsbn public key, and then decrypt it client side using the jsbn private key. // attempting to encrypt in PHP using the jsbn public key. // (this public key came from jsbn client side) $jsbn_public_key =

How do I encrypt Crypto-JS keys with JSBN?

自闭症网瘾萝莉.ら 提交于 2019-12-11 02:22:49
问题 I'm using JSBN to encrypt/decrypt data using public/private keypairs. It works great for text data, including hex strings. My problem is now I have binary data, specifically Crypto-JS Word Arrays, that I need to encrypt with a public key and send along to another platform. So consider this: var key = CryptoJS.lib.WordArray.random(256/8); var rsa = new RSAKey(); rsa.setPublic(modulus, exponent); var encrypted_key = rsa.encrypt(key.toString()); This works but it means 'encrypted_key' is infact

RSA in javascript no longer supports ASCII/byte arrays

一笑奈何 提交于 2019-12-10 13:25:24
问题 I am using rsa.js v1.0 from http://www-cs-students.stanford.edu/~tjw/jsbn/ to encrypt an ASCII string in a browser. The string is actually a 16 byte array that contains a double-length TripleDes key. With rsa v1.0 this works. The byte array is correctly decrypted on the server (using Bouncy Castle or a Thales HSM) as a 16 byte array. e.g. var zpk = hex2a("E0F8AD4092F81FC401E60ECB7F5B8F1A"); var rsa = new RSAKey(); rsa.setPublic(modulus, exponent); var res = rsa.encrypt(zpk); if (res) {

phpseclib/jsbn: encrypt with public key in PHP, decrypt with private key in jsbn

…衆ロ難τιáo~ 提交于 2019-12-04 12:30:43
I can successfully generate a public/private keypair using jsbn on the client side. Encrypting and decrypting client side with these keys is fine. I can also transmit that public key to the server and store it in MySQL via PHP. I cannot encrypt something in PHP using the jsbn public key, and then decrypt it client side using the jsbn private key. // attempting to encrypt in PHP using the jsbn public key. // (this public key came from jsbn client side) $jsbn_public_key =

Encrypt a small string with RSA in javascript then decrypt in java on server

一笑奈何 提交于 2019-11-30 10:30:30
I want to encrypt a small string in javascript using RSA with public keys and then decrypt that string in java server side code using private keys. I am using this code in javascript: http://www-cs-students.stanford.edu/~tjw/jsbn/ Example at: http://www-cs-students.stanford.edu/~tjw/jsbn/rsa2.html and this code on java side: Encrypting string in javascript and decryption in java Both of codes work good independently but they do not understand each other. Need to solve this today or I am open to accept any other asymmetrical algorithm that works this way. You are using raw encryption on the

Encrypt a small string with RSA in javascript then decrypt in java on server

别说谁变了你拦得住时间么 提交于 2019-11-29 15:48:30
问题 I want to encrypt a small string in javascript using RSA with public keys and then decrypt that string in java server side code using private keys. I am using this code in javascript: http://www-cs-students.stanford.edu/~tjw/jsbn/ Example at: http://www-cs-students.stanford.edu/~tjw/jsbn/rsa2.html and this code on java side: Encrypting string in javascript and decryption in java Both of codes work good independently but they do not understand each other. Need to solve this today or I am open