Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RSA Encryption Javascript

Can anyone please help me with this - I have been instructed to write an application that takes some data then encrypts it with an RSA public key.

It apparently needs to be "RSA encryption" (I have never heard or seen this before?)

Which encryption cipher is RSA meant to use as standard?

var key = "TUlHZE1BMEdDU3FHU0liM0RRRUJBUVVBQTRHTEFEQ0Jod0tCZ1FDbVFiTWc3SWRpeHVmYWEwcDd2ODVLVytmUnVlZ216UUhibnNoWjhmbXlTQW9MMXRFVzAyNEZKVFlSTFZxN0VsV2p1R0U4aHQ3RmJjN1NURWpxZVViWU5xdnRiVWN6UFZYSE5FdStYRUVndGszazlFNXVQWG0wVzRIc3RtK0FhRXcyMmxxb2lFNGlrT1QzZzdPRXNHSVFCMVNlSlRtVTE1eFBBZ3M3SXRjTVFRSUJFUT09";

var data = "Xa21dr";
like image 461
null Avatar asked Jul 16 '13 19:07

null


People also ask

Does Crypto JS support RSA?

No. CryptoJS is a JavaScript library for symmetric, but not asymmetric encryption, i.e. it does not support RSA.

What is node RSA?

RSA is one of the first public-key cryptosystems and is widely used for secure data transmission. It consist of two keys: Public key and private key. It allows anyone with public key to encrypt message which can be decrypt only by person having private key.

Which is better RSA or AES?

RSA is more computationally intensive than AES, and much slower. It's normally used to encrypt only small amounts of data.


2 Answers

Never mind found the answer myself!

RSA Encryption standard uses PKCS #1

Best library to use is pidCrypt, nothing else worked for me!

https://sourceforge.net/projects/pidcrypt/

the idiots on the other end failed to let me know that that RSA Public Key was meant to be base64 decoded too before encrypting the DATA before sending.

like image 168
null Avatar answered Sep 21 '22 20:09

null


You may be interested in trying out forge (it does RSA and more). There are lots of examples on the README:

https://github.com/digitalbazaar/forge

like image 41
dlongley Avatar answered Sep 22 '22 20:09

dlongley