Back to index

lightning-sunbird  0.9+nobinonly
nsStreamCipher.h
Go to the documentation of this file.
00001 /* ***** BEGIN LICENSE BLOCK *****
00002  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00003  *
00004  * The contents of this file are subject to the Mozilla Public License Version
00005  * 1.1 (the "License"); you may not use this file except in compliance with
00006  * the License. You may obtain a copy of the License at
00007  * http://www.mozilla.org/MPL/
00008  *
00009  * Software distributed under the License is distributed on an "AS IS" basis,
00010  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00011  * for the specific language governing rights and limitations under the
00012  * License.
00013  *
00014  * The Initial Developer of the Original Code is Google Inc.
00015  * Portions created by the Initial Developer are Copyright (C) 2006
00016  * the Initial Developer. All Rights Reserved.
00017  *
00018  * Contributor(s):
00019  *   Tony Chang <tc@google.com>
00020  *
00021  * Alternatively, the contents of this file may be used under the terms of
00022  * either the GNU General Public License Version 2 or later (the "GPL"), or
00023  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00024  * in which case the provisions of the GPL or the LGPL are applicable instead
00025  * of those above. If you wish to allow use of your version of this file only
00026  * under the terms of either the GPL or the LGPL, and not to allow others to
00027  * use your version of this file under the terms of the MPL, indicate your
00028  * decision by deleting the provisions above and replace them with the notice
00029  * and other provisions required by the GPL or the LGPL. If you do not delete
00030  * the provisions above, a recipient may use your version of this file under
00031  * the terms of any one of the MPL, the GPL or the LGPL.
00032  *
00033  * ***** END LICENSE BLOCK ***** */
00034 
00035 #ifndef _NS_STREAMCIPHER_H_
00036 #define _NS_STREAMCIPHER_H_
00037 
00038 #include "nsIStreamCipher.h"
00039 #include "nsString.h"
00040 #include "pk11func.h"
00041 
00042 #define NS_STREAMCIPHER_CLASSNAME  "Stream Cipher Component"
00043 /* dbfcbe4a-10f7-4d6f-a481-68e6d6b71d21 */
00044 #define NS_STREAMCIPHER_CID   \
00045 { 0xdbfcbe4a, 0x10f7, 0x4d6f, {0xa4, 0x81, 0x68, 0xe6, 0xd6, 0xb7, 0x1d, 0x21}}
00046 #define NS_STREAMCIPHER_CONTRACTID "@mozilla.org/security/streamcipher;1"
00047 
00048 class nsStreamCipher : public nsIStreamCipher
00049 {
00050 public:
00051   nsStreamCipher();
00052 
00053   NS_DECL_ISUPPORTS
00054   NS_DECL_NSISTREAMCIPHER
00055 
00056 private:
00057   ~nsStreamCipher();
00058 
00059   // Helper method for initializing this object.
00060   // aIV may be null.
00061   nsresult InitWithIV_(nsIKeyObject *aKey, SECItem* aIV);
00062   
00063   // Disallow copy constructor
00064   nsStreamCipher(nsStreamCipher&);
00065 
00066   // Holds our stream cipher context.
00067   PK11Context* mContext;
00068 
00069   // Holds the amount we've computed so far.
00070   nsCString mValue;
00071 };
00072 
00073 #endif // _NS_STREAMCIPHER_H_