Questions tagged [jsbn]

The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers.

The jsbn library is a fast, portable implementation of large-number math in pure JavaScript, enabling public-key crypto and other applications on desktop and mobile browsers. More info: http://www-cs-students.stanford.edu/~tjw/jsbn/

20 questions
6
votes
1 answer

RSA in javascript no longer supports ASCII/byte arrays

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…
5
votes
2 answers

RSA Encrypt and Decrypt between JS and Python(pycrypto)

I encrypt plain text from JS RSA Library(http://www-cs-students.stanford.edu/~tjw/jsbn/) and decrypt from python, Crypto.PublicKey. But, when I decrypt cipher text from JS with python, It has dummy text. I don't know why they are. So, I want clear…
yumere
  • 199
  • 1
  • 9
5
votes
1 answer

RSA Message too long Javascript JSBN

I am using JSBN in javascript to encrypt a set of string (message) of facebook data to securely send them to my server (PHP) and decrypt them there. Some users are experiencing "Message too long" on something like…
malteseKnight
  • 347
  • 4
  • 12
4
votes
2 answers

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

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…
Imran Shafqat
  • 508
  • 1
  • 9
  • 23
3
votes
2 answers

How do I encrypt Crypto-JS keys with JSBN?

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…
Marc M
  • 93
  • 1
  • 7
3
votes
1 answer

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

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…
dtbaker
  • 4,679
  • 6
  • 28
  • 30
2
votes
1 answer

Encrypt by jsbn library and then decrypt by WebCrypto

We're using jsbn library PKCS#1 encryption-style padding for encrypt the message. And now we want to change jsbn library for web crypto. There is no problem With AES key. Problem is with RSA key. I have encrypted message by jsbn library. Is possible…
Ana
  • 45
  • 1
  • 5
1
vote
1 answer

jsbn library BigInteger negate function seems not working

I am using the jsbn library to manage BigIntegers in a javascript application. It seems that the negate function is not working well. I expect that the negate function works like the Java one. BigInteger minusOne = BigInteger.ONE.negate(); //…
91K00
  • 452
  • 4
  • 7
1
vote
1 answer

Converting negative BigInteger (Tom Wu's JSBN library) values to hex values

I am trying to convert BigInteger numbers to its hex format so that I could use it for further HMAC calculations. I have used the following post for getting the code to do this. Converting a 64 bit number string to word array using CryptoJS The code…
grane2212
  • 764
  • 1
  • 10
  • 29
1
vote
4 answers

Generate public key from numbers

I am using RSA in javascript from: http://www-cs-students.stanford.edu/~tjw/jsbn/ And on their demo page, it is able to generate the keys required: http://www-cs-students.stanford.edu/~tjw/jsbn/rsa2.html But what I don't understand, is how to turn…
Billy Moon
  • 57,113
  • 24
  • 136
  • 237
1
vote
2 answers

Encrypting in Javascript, decrypting PHP using PKCS#1

I have trying to do encryption/decryption in Javascript/PHP using PKCS#1. I have the following variables: e: Public exponent (for encryption) d: Private exponent (for decryption) n: modulus I am using this javascript library to…
Ratmil
  • 117
  • 8
0
votes
1 answer

How to access SecureRandom in jsbn typescript?

I used to access the SecureRandom in jsbn.js this way var jsbn = require('jsbn'); var SecureRandom = jsbn.SecureRandom; var secureRandom = new SecureRandom(); secureRandom.nextBytes(x); How do I access it in jsbn.ts? As there seem to be limited…
Sithideth Bouasavanh
  • 1,011
  • 1
  • 11
  • 20
0
votes
1 answer

Could JSBN/Forge be used to generate RSA private/public key pair?

Looking at JSBN, RSAGenerate(B,E) takes the bit length B and the public key E as arguments. Does that mean it the public key can only be generated separately and be provided as an argument? Does that also mean Forge can't generate the key pair like…
Kar
  • 6,063
  • 7
  • 53
  • 82
0
votes
1 answer

python RSA implemention with PKCS1

I got the following code in javascript for RSA implementionhttp://www-cs-students.stanford.edu/~tjw/jsbn/: // Return the PKCS#1 RSA encryption of "text" as an even-length hex string function RSAEncrypt(text) { var m =…
user307016
  • 23
  • 1
  • 4
0
votes
1 answer

Choosing N and E for Javascript RSA Key Generation using JSBN

I'm using the JSBN library found at http://www-cs-students.stanford.edu/~tjw/jsbn/. I'm particularly trying to make the RSASetPublic() call in rsa.js, like this: publicPem = RSASetPublic(N,E); For example, when N = "667" and E = "327" I get the…
kwills
  • 116
  • 10
1
2