/*
   +----------------------------------------------------------------------+
   | Copyright (c) 2002-2005 J Smith <dark_panda@hushmail.com>            |
   | Crypto++ sources (not included) copyright (c) 1995-2003 Wei Dai      |
   +----------------------------------------------------------------------+
   | Check out COPYING for the exact license.                             |
   +----------------------------------------------------------------------+

$Id: jcipher_t.h,v 1.6 2005/01/06 18:16:42 jay Exp $
*/

#ifndef __JCIPHER_T_H__
#define __JCIPHER_T_H__

#include "jbasiccipherinfo.h"

template <typename INFO, enum Cipher TYPE, unsigned int DEFAULT_ROUNDS = 0, unsigned int MIN_ROUNDS = 0, unsigned int MAX_ROUNDS = 0>
class JCipher_Template : public JBasicCipherInfo<INFO, JCipher>
{
	public:
		JCipher_Template();

		inline unsigned int getValidRounds(const unsigned int rounds) const;
		inline enum Cipher getCipherType() const;
		inline unsigned int getBlockSize() const;

		bool encrypt();
		bool decrypt();

		bool encryptPHPStream(php_stream* in, php_stream* out);
		bool decryptPHPStream(php_stream* in, php_stream* out);

		/* These are deprecated. They were used before using php_streams. Use them
		   if you're using this code in something other than the cryptopp PHP
		   extension...
		bool encryptFile(const string in, const string out);
		bool decryptFile(const string in, const string out); */

	protected:
		virtual BlockCipher* getEncryptionObject() = 0;
		virtual BlockCipher* getDecryptionObject() = 0;
};

#include "jcipher_t.cpp"

#endif
