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