mirror of
https://github.com/nicolabs/ciform.git
synced 2026-04-11 00:14:41 +02:00
# fixed : synchronized with current API
This commit is contained in:
parent
b07e358685
commit
e0eef64367
|
|
@ -1,10 +1,18 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Test Page for Ciform</title>
|
||||
|
||||
<!-- JsUnit requirement -->
|
||||
<script language="javascript" src="/opt/jsunit/app/jsUnitCore.js"></script>
|
||||
<script language="javascript" src="../target/libciform.js"></script>
|
||||
|
||||
<!-- standard Ciform library -->
|
||||
<script language="javascript" src="../target/lib/libciform.js"></script>
|
||||
|
||||
<!-- development Ciform libraries (override some part of the one on the previous line) -->
|
||||
<script language="javascript" src="../src/minilib.js"></script>
|
||||
<script language="javascript" src="../src/ciform.js"></script>
|
||||
|
||||
<!-- Unit tests -->
|
||||
<script language="javascript">
|
||||
|
||||
function testSHA1Encoder()
|
||||
|
|
@ -18,7 +26,7 @@
|
|||
function testRSAEncoder()
|
||||
{
|
||||
var pubKey = { 'type':"rsa", 'e':[17], 'pq':[142235881,93780825,214584072,42027371,203833933,128905630,39039844,39477483,226960049,15] };
|
||||
var enc = new Ciform.encoders.RSAEncoder(pubKey,{'preamble':false,'salt':false});
|
||||
var enc = new Ciform.encoders.RSAEncoder({'pubKey':pubKey,'preamble':false,'salt':false});
|
||||
assertEquals("No salt, no preamble","3c6888c1575418fce66b9ab0a936afd394f702fb1388b04625ab20334c40bbe1",enc.encode("test").toLowerCase());
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -58,6 +58,11 @@
|
|||
document.forms[0].output.className = checkbox.checked ? "hex ciform-sha1" : "hex";
|
||||
}
|
||||
|
||||
function doSubmit( form )
|
||||
{
|
||||
var cipher = new Ciform.Cipher({'pubKey':CIFORM['pubKey'],'onStartEncryption':alert});
|
||||
return cipher.encryptField( {'input':$('password'),'output':$('output')} );
|
||||
}
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
@ -72,7 +77,7 @@
|
|||
<p>On submit, a hidden output field takes the value of the encrypted password,
|
||||
and the password field is emptied so it is not transmitted.</p>
|
||||
|
||||
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST" onsubmit="javascript:return new ciform.Ciform(this,CIFORM['pubKey']).encryptFields([{'in':'password','out':'output'}],alert);">
|
||||
<form action="<?= $_SERVER['PHP_SELF'] ?>" method="POST" onsubmit="javascript:doSubmit();">
|
||||
<input type="hidden" class="hex" name="output" size="80" onchange="javascript:document.getElementById('ciphertext').innerHTML=this.value;">
|
||||
login : <input type="text" name="user"><br>
|
||||
password : <input type="password" class="txt" name="password" onkeyup="this.onchange()" onchange="javascript:previewCipher();">
|
||||
|
|
|
|||
Loading…
Reference in a new issue