mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 04:05:49 +00:00
62 lines
1.8 KiB
Plaintext
62 lines
1.8 KiB
Plaintext
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "nsISupports.idl"
|
|
#include "nsIKeyModule.idl"
|
|
|
|
interface nsIInputStream;
|
|
|
|
/**
|
|
* Stream cipher interface. We're basically copying the interface from
|
|
* nsICryptoHash interface.
|
|
*/
|
|
[scriptable, uuid(1d507cd6-1630-4710-af1b-4012dbcc514c)]
|
|
interface nsIStreamCipher : nsISupports
|
|
{
|
|
/**
|
|
* Initialize a stream cipher.
|
|
* @param aKey nsIKeyObject
|
|
*/
|
|
void init(in nsIKeyObject aKey);
|
|
|
|
/**
|
|
* Initialize a stream cipher with an initialization vector.
|
|
* @param aKey nsIKeyObject
|
|
* @param aIV the initialization vector
|
|
* @param aIVLen the length of the initialization vector
|
|
*/
|
|
void initWithIV(in nsIKeyObject aKey,
|
|
[const, array, size_is(aIVLen)] in octet aIV,
|
|
in unsigned long aIVLen);
|
|
|
|
/**
|
|
* Update from an array of bytes.
|
|
*/
|
|
void update([const, array, size_is(aLen)] in octet aData, in unsigned long aLen);
|
|
|
|
/**
|
|
* Update from a stream.
|
|
*/
|
|
void updateFromStream(in nsIInputStream aStream, in long aLen);
|
|
|
|
/**
|
|
* A more script friendly method (not in nsICryptoHash interface).
|
|
*/
|
|
void updateFromString(in ACString aInput);
|
|
|
|
/**
|
|
* @param aASCII if true then the returned value is a base-64
|
|
* encoded string. if false, then the returned value is
|
|
* binary data.
|
|
*/
|
|
ACString finish(in boolean aASCII);
|
|
|
|
/**
|
|
* 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.
|
|
*/
|
|
void discard(in long aLen);
|
|
};
|