# JsDoc Reference - File Index

Class Index | File Index

## Classes

- _global_
- Ciform
- Ciform.Cipher
- Ciform.ciphers
- Ciform.ciphers.ChainEncoder
- Ciform.ciphers.CiformPacketizer
- Ciform.ciphers.Encoder
- Ciform.ciphers.RSAEncoder
- Ciform.ciphers.RSAPublicKey
- Ciform.ciphers.SHA1Encoder
- Ciform.Field
- Ciform.protocol

# File Index

## ciform.js

This library provides specifications and basic functions to add encryption to HTML form elements.

Home : http://ciform.googlecode.com

It does not contain cryptographic functions ; it's more a 'user-friendly' wrapper around cryptographic functions, dedicated to securing web forms.

It has 2 layers :

1. the Ciform.ciphers namespace contains the (external) encoders used by Ciform. This is the layer that really deals with the cryptographic functions.
2. the Ciform top, 'user' layer contains classes dedicated to encryption of the data being exchanged between the client and the server.

##### Example 1 : encrypting password fields

This way you define a simple encryption on all password fields of a form, that will take place when it is submitted.

`

    <HEAD>
    ...
    <SCRIPT type="text/javascript">
    	// pubKey is defined elsewhere : it is the public key used by the default RSA encoder
    	var mycipher = new Ciform.Cipher({'pubKey':pubkey});
    </SCRIPT>
    ...
    </HEAD>
    ...
    <FORM action="http://myserver/mypage.php" onsubmit="javascript:mycipher.encryptForm(this,{'allowTypes':"password"});">
    ...

`

##### Example 2 : different types of encryption within the same page

You can use several Ciform.Cipher objects at the same time.

`

    var toServer1 = new Ciform.Cipher({'pubKey':pubkey1});
    // in the following line the server is not the same one, so the public key is different
    var toServer2 = new Ciform.Cipher({'pubKey':pubKey2});
    ...
    toServer1.encryptForm(document.forms[1]);
    ...
    toServer2.encryptField($('#country'));

`

##### Example 3 : using the same object to encrypt different fields

`

    var ciform = new Ciform.Cipher({'pubKey':pubkey});
    ...
    // encrypts an input field : the encrypted value will replace its current value ; see  Ciform.Cipher#encryptField
    ciform.encryptField(document.getElementById('myFieldId'));
    ...
    // encrypts the parameters in a URL (and replaces the original value) : Ciform.Cipher#encryptURL
    document.getElementById('anAnchor').href = ciform.encryptURL(document.getElementById('anAnchor').href);

`

Author:
  nicobo

Documentation generated by JsDoc Toolkit 2.4.0 on Mon Feb 06 2012 00:12:49 GMT+0100 (CET)