sl@0: /* sl@0: * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of the License "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * crypto keys definition - including symmetric & asymmetric keys sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @file sl@0: @publishedAll sl@0: @released sl@0: */ sl@0: sl@0: #ifndef __CRYPTOAPI_KEYS_H__ sl@0: #define __CRYPTOAPI_KEYS_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: namespace CryptoSpi sl@0: { sl@0: class CCryptoParam; sl@0: /** sl@0: The key property definition. sl@0: */ sl@0: class TKeyProperty sl@0: { sl@0: public: sl@0: /** sl@0: Algorithm UID of this Key sl@0: */ sl@0: TUid iAlgorithmUid; sl@0: sl@0: /** sl@0: Implementation ID of the key generator sl@0: */ sl@0: TUid iImplementationUid; sl@0: sl@0: /** sl@0: Key Type sl@0: */ sl@0: TUid iKeyType; sl@0: sl@0: /** sl@0: Key Attribute sl@0: */ sl@0: TUid iKeyAttribute; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: The key definition sl@0: */ sl@0: NONSHARABLE_CLASS(CKey) : public CBase sl@0: { sl@0: public: sl@0: sl@0: /** sl@0: Creates a new key from a key property and key parameters. sl@0: @param aKeyProperty The key property for the new key sl@0: @param aKeyParameters The list of the key parameters sl@0: @return A pointer to a CKey instance sl@0: */ sl@0: IMPORT_C static CKey* NewL(const TKeyProperty& aKeyProperty, const CCryptoParams& aKeyParameters); sl@0: sl@0: /** sl@0: Creates a new key from a key property and key parameters. sl@0: Leave the Ckey pointer on the cleanup stack. sl@0: @param aKeyProperty The key property for the new key sl@0: @param aKeyParameters The list of the key parameters sl@0: @return A pointer to a CKey instance sl@0: */ sl@0: IMPORT_C static CKey* NewLC(const TKeyProperty& aKeyProperty, const CCryptoParams& aKeyParameters); sl@0: sl@0: /** sl@0: Creates a new key from a CKey object. sl@0: @param aKey the source CKey object. sl@0: @return A pointer to a CKey instance sl@0: */ sl@0: IMPORT_C static CKey* NewL(const CKey& aKey); sl@0: sl@0: /** sl@0: Creates a new key from a CKey object. sl@0: Leave the Ckey pointer on the cleanup stack. sl@0: @param aKey the source CKey object. sl@0: @return A pointer to a CKey instance sl@0: */ sl@0: IMPORT_C static CKey* NewLC(const CKey& aKey); sl@0: sl@0: /** sl@0: Destructor sl@0: */ sl@0: IMPORT_C ~CKey(); sl@0: sl@0: /** sl@0: Retrieve the key property sl@0: @return The reference of the key property sl@0: */ sl@0: IMPORT_C const TKeyProperty& KeyProperty() const; sl@0: sl@0: /** sl@0: Retrieve the Key Parameter according to the UID of the parameter sl@0: @param aUid The UID of the key parameter sl@0: */ sl@0: IMPORT_C const TInteger& GetBigIntL(TUid aUid) const; sl@0: IMPORT_C TInt GetTIntL(TUid aUid) const; sl@0: IMPORT_C const TDesC8& GetTDesC8L(TUid aUid) const; sl@0: sl@0: IMPORT_C TBool IsPresent(TUid aUid) const; sl@0: sl@0: /** sl@0: Retrieve the key property and key parameter sl@0: @param aKeyProperty The key property sl@0: @return The key parameters sl@0: */ sl@0: IMPORT_C const CCryptoParams& KeyParameters() const; sl@0: sl@0: private: sl@0: /** sl@0: constructor sl@0: */ sl@0: CKey(const TKeyProperty& aKeyProperty); sl@0: sl@0: /** sl@0: 2nd Phase Constructor sl@0: */ sl@0: void ConstructL(const CCryptoParams& aKeyParameters); sl@0: sl@0: private: sl@0: /** sl@0: The Key Parameters of this object sl@0: */ sl@0: CCryptoParams* iKeyParameters; sl@0: sl@0: /** sl@0: the key property sl@0: */ sl@0: TKeyProperty iKeyProperty; sl@0: }; sl@0: sl@0: } // namespace CryptoSpi sl@0: sl@0: #endif //__CRYPTOAPI_KEYS_H__ sl@0: sl@0: