diff -r 000000000000 -r 2c201484c85f crypto/weakcrypto/docs/secure_stream_encryption.dox --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/crypto/weakcrypto/docs/secure_stream_encryption.dox Wed Jul 08 11:25:26 2009 +0100 @@ -0,0 +1,95 @@ +/** +@page secure_stream_encryption Secure Stream Encryption + + This document describes secure stream encryption and its use (with the \c crypto API). + + - @ref secure_stream_encryption_What + - @ref secure_stream_encryption_Why + - @ref secure_stream_encryption_How + - @ref secure_stream_encryption_Writing + - @ref secure_stream_encryption_Reading + - @ref secure_stream_encryption_element_set + - @ref secure_stream_encryption_data + - @ref secure_stream_examples + +
+ +@section secure_stream_encryption_What What is secure stream encryption? + + Secure stream encryption provides subclasses of RReadStream, RWriteStream and + CStreamStore that allow transparent access to encryted streams and stores. + It is implemented in terms of @ref mainpage_pbe "PBE" (Password Based Encryption) -- i.e., %PBE does most of the + work, the stream encryption classes are just wrappers that call %PBE. + The word "secure" refers to the fact that it uses well-known cryptographic algorithms. + +
+ +@section secure_stream_encryption_Why What is it used for? + + Secure stream encryption is used for example: + - to password protect a database file + - to store contacts encrypted on a mobile phone. + +
+ +@section secure_stream_encryption_How How do I use the secure stream encryption API? + + @section secure_stream_encryption_Writing Encrypting a stream + + - An encryption object (i.e., a CPBEncryptElement or CPBEncryptSet object) is necessary + to allow the @ref mainpage_pbe "password based encryption" of elements or multiple elements. Objects of this + type contain the encryption key with its encryption data (i.e., password, cipher, @ref salt, @ref IV, + iterations). Note that encryption objects can be recreated at a later stage from existing encryption data + (see @ref secure_stream_encryption_data). + - An RWriteStream object (such as an RFileWriteStream, or RStoreWriteStream + object) representing a target stream needs to be created in order to write the stream to a file or store . + - To support the encryption, an REncryptStream object is required, which forms an encryption filter or + layer over the RWriteStream object. + - Data can now be encrypted as it is externalized through the REncryptStream to the stream + represented by the RWriteStream object. + + @section secure_stream_encryption_Reading Decrypting a stream + + Reading from an encrypted stream is a similar process to that of writing to one. + + - An encryption object, i.e., a CPBEncryptElement or a CPBEncryptSet object, is + needed to allow the @ref mainpage_pbe "password based decryption" of elements or multiple elements, + respectively. + - An RReadStream object (such as an RFileReadStream, or RStoreReadStream + object) needs to be created in order to read the stream from a file or store . + - An RDecryptStream object is needed to form an encryption wrapper around the existing + RReadStream object. + - The encrypted data is internalized from the stream represented by the RReadStream object by way of + the RDecryptStream object. + + @section secure_stream_encryption_element_set Handling multiple elements + + CPBEncryptElement is good for handling individual elements, but for encrypting/decrypting information + with multiple, independent elements it is advisable to use CPBEncryptSet; for instance, if you wished + to store contacts encrypted on a mobile phone. \n + When you create a CPBEncryptSet object a master key is generated for you. This master key, + which is encrypted with the password provided by the user of the class, enables the encryption/decryption of + individual elements. The password may be changed by using the CPBEncryptSet::ChangePasswordL() + function, which re-encrypts the master key with the new password. + + @section secure_stream_encryption_data Storing encryption data + + In order to decrypt any information previously encrypted with a CPBEncryptElement or + CPBEncryptSet object, you must store its encryption data along with it. Externalizing the + CPBEncryptionData object will achieve this; for example:\n\n + writeStream << encryption->EncryptionData(); \n\n + where writeStream is a RFileWriteStream object, and encryption is a + CPBEncryptElement object. Failure to do this will result in the permanent loss of the encrypted + information. See @ref secure_stream_example_code. + +
+ +@section secure_stream_examples Example code + + - @ref pbe_example_code + - @ref secure_stream_example_code + - @ref secure_store_example_code + + +*/ +