summaryrefslogtreecommitdiff
path: root/django/srpproject/templates/aes.html
diff options
context:
space:
mode:
authorAzul <azul@leap.se>2012-07-20 10:56:36 +0200
committerAzul <azul@leap.se>2012-07-20 10:56:36 +0200
commit50de80c5e817476ac95a096c718a66f5555fcd05 (patch)
treee05a25868a999557e2788a91f41da3a5a8a1a0b0 /django/srpproject/templates/aes.html
parent07fe2d8976db0ec267bd57ded90778f0d7695478 (diff)
INCOMPATIBLE: major restructuring of the repository
* removed Django code - we're keeping the tests - so I hope the two can still be used together * removed js packer - everyone has their own packaging strategy these days * cleaned up the repository - we only have js so javascript directory does not make much sense
Diffstat (limited to 'django/srpproject/templates/aes.html')
-rw-r--r--django/srpproject/templates/aes.html69
1 files changed, 0 insertions, 69 deletions
diff --git a/django/srpproject/templates/aes.html b/django/srpproject/templates/aes.html
deleted file mode 100644
index dbdd4ac..0000000
--- a/django/srpproject/templates/aes.html
+++ /dev/null
@@ -1,69 +0,0 @@
-<html>
- <head>
- <script src="{{ static_files }}/prng4.js"></script>
- <script src="{{ static_files }}/rng.js"></script>
- <script src="{{ static_files }}/jsPacker/hash.min.js"></script>
- <script type="text/javascript">
- var key = cryptoHelpers.toNumbers("6754c921b8dcbd1f8b58748cd87ac60ce857314687a65df05c470a46f438842c");
- var rng = new SecureRandom();
- innerxml = function(node)
- {
- return node.firstChild.nodeValue;
- };
- ajaxRequest = function(full_url, params, callback)
- {
- if( window.XMLHttpRequest)
- xhr = new XMLHttpRequest();
- else if (window.ActiveXObject){
- try{
- xhr = new ActiveXObject("Microsoft.XMLHTTP");
- }catch (e){}
- }
- else
- {
- that.error_message("Ajax not supported.");
- return;
- }
- if(xhr){
- xhr.onreadystatechange = callback;
- xhr.open("POST", full_url, true);
- xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
- xhr.setRequestHeader("Content-length", params.length);
- xhr.setRequestHeader("Connection", "close");
- xhr.send(params);
- }
- else
- {
- that.error_message("Ajax failed.");
- }
- };
- function encryptDecrypt()
- {
- var byteMessage = cryptoHelpers.convertStringToByteArray(document.getElementById("plaintext").value);
- var iv = new Array(16);
- rng.nextBytes(iv);
- var paddedByteMessage = slowAES.getPaddedBlock(byteMessage, 0, byteMessage.length, slowAES.modeOfOperation.OFB);
- var ciphertext = slowAES.encrypt(paddedByteMessage, slowAES.modeOfOperation.OFB, key, key.length, iv).cipher;
- var sendstring = cryptoHelpers.base64.encode(iv.concat(ciphertext));
- while(sendstring.indexOf("+",0) > -1)
- sendstring = sendstring.replace("+", "_");
- ajaxRequest("http://home.ausiv.com:85/srp/aes/post/", "c="+sendstring+"&l="+byteMessage.length, displayText);
-
- };
- function displayText()
- {
- if(xhr.readyState == 4 && xhr.status == 200) {
- if(xhr.responseXML.getElementsByTagName("P").length > 0)
- document.getElementById("output").value = innerxml(xhr.responseXML.getElementsByTagName("P")[0]);
- else if(xhr.responseXML.getElementsByTagName("error").length > 0)
- alert(innerxml(xhr.responseXML.getElementsByTagName("error")[0]));
- }
- };
- </script>
- </head>
- <body>
- <input type="text" id="plaintext"/>
- <input type="button" value="Send Encrypted Text" onclick="javascript:encryptDecrypt();"/>
- <input type="text" id="output"/>
- </body>
-</html>