aboutsummaryrefslogtreecommitdiffstats
path: root/crypto/test-pem.js
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/test-pem.js')
-rw-r--r--crypto/test-pem.js23
1 files changed, 23 insertions, 0 deletions
diff --git a/crypto/test-pem.js b/crypto/test-pem.js
new file mode 100644
index 0000000..91c0dc4
--- /dev/null
+++ b/crypto/test-pem.js
@@ -0,0 +1,23 @@
+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)
+
+key2 = new RSAKey()
+key2.generate(2048,"10001")
+
+