nsIStreamCipher

Stream cipher interface. We’re basically copying the interface from
nsICryptoHash interface.

Methods

init(aKey)

Initialize a stream cipher.

Parameters

aKey nsIKeyObject

initWithIV(aKey, aIV, aIVLen)

Initialize a stream cipher with an initialization vector.

Parameters

aKey nsIKeyObject
aIV the initialization vector
aIVLen the length of the initialization vector

update(aData, aLen)

Update from an array of bytes.

updateFromStream(aStream, aLen)

Update from a stream.

updateFromString(aInput)

A more script friendly method (not in nsICryptoHash interface).

finish(aASCII)

Parameters

aASCII if true then the returned value is a base-64 encoded string. if false, then the returned value is binary data.

discard(aLen)

Discard aLen bytes of the keystream.
These days 1536 is considered a decent amount to drop to get
the key state warmed-up enough for secure usage.