backupandrestore/backupengine/src/sbencryptimpl.cpp
changeset 0 d0791faffa3f
equal deleted inserted replaced
-1:000000000000 0:d0791faffa3f
       
     1 // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // Implementation of CSecureBURKeySourceImpl
       
    15 // 
       
    16 //
       
    17 
       
    18 /**
       
    19  @file
       
    20 */
       
    21 #include "sbencryptimpl.h"
       
    22 
       
    23 // If you want this code to actually test encryption then uncomment the next line
       
    24 //#define __TEST_ENCRYPTION__
       
    25 
       
    26 namespace conn
       
    27 	{
       
    28 	/**
       
    29 	Symbian OS constructor
       
    30 	*/
       
    31     CSecureBURKeySourceImpl* CSecureBURKeySourceImpl::NewL()
       
    32     	{
       
    33     	CSecureBURKeySourceImpl* pSelf = new(ELeave) CSecureBURKeySourceImpl();
       
    34     	return pSelf;
       
    35     	}
       
    36     
       
    37     /**
       
    38     Standard C++ constructor 
       
    39     */
       
    40     CSecureBURKeySourceImpl::CSecureBURKeySourceImpl()
       
    41     	{
       
    42     	}
       
    43     
       
    44     /**
       
    45     Standard C++ destructor
       
    46     */
       
    47     CSecureBURKeySourceImpl::~CSecureBURKeySourceImpl()
       
    48     	{
       
    49     	}
       
    50 
       
    51 	/**
       
    52 	See sbencrypt.h
       
    53 	*/
       
    54     void CSecureBURKeySourceImpl::GetDefaultBufferForBackupL(TDriveNumber /*aDrive*/, 
       
    55     														 TBool& aGotBuffer, 
       
    56     														 TDes& /*aBuffer*/)
       
    57     	{
       
    58     	#ifdef __TEST_ENCRYPTION__
       
    59     		_LIT(KTestBuffer, "TEST_BUFFER");
       
    60     		
       
    61     		aGotBuffer = ETrue;
       
    62     		aBuffer = KTestBuffer;
       
    63     	#else
       
    64     		aGotBuffer = EFalse;
       
    65     	#endif
       
    66     	}
       
    67     	
       
    68 	/**
       
    69 	See sbencrypt.h
       
    70 	*/
       
    71     void CSecureBURKeySourceImpl::GetBackupKeyL(TDriveNumber /*aDrive*/, TSecureId /*aSID*/,
       
    72                        							TBool& aDoEncrypt, TDes8& /*aKey*/,
       
    73                        							TBool& aGotBuffer, TDes& /*aBuffer*/)
       
    74     	{
       
    75     	#ifdef __TEST_ENCRYPTION__
       
    76     		_LIT(KTestBuffer, "TEST_BUFFER");
       
    77     		
       
    78     		aDoEncrypt = ETrue;
       
    79     		aKey.AppendNum(aSID);
       
    80     		aGotBuffer = ETrue;
       
    81     		aBuffer = KTestBuffer;
       
    82     	#else
       
    83     		aDoEncrypt = EFalse;
       
    84     		aGotBuffer = EFalse;
       
    85     	#endif
       
    86     	}
       
    87     	
       
    88 	/**
       
    89 	See sbencrypt.h
       
    90 	*/
       
    91     void CSecureBURKeySourceImpl::GetRestoreKeyL(TDriveNumber /*aDrive*/, TSecureId /*aSID*/, 
       
    92                         						 TBool /*aGotBuffer*/, TDes& /*aBuffer*/,
       
    93                         						 TBool &aGotKey, TDes8& /*aKey*/)
       
    94     	{
       
    95     	#ifdef __TEST_ENCRYPTION__
       
    96     		aGotKey = ETrue;
       
    97     		aKey.AppendNum(aSID);
       
    98     	#else
       
    99     		aGotKey = EFalse;
       
   100     	#endif
       
   101     	}
       
   102 
       
   103 	}
       
   104