From af055136c23652f1cf1ef0beac1b94d79cc1ddb6 Mon Sep 17 00:00:00 2001 From: Guillaume Horel Date: Thu, 19 May 2011 02:31:04 -0400 Subject: Started to play around with js crypto code test.js implements the basic functionality (recommand to load it in v8 (d8 test.js --shell) --- crypto/test.js | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 crypto/test.js (limited to 'crypto/test.js') diff --git a/crypto/test.js b/crypto/test.js new file mode 100644 index 0000000..6924648 --- /dev/null +++ b/crypto/test.js @@ -0,0 +1,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) + + + -- cgit v1.2.3-70-g09d2