1Crypto.setEncryptionKey(3kaya)Kaya module referencCerypto.setEncryptionKey(3kaya)
2
3
4
6 Crypto::setEncryptionKey - Set application secret key
7
9 Void setEncryptionKey( [Int] key )
10
12 key The new encryption key. This must be an array of integers, contain‐
13 ing exactly 32 integers between 0 and 255. An Exception will be thrown
14 if the parameter is unsuitable. For security, encryption keys should be
15 generated from a good-quality random number source.
16
18 Sets the application secret key used by Crypto.encode (3kaya) and
19 Crypto.decode (3kaya) to a new value for the remainder of program exe‐
20 cution. You can obtain the key from a variety of sources (e.g. a flat
21 file, or a database entry) - the easiest way is probably to read 32
22 bytes from a file with IO.getChar (3kaya)
23 Using an external application key removes the requirement that the
24 application binary be strongly protected (by moving the requirement to
25 whatever the key source is, of course). This may be useful for
26 installing common web application binaries to a shared folder.
27
28 Web applications should call this function from within their webconfig
29 function to avoid unpredictable results. Also to avoid unpredictable
30 results, this function may only be called once per program run, and
31 must be called before any other function that uses the key. An Excep‐
32 tion will be thrown if this is called for a second time or too late.
33
34 Note: While an unscrupulous application writer could use this function
35 to ensure that the effective application key could not be changed by
36 kaya-rekey , they could find far easier and less easily detectable ways
37 to put a backdoor into any application that users were unable to recom‐
38 pile or verify.
39
41 Kaya standard library by Edwin Brady, Chris Morris and others
42 (kaya@kayalang.org). For further information see http://kayalang.org/
43
45 The Kaya standard library is free software; you can redistribute it
46 and/or modify it under the terms of the GNU Lesser General Public
47 License (version 2.1 or any later version) as published by the Free
48 Software Foundation.
49
50
51
52Kaya December 2010 Crypto.setEncryptionKey(3kaya)