aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/test.js
diff options
context:
space:
mode:
authorGuillaume Horel <guillaume.horel@gmail.com>2011-05-19 02:31:04 -0400
committerGuillaume Horel <guillaume.horel@gmail.com>2011-05-19 02:31:04 -0400
commitaf055136c23652f1cf1ef0beac1b94d79cc1ddb6 (patch)
treec4de7f3bfe91303423e19552f850d432b03133c6 /crypto/test.js
parent53fb8167efe4100bf20df3bec5d6b844f4bf1617 (diff)
downloadalias-af055136c23652f1cf1ef0beac1b94d79cc1ddb6.tar.gz
Started to play around with js crypto code
test.js implements the basic functionality (recommand to load it in v8 (d8 test.js --shell)
Diffstat (limited to 'crypto/test.js')
-rw-r--r--crypto/test.js21
1 files changed, 21 insertions, 0 deletions
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)
+
+
+