NAME¶
Crypto::setEncryptionKey - Set application secret key
SYNOPSIS¶
Void setEncryptionKey( [Int] key )
ARGUMENTS¶
key The new encryption key. This must be an array of integers, containing
exactly 32 integers between 0 and 255. An Exception will be thrown if the
parameter is unsuitable. For security, encryption keys should be generated
from a good-quality random number source.
DESCRIPTION¶
Sets the application secret key used by
Crypto.encode (3kaya) and
Crypto.decode (3kaya) 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 (3kaya)
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.
AUTHORS¶
Kaya standard library by Edwin Brady, Chris Morris and others
(kaya@kayalang.org). For further information see
http://kayalang.org/
LICENSE¶
The Kaya standard library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public License (version
2.1 or any later version) as published by the Free Software Foundation.