diff --git a/ChangeLog b/ChangeLog index cb07441266a..e9195d0013b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -230,10 +230,10 @@ * http response.readable should be false after 'end' #867 (Abe Fettig) -* Implemenet os.cpus() and os.uptime() on Solaris (Scott McWhirter) +* Implement os.cpus() and os.uptime() on Solaris (Scott McWhirter) * fs.ReadStream: Allow omission of end option for range reads #801 - (Felix Geisendörfer) + (Felix Geisendörfer) * Buffer.write() with UCS-2 should not be write partial char #916 (koichik) @@ -319,11 +319,11 @@ * Pragma HTTP header comma separation * In addition to 'aborted' emit 'close' from incoming requests - (Felix Geisendörfer) + (Felix Geisendörfer) * Fix memleak in vm.runInNewContext -* Do not cache modules that throw exceptions (Felix Geisendörfer) +* Do not cache modules that throw exceptions (Felix Geisendörfer) * Build system changes for libnode (Aria Stewart) @@ -341,7 +341,7 @@ * URL parse more safely (isaacs) -* Expose errno with a string for dns/cares (Felix Geisendörfer) +* Expose errno with a string for dns/cares (Felix Geisendörfer) * Fix tty.setWindowSize @@ -365,7 +365,7 @@ * Improve V8 support for Cygwin (Bert Belder) -* Fix fs.open param parsing. (Felix Geisendörfer) +* Fix fs.open param parsing. (Felix Geisendörfer) * Fixed null signal. @@ -496,12 +496,12 @@ * Allow third party hooks before main module load. (See 496be457b6a2bc5b01ec13644b9c9783976159b2) -* Don't stat() on cached modules. (Felix Geisendörfer) +* Don't stat() on cached modules. (Felix Geisendörfer) 2011.01.08, Version 0.3.4 (unstable) -* Primordal mingw build (Bert Belder) +* Primordial mingw build (Bert Belder) * HTTPS server @@ -531,7 +531,7 @@ functions for OSX, Linux, and Cygwin. (Brian White) * Fix REPL syntax error bug (GH-543), improve how REPL commands are - evaulated. + evaluated. * Use process.stdin instead of process.openStdin(). @@ -572,7 +572,7 @@ 2010.11.16, Version 0.3.1 (unstable), ce9a54aa1fbf709dd30316af8a2f14d83150e947 -* TLS improvments (Paul Querna) +* TLS improvements (Paul Querna) - Centralize error handling in SecureStream - Add SecurePair for handling of a ssl/tls stream. @@ -634,9 +634,9 @@ 2010.10.23, Version 0.3.0 (unstable) 1582cfebd6719b2d2373547994b3dca5c8c569c0 -* Bugfix: Do not spin on aceept() with EMFILE +* Bugfix: Do not spin on accept() with EMFILE -* Improvments to readline.js (Trent Mick, Johan Euphrosine, Brian White) +* Improvements to readline.js (Trent Mick, Johan Euphrosine, Brian White) * Safe constructors (missing 'new' doesn't segfault) @@ -672,7 +672,7 @@ * Commas last in sys.inspect -* Constatnts moved from process object to require('constants') +* Constants moved from process object to require('constants') * Fix parsing of linux memory (Vitali Lovich) diff --git a/doc/api/crypto.markdown b/doc/api/crypto.markdown index 19b88c2f860..b1833b28f8e 100644 --- a/doc/api/crypto.markdown +++ b/doc/api/crypto.markdown @@ -57,6 +57,8 @@ This can be called many times with new data as it is streamed. Calculates the digest of all of the passed data to be hashed. The `encoding` can be `'hex'`, `'binary'` or `'base64'`. +Note: `hash` object can not be used after `digest()` method been called. + ### crypto.createHmac(algorithm, key) @@ -75,13 +77,26 @@ This can be called many times with new data as it is streamed. Calculates the digest of all of the passed data to the hmac. The `encoding` can be `'hex'`, `'binary'` or `'base64'`. +Note: `hmac` object can not be used after `digest()` method been called. -### crypto.createCipher(algorithm, key) -Creates and returns a cipher object, with the given algorithm and key. +### crypto.createCipher(algorithm, password) + +Creates and returns a cipher object, with the given algorithm and password. `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. -On recent releases, `openssl list-cipher-algorithms` will display the available cipher algorithms. +On recent releases, `openssl list-cipher-algorithms` will display the +available cipher algorithms. +`password` is used to derive key and IV, which must be `'binary'` encoded +string (See the [Buffers](buffers.html) for more information). + +### crypto.createCipheriv(algorithm, key, iv) + +Creates and returns a cipher object, with the given algorithm, key and iv. + +`algorithm` is the same as the `createCipher()`. `key` is a raw key used in +algorithm. `iv` is an Initialization vector. `key` and `iv` must be `'binary'` +encoded string (See the [Buffers](buffers.html) for more information). ### cipher.update(data, input_encoding='binary', output_encoding='binary') @@ -95,10 +110,18 @@ Returns the enciphered contents, and can be called many times with new data as i Returns any remaining enciphered contents, with `output_encoding` being one of: `'binary'`, `'base64'` or `'hex'`. -### crypto.createDecipher(algorithm, key) +Note: `cipher` object can not be used after `final()` method been called. + + +### crypto.createDecipher(algorithm, password) Creates and returns a decipher object, with the given algorithm and key. -This is the mirror of the cipher object above. +This is the mirror of the [createCipher()](#crypto.createCipher) above. + +### crypto.createDecipheriv(algorithm, key, iv) + +Creates and returns a decipher object, with the given algorithm, key and iv. +This is the mirror of the [createCipheriv()](#crypto.createCipheriv) above. ### decipher.update(data, input_encoding='binary', output_encoding='binary') @@ -110,6 +133,8 @@ The `output_decoding` specifies in what format to return the deciphered plaintex Returns any remaining plaintext which is deciphered, with `output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`. +Note: `decipher` object can not be used after `final()` method been called. + ### crypto.createSign(algorithm) @@ -129,6 +154,9 @@ Calculates the signature on all the updated data passed through the signer. Returns the signature in `output_format` which can be `'binary'`, `'hex'` or `'base64'`. +Note: `signer` object can not be used after `sign()` method been called. + + ### crypto.createVerify(algorithm) Creates and returns a verification object, with the given algorithm. @@ -149,6 +177,8 @@ signature for the data, in the `signature_format` which can be `'binary'`, Returns true or false depending on the validity of the signature for the data and public key. +Note: `verifier` object can not be used after `verify()` method been called. + ### crypto.createDiffieHellman(prime_length) Creates a Diffie-Hellman key exchange object and generates a prime of the diff --git a/doc/api/http.markdown b/doc/api/http.markdown index 497adba5528..ad102eb204f 100644 --- a/doc/api/http.markdown +++ b/doc/api/http.markdown @@ -42,7 +42,7 @@ per connection (in the case of keep-alive connections). When a new TCP stream is established. `socket` is an object of type `net.Socket`. Usually users will not want to access this event. The - `stream` can also be accessed at `request.connection`. + `socket` can also be accessed at `request.connection`. ### Event: 'close' @@ -283,6 +283,8 @@ Note: that Content-Length is given in bytes not characters. The above example works because the string `'hello world'` contains only single byte characters. If the body contains higher coded characters then `Buffer.byteLength()` should be used to determine the number of bytes in a given encoding. +And Node does not check whether Content-Length and the length of the body +which has been transmitted are equal or not. ### response.statusCode @@ -294,6 +296,9 @@ Example: response.statusCode = 404; +After response header was sent to the client, this property indicates the +status code which was sent out. + ### response.setHeader(name, value) Sets a single header value for implicit headers. If this header already exists @@ -528,6 +533,8 @@ event, the entire body will be caught. }); This is a `Writable Stream`. +Note: Node does not check whether Content-Length and the length of the body +which has been transmitted are equal or not. This is an `EventEmitter` with the following events: diff --git a/lib/crypto.js b/lib/crypto.js index d7f403ed100..83b2bb8122e 100644 --- a/lib/crypto.js +++ b/lib/crypto.js @@ -118,8 +118,8 @@ exports.createHmac = function(hmac, key) { exports.Cipher = Cipher; -exports.createCipher = function(cipher, key) { - return (new Cipher).init(cipher, key); +exports.createCipher = function(cipher, password) { + return (new Cipher).init(cipher, password); }; @@ -129,8 +129,8 @@ exports.createCipheriv = function(cipher, key, iv) { exports.Decipher = Decipher; -exports.createDecipher = function(cipher, key) { - return (new Decipher).init(cipher, key); +exports.createDecipher = function(cipher, password) { + return (new Decipher).init(cipher, password); };