authenticationservices/authenticationserver/source/server/transientkey.h
changeset 102 deec7e509f66
parent 94 0e6c5a9328b5
child 108 ca9a0fc2f082
equal deleted inserted replaced
94:0e6c5a9328b5 102:deec7e509f66
     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 * CTransientKey declaration
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 /**
       
    21  @file 
       
    22  @released
       
    23  @internalComponent
       
    24 */
       
    25 
       
    26 #ifndef TRANSIENTKEY_H
       
    27 #define TRANSIENTKEY_H
       
    28 
       
    29 #include <pbe.h>
       
    30 #include "authserver_client.h"
       
    31 #include "encryptedprotectionkey.h"
       
    32 
       
    33 namespace AuthServer
       
    34 {
       
    35 
       
    36 /**
       
    37  * CTransientKey is a cryptographic key that is generated on the fly and never
       
    38  * stored on the device.  Transient keys are used to encrypt and decrypt
       
    39  * protection keys, they are generated by the AuthServer using data gathered
       
    40  * from CAuthPlugin derived classes.
       
    41  */
       
    42 class CTransientKey : public CBase
       
    43 	{
       
    44 public:
       
    45 	
       
    46 	/**
       
    47 	 * Creates a new transient key, passing in the plugin data from which to
       
    48 	 * derive it.
       
    49 	 *
       
    50 	 * @param aEncryptor encryption element to use as the key. Ownership
       
    51 	 * passes to this object.
       
    52 	 **/
       
    53 	static CTransientKey* NewL(CPBEncryptElement* aEncryptor);
       
    54 
       
    55 	/**
       
    56 	 * Creates a new transient key, passing in the plugin data from which to
       
    57 	 * derive it.
       
    58 	 *
       
    59 	 * @param aEncryptor encryption element to use as the key. Ownership
       
    60 	 * passes to this object.
       
    61 	 **/
       
    62 	static CTransientKey* NewLC(CPBEncryptElement* aEncryptor);
       
    63 
       
    64 	~CTransientKey();
       
    65 
       
    66 	/**
       
    67 	 * Create an version of the provided protection key encrypted by this
       
    68 	 * key. Ownership of the returned object is passed to the caller.
       
    69 	 *
       
    70 	 * @param aKey the protection key to encrypt.
       
    71 	 *
       
    72 	 * @return an protection key encrypted by this key.
       
    73 	 **/
       
    74 	CEncryptedProtectionKey* EncryptL(const CProtectionKey& aKey) const;
       
    75 
       
    76 	/**
       
    77 	 * Decrypts an CEncryptedProtectionKey created by this transient
       
    78 	 * key. Ownership of the returned object is passed to the caller.
       
    79 	 *
       
    80 	 * @param aKey the encrypted protection key to decrypt.
       
    81 	 *
       
    82 	 * @return a protection key
       
    83 	 **/
       
    84 	CProtectionKey* DecryptL(const CEncryptedProtectionKey& aKey) const;
       
    85 
       
    86 		
       
    87 private:
       
    88 	void ConstructL(CPBEncryptElement* aEncryptor);
       
    89 	
       
    90 	CPBEncryptElement* iPbeElement;
       
    91     };
       
    92 }
       
    93 
       
    94 #endif // TRANSIENTKEY_H