wvsettings20/IMPSSrc/CIMPSSAPSecurer.h
changeset 0 094583676ce7
equal deleted inserted replaced
-1:000000000000 0:094583676ce7
       
     1 /*
       
     2 * Copyright (c) 2005 Nokia Corporation and/or its subsidiary(-ies). 
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  IMPS SAP Settings Store implementation.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef __CIMPSSAPSECURER_H__
       
    20 #define __CIMPSSAPSECURER_H__
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 // FORWARD DECLARATIONS
       
    26 class C3DES; 				// 3DES block ciphers for encryption/decryption
       
    27 class CBlockTransformation;	// block transformer
       
    28 
       
    29 // CONST
       
    30 const TInt KSSS3DESKeySize = 24; // 24 bytes
       
    31 
       
    32 /**
       
    33 *  Implementation for CIMPSSAPSettingsStore.
       
    34 *  Handles the 3DES encryption and decryption of SAP passwords.
       
    35 *
       
    36 *  @see CIMPSSAPSettingStore
       
    37 *  @lib WVSAPSettings.dll
       
    38 *  @since 3.1
       
    39 */
       
    40 NONSHARABLE_CLASS( CIMPSSAPSecurer ) : public CBase
       
    41     {
       
    42 
       
    43 public:  // Constructors and destructor
       
    44 
       
    45     /**
       
    46     * Two-phased constructor.
       
    47     */
       
    48     static CIMPSSAPSecurer* NewL();
       
    49 
       
    50     /**
       
    51     * Destructor.
       
    52     */
       
    53     virtual ~CIMPSSAPSecurer();
       
    54 
       
    55 private: //Constructors
       
    56 
       
    57     /**
       
    58     * C++ default constructor.
       
    59     */
       
    60     CIMPSSAPSecurer();
       
    61 
       
    62     /**
       
    63     * By default Symbian 2nd phase constructor is private.
       
    64     */
       
    65     void ConstructL();
       
    66 
       
    67 public:
       
    68 
       
    69     /**
       
    70      * Encrypts given buffer and returns ownership
       
    71      * of the buffer to calling object
       
    72      *
       
    73      * @param aPwdBuffer The password to be encrypted
       
    74      * @return HBufC* Result of encryption
       
    75      * @since 3.1
       
    76      */
       
    77     HBufC* EncryptPwdL( const TDesC& aPwdBuffer );
       
    78 
       
    79     /**
       
    80      * Decrypts given buffer and returns ownership
       
    81      * of the buffer to calling object
       
    82      *
       
    83      * @param aPwdBuffer The password to be decrypted
       
    84      * @return HBufC* Result of decryption
       
    85      * @since 3.1
       
    86      */
       
    87     HBufC* DecryptPwdL( const TDesC& aPwdBuffer );
       
    88 
       
    89 public:
       
    90 
       
    91     /**
       
    92      * Fetches the phone's serial number (IMEI number).
       
    93      *
       
    94      * @param aImei Pointer to descriptor where the IMEI is saved.
       
    95      * @since 3.1
       
    96      */
       
    97     void FetchIMEI( TPtr8& aImei );
       
    98 
       
    99     /**
       
   100      * Gets the encryption key for use with 3DES encryption.
       
   101      *
       
   102      * @param aKey Pointer to descriptor where the key is saved.
       
   103      * @since 3.1
       
   104      */
       
   105 
       
   106     void GetPwdKeyL( TPtr8& aKey );
       
   107 
       
   108 private: // data
       
   109 
       
   110     // Key for encrypting/decrypting user password in SAP container (own)
       
   111     HBufC8* iEncryptionKey;
       
   112 
       
   113     // A buffer for encryption/decryption handling to avoid
       
   114     // reoccurring allocs (own)
       
   115     HBufC8* iTransformBlock;
       
   116 
       
   117     // Password encryptor (own)
       
   118     CBlockTransformation* iEncryptor;
       
   119 
       
   120     // Password decryptor (own)
       
   121     CBlockTransformation* iDecryptor;
       
   122 
       
   123     };
       
   124 
       
   125 
       
   126 
       
   127 #endif // __CIMPSSAPSECURER_H__
       
   128