1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/manager/ssl/public/nsIStreamCipher.idl Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,61 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#include "nsISupports.idl" 1.9 +#include "nsIKeyModule.idl" 1.10 + 1.11 +interface nsIInputStream; 1.12 + 1.13 +/** 1.14 + * Stream cipher interface. We're basically copying the interface from 1.15 + * nsICryptoHash interface. 1.16 + */ 1.17 +[scriptable, uuid(1d507cd6-1630-4710-af1b-4012dbcc514c)] 1.18 +interface nsIStreamCipher : nsISupports 1.19 +{ 1.20 + /** 1.21 + * Initialize a stream cipher. 1.22 + * @param aKey nsIKeyObject 1.23 + */ 1.24 + void init(in nsIKeyObject aKey); 1.25 + 1.26 + /** 1.27 + * Initialize a stream cipher with an initialization vector. 1.28 + * @param aKey nsIKeyObject 1.29 + * @param aIV the initialization vector 1.30 + * @param aIVLen the length of the initialization vector 1.31 + */ 1.32 + void initWithIV(in nsIKeyObject aKey, 1.33 + [const, array, size_is(aIVLen)] in octet aIV, 1.34 + in unsigned long aIVLen); 1.35 + 1.36 + /** 1.37 + * Update from an array of bytes. 1.38 + */ 1.39 + void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen); 1.40 + 1.41 + /** 1.42 + * Update from a stream. 1.43 + */ 1.44 + void updateFromStream(in nsIInputStream aStream, in long aLen); 1.45 + 1.46 + /** 1.47 + * A more script friendly method (not in nsICryptoHash interface). 1.48 + */ 1.49 + void updateFromString(in ACString aInput); 1.50 + 1.51 + /** 1.52 + * @param aASCII if true then the returned value is a base-64 1.53 + * encoded string. if false, then the returned value is 1.54 + * binary data. 1.55 + */ 1.56 + ACString finish(in boolean aASCII); 1.57 + 1.58 + /** 1.59 + * Discard aLen bytes of the keystream. 1.60 + * These days 1536 is considered a decent amount to drop to get 1.61 + * the key state warmed-up enough for secure usage. 1.62 + */ 1.63 + void discard(in long aLen); 1.64 +};