RSA Encryption Javascript
Solution 1
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.
Solution 2
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
Comments
-
null over 2 years
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";
-
null almost 11 yearsthanks, pidCrypt is working perfectly but will take a look. pidCrypt offers not just RSA too.
-
Houcem Berrayana over 10 yearsthe last line in your response saved me a lot of time.
-
null over 10 yearsthanks, if you found this useful then please mark the answer as useful :)
-
Tarion over 10 yearsWhat is the format of the encrypted data? Is it also base 64?
-
Todd Horst over 9 yearsforge is very nice. I had a little trouble getting it started, so I created the demo here: digitalbazaar.github.io/forge
-
Toubey about 9 yearspidder is no longer online?
-
null almost 9 years@Toubey looks to be still online to me just checked their website - pidder.com/pidcrypt - still accessible. you can download from source forge directly too - sourceforge.net/projects/pidcrypt
-
Toubey almost 9 yearsThanks @whitedeath, apparently there was something wrong with by the time i checked it.
-
Philzen over 8 yearsThe project is no longer maintained. Also @whitedeath - can you clarify whether it implemented PKCS#1 v1.5 (which is understand is easily attackable since 1998) or PKCS#1 v2.2 (RSA with Optimal Asymmetric Encryption Padding). For those reasons and ease of use i went with forge, which also is a pretty active project on github.
-
null over 8 years@Philzen No idea which PKCS v is packaged with pidCrypt you will need to download the source and take a look (i needed PKCS #1 so went with pidCrypt as it worked perfectly for my needs).
-
yeah22 over 2 yearsNote: pidCrypt is licensed under GPL (thus, your software must legally also be licensed under GPL if you use the library)