http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto/blob/70e3a3a3/js/TestRSA.html ---------------------------------------------------------------------- diff --git a/js/TestRSA.html b/js/TestRSA.html deleted file mode 100644 index 6aec8dd..0000000 --- a/js/TestRSA.html +++ /dev/null @@ -1,78 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> -<title>JavaScript Test RSA</title> -</head> -<body> -<h1>JavaScript Test RSA Example</h1> -<script type="text/javascript" src="ROM.js"></script> -<script type="text/javascript" src="DBIG.js"></script> -<script type="text/javascript" src="BIG.js"></script> -<script type="text/javascript" src="HASH.js"></script> -<script type="text/javascript" src="RAND.js"></script> -<script type="text/javascript" src="FF.js"></script> -<script type="text/javascript" src="RSA.js"></script> - - -<script> -/* test driver and function exerciser for RSA API Functions */ - - var i,j=0,res; - var result; - - var RFS=RSA.RFS; - - var message="Hello World\n"; - - var pub=new rsa_public_key(ROM.FFLEN); - var priv=new rsa_private_key(ROM.HFLEN); - - var ML=[]; - var C=[]; - var RAW=[]; - - var rng=new RAND(); - rng.clean(); - - for (i=0;i<100;i++) RAW[i]=i; - rng.seed(100,RAW); - - var start,end,time; - start=new Date().getTime(); - window.document.write("Generating public/private key pair (slow!) <br>"); - RSA.KEY_PAIR(rng,65537,priv,pub); - end=new Date().getTime(); - time=end-start; - window.document.write("Time in ms= "+time+"<br>"); - - var M=RSA.stringtobytes(message); - window.document.write("Encrypting test string <br>"); - - var E=RSA.OAEP_ENCODE(M,rng,null); /* OAEP encode message m to e */ - window.document.write("Encoding= 0x" + RSA.bytestohex(E) + "<br>"); - - start=new Date().getTime(); - RSA.ENCRYPT(pub,E,C); /* encrypt encoded message */ - end=new Date().getTime(); - time=end-start; - window.document.write("Time in ms= "+time+"<br>"); - - window.document.write("Ciphertext= 0x" + RSA.bytestohex(C) + "<br>"); - - window.document.write("Decrypting test string <br>"); - start=new Date().getTime(); - RSA.DECRYPT(priv,C,ML); - end=new Date().getTime(); - time=end-start; - window.document.write("Time in ms= "+time+"<br>"); - - var MS=RSA.OAEP_DECODE(null,ML); /* OAEP encode message m to e */ - window.document.write("Decoding= 0x" + RSA.bytestohex(MS) + "<br>"); - - window.document.write("message= "+RSA.bytestostring(MS) + "<br>"); - - RSA.PRIVATE_KEY_KILL(priv); - -</script> -</body> -</html> \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-milagro-crypto/blob/70e3a3a3/js/readme.txt ---------------------------------------------------------------------- diff --git a/js/readme.txt b/js/readme.txt deleted file mode 100644 index 0662f5f..0000000 --- a/js/readme.txt +++ /dev/null @@ -1,28 +0,0 @@ -AMCL is very simple to build for JavaScript. - -First - decide the modulus type and curve type you want to use. Edit ROM.js -where indicated. You might want to use one of the curves whose details are -already in there. - -Three example API files are provided, MPIN.js which -supports our M-Pin (tm) protocol, ECDH.js which supports elliptic -curve key exchange, digital signature and public key crypto, and RSA.js -which supports RSA encryption. The first can be tested using the -TestMPIN.html driver programs, the second can be tested using TestECDH.html -and TestECM.html, and the third using TestRSA.html - -In the ROM.js file you must provide the curve constants. Several examples -are provided there, if you are willing to use one of these. - -To help generate the ROM constants for your own curve some MIRACL helper -programs are included. The program bngen.cpp generates the ROM details for a -BN curve, and the program ecgen.cpp generates the ROM for EC curves. - -The program bigtobig.cpp converts a big number to the AMCL -BIG format. - - -For quick jumpstart:- - -Run Chrome browser and navigate to TestMPIN.html -
