aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/test.js
blob: 69246488f538953aa87b3310188f036cfbe26442 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
load('jsbn.js')
load('jsbn2.js')
load('rsa.js')
load('rsa2.js')
//load random number generator
//TODO: plug-in sjcl random generator
load('prng4.js')
load('rng.js')
//next 2 scripts add a method to read an rsa key in the pem format
load('asn1hex.js')
load('rsa-pem.js')
load('base64.js')

key_string = read('key.pem')
key = new RSAKey()
key.readPrivateKeyFromPEMString(key_string)
cypher = key.encrypt("Guillaume est plus fort que Thibaut")
test = key.decrypt(cypher)