Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #include "nsISupports.idl"
6 #include "nsIKeyModule.idl"
8 interface nsIInputStream;
10 /**
11 * Stream cipher interface. We're basically copying the interface from
12 * nsICryptoHash interface.
13 */
14 [scriptable, uuid(1d507cd6-1630-4710-af1b-4012dbcc514c)]
15 interface nsIStreamCipher : nsISupports
16 {
17 /**
18 * Initialize a stream cipher.
19 * @param aKey nsIKeyObject
20 */
21 void init(in nsIKeyObject aKey);
23 /**
24 * Initialize a stream cipher with an initialization vector.
25 * @param aKey nsIKeyObject
26 * @param aIV the initialization vector
27 * @param aIVLen the length of the initialization vector
28 */
29 void initWithIV(in nsIKeyObject aKey,
30 [const, array, size_is(aIVLen)] in octet aIV,
31 in unsigned long aIVLen);
33 /**
34 * Update from an array of bytes.
35 */
36 void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen);
38 /**
39 * Update from a stream.
40 */
41 void updateFromStream(in nsIInputStream aStream, in long aLen);
43 /**
44 * A more script friendly method (not in nsICryptoHash interface).
45 */
46 void updateFromString(in ACString aInput);
48 /**
49 * @param aASCII if true then the returned value is a base-64
50 * encoded string. if false, then the returned value is
51 * binary data.
52 */
53 ACString finish(in boolean aASCII);
55 /**
56 * Discard aLen bytes of the keystream.
57 * These days 1536 is considered a decent amount to drop to get
58 * the key state warmed-up enough for secure usage.
59 */
60 void discard(in long aLen);
61 };