diff -r 000000000000 -r d0791faffa3f backupandrestore/backupengine/inc/sbecompressionandencryption.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/backupandrestore/backupengine/inc/sbecompressionandencryption.h Tue Feb 02 01:11:40 2010 +0200 @@ -0,0 +1,160 @@ +/** +* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: +* Declaration of CSBECompressionAndEncryption class. +* +* +*/ + + + +/** + @file +*/ +#ifndef __SBECOMPRESSIONANDENCRYPTION_H__ +#define __SBECOMPRESSIONANDENCRYPTION_H__ + +#include + +#include "sbtypes.h" + +// Forwards +class CARC4; + +namespace conn + { + // Forwards + class CSecureBUREncryptKeySource; + + /** Constants used in the class below + @internalTechnology + */ + const TInt KKeySize = 32; + /** Constants used in the class below + @internalTechnology + */ + const TInt KEncryptionBufferSize = 256; + + // Template classes for handling byte alignment issues + template void ReadL(T& aT, TPtr8& aBuffer); + template void WriteL(T& aT, TPtr8& aBuffer); + + /** Type: Compression Header + @internalTechnology + */ + class TCompressionHeader + { + public: + TInt iCompressedSize; + TInt iUncompressedSize; + }; + + /** Type: Encryption Header + @internalTechnology + */ + class TEncryptionHeader + { + public: + TBool iEncrypted; + TInt iBufferSize; + TInt iTotalSize; + }; + + /** Handles compression and encryption + @internalTechnology + */ + class CSBECompressAndEncrypt : public CBase + { + public: + // Construtors + static CSBECompressAndEncrypt* NewLC(CSBGenericTransferType*& apTransferType, TPtr8& aInputBlock); + ~CSBECompressAndEncrypt(); + + // Methods + void PackL(TPtr8& aOutputData); + void FreeReservedSpace(TPtr8& aOutputData); + private: + // Constructors + CSBECompressAndEncrypt(); + void ConstructL(CSBGenericTransferType*& apTransferType, TPtr8& aInputBlock); + private: + // Compression statics + const static TInt iCompressionGrowthSize; + + // Members + TBool iDoEncrypt; /* iKey; /* iBuffer; /*