authenticationservices/authenticationserver/source/server/encryptedprotectionkey.h
changeset 29 ece3df019add
equal deleted inserted replaced
19:cd501b96611d 29:ece3df019add
       
     1 /*
       
     2 * Copyright (c) 2005-2009 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 the License "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: 
       
    15 * CEncryptedProtectionKey declaration
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @released
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #ifndef ENCRYPTEDPROTECTIONKEY_H
       
    27 #define ENCRYPTEDPROTECTIONKEY_H
       
    28 
       
    29 #include "authcommon_impl.h"
       
    30 
       
    31 namespace AuthServer
       
    32 {
       
    33 
       
    34 /**
       
    35  * CEncryptedProtectionKey containst the encrypted version of an identity's
       
    36  * protection key.  Encrypted protection keys are generated via the
       
    37  * CTransientKey class and are stored on the device, unlike the raw
       
    38  * protection key data.
       
    39  */
       
    40 class CEncryptedProtectionKey : public CBase
       
    41 	{
       
    42 public:	
       
    43 
       
    44 	/**
       
    45 	 * Creates a new encrypted key, passing in the encrypted key data. Should
       
    46 	 * really only be called by a CTransientKey::EncryptL. The new object
       
    47 	 * assumes ownership of the data.
       
    48 	 *
       
    49 	 * @param aKeyData the data to use as the encrypted key
       
    50 	 **/
       
    51 	static CEncryptedProtectionKey* NewL(HBufC8* aKeyData);
       
    52 	
       
    53 	/**
       
    54 	 * Creates a new encrypted key, passing in the encrypted key data. Should
       
    55 	 * really only be called by a CTransientKey::EncryptL
       
    56 	 *
       
    57 	 * @param aKeyData the data to use as the encrypted key
       
    58 	 **/
       
    59 	static CEncryptedProtectionKey* NewLC(HBufC8* aKeyData);
       
    60 	
       
    61 	/**
       
    62 	 * Internalize a persisted key  from the stream.
       
    63 	 * @param aSrcData the source data
       
    64 	 **/
       
    65 	static CEncryptedProtectionKey* NewL(RReadStream& aSrcData);	
       
    66 
       
    67 	/**
       
    68 	 * Internalize a persisted key from the stream.
       
    69 	 * @param aSrcData the source data
       
    70 	 **/
       
    71 	static CEncryptedProtectionKey* NewLC(RReadStream& aSrcData);
       
    72 
       
    73 	/**
       
    74 	 * Returns a descriptor to the encrypted key data
       
    75 	 *
       
    76 	 * @return a descriptor pointing to the encrypted key data. 
       
    77 	 **/
       
    78 	TPtrC8 KeyData() const;
       
    79 
       
    80 	/**
       
    81 	 * Writes the key data to the specified write stream. The key can be
       
    82 	 * recreated using the appropriate NewL member.
       
    83 	 *
       
    84 	 * @param aDest the destination write stream.
       
    85 	 *
       
    86 	 **/
       
    87 	void ExternalizeL(RWriteStream& aDest) const;
       
    88 	
       
    89 	~CEncryptedProtectionKey();
       
    90 
       
    91 private:
       
    92 	void ConstructL(HBufC8* aKeyData);
       
    93 	void InternalizeL(RReadStream& aSrcData);
       
    94 
       
    95 	HBufC8* iKeyData;
       
    96     };
       
    97 
       
    98 }
       
    99 
       
   100 #endif // ENCRYPTEDPROTECTIONKEY_H