Kaya 0.5.2 reference for Crypto::setEncryptionKey

List of functions and data types in Crypto

Void setEncryptionKey([Int] key)

Arguments

Usage

Sets the application secret key used by encode and decode to a new value for the remainder of program execution. You can obtain the key from a variety of sources (e.g. a flat file, or a database entry) - the easiest way is probably to read 32 bytes from a file with IO::getChar. Using an external application key removes the requirement that the application binary be strongly protected (by moving the requirement to whatever the key source is, of course). This may be useful for installing common web application binaries to a shared folder.

Web applications should call this function from within their webconfig function to avoid unpredictable results. Also to avoid unpredictable results, this function may only be called once per program run, and must be called before any other function that uses the key. An Exception will be thrown if this is called for a second time or too late.

Note: While an unscrupulous application writer could use this function to ensure that the effective application key could not be changed by kaya-rekey, they could find far easier and less easily detectable ways to put a backdoor into any application that users were unable to recompile or verify.

kaya@kayalang.org | Last modified 29 November 2011 | Supported by Durham CompSoc | Powered by Kaya