     @block_num = 0
     super(decrypt, saltpack_block_len, true)
 
-  _transform = (chunk, encoding, cb) ->
+  _transform : (chunk, encoding, cb) ->
     if not @header_read
-      {@header_hash, header_list, @decryptor.secretKey, @mac_key} = header.parse_encryption_header_packet(@decryptor, msgpack.encode(chunk))
+      {@header_hash, _, seckey, @mac_key} = header.parse_encryption_header_packet(@decryptor, msgpack.encode(chunk))
+      @decryptor.secretKey = seckey
       @header_read = true
       cb()
     else

nonce = require('./nonce.iced')

saltpack_block_len = (1024**2)

exports.EncryptStream = class EncryptStream extends stream.ChunkStream
  encrypt = (chunk) ->

      super(chunk, encoding, cb)

  _flush : (cb) ->
    super(noop)
    @push(encrypt(new Buffer('')))
    cb()
