diff --git a/ciform/trunk/test/ciform.css b/ciform/trunk/test/ciform.css new file mode 100644 index 0000000..4595abf --- /dev/null +++ b/ciform/trunk/test/ciform.css @@ -0,0 +1,5 @@ +/* A very simple style for demo purpose */ +body { background:white; } +code, pre { background:#DDEEEE; } +.txt { background:#CCFF99;} +.b64, .bin, .hex { background:#EEEEAA; } diff --git a/ciform/trunk/test/ciform.html b/ciform/trunk/test/ciform.html new file mode 100644 index 0000000..aca7c97 --- /dev/null +++ b/ciform/trunk/test/ciform.html @@ -0,0 +1,32 @@ + +
+This page is a unit test.
+ It must be open with JsUnit's TestRunner.
On submit, a hidden output field takes the value of the encrypted password, + and the password field is emptied so it is not transmitted.
+ + + +*
Here is what the received response looks like :
+ + +And after decryption :
+ + + \ No newline at end of file diff --git a/ciform/trunk/test/test.php b/ciform/trunk/test/test.php new file mode 100644 index 0000000..5dff26a --- /dev/null +++ b/ciform/trunk/test/test.php @@ -0,0 +1,150 @@ + + + + + + + + + + +The key is either read from a file or generated on the fly if no file was found.
+ It is served to the client as JSON data :
= "var CIFORM_PUBKEY =" . ciform_rsa_pubKey2Json($keyPair) . ";" ?>
+
+
+
+ The user types in a password, and Javascript encodes it. +
+ +On the server side, the message "= $plain_data ?>" would be encoded this way :
+Extra :
+On the client side, it's the same, handled in Javascript :
+ + + + +The generated keypair was stored and retrieved for decoding :
+ +Each parameter of the request is decrypted if required :
+| KEY | VALUE | DECRYPTED |
|---|---|---|
| $key | "; + echo "" . chunk_split($val,76,"\n") . " | ";
+ echo "$dec | "; + echo "
| $key | "; + echo "$val | "; + echo "$dec | "; + echo "