diff -r 000000000000 -r 95b198f216e5 omadrm/drmengine/keystorage/src/DrmKeyStorage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omadrm/drmengine/keystorage/src/DrmKeyStorage.cpp Thu Dec 17 08:52:27 2009 +0200 @@ -0,0 +1,87 @@ +/* +* Copyright (c) 2002-2004 Nokia Corporation and/or its subsidiary(-ies). +* All rights reserved. +* This component and the accompanying materials are made available +* under the terms of "Eclipse Public License v1.0" +* which accompanies this distribution, and is available +* at the URL "http://www.eclipse.org/legal/epl-v10.html". +* +* Initial Contributors: +* Nokia Corporation - initial contribution. +* +* Contributors: +* +* Description: OMA DRM 2.0 Key Storage +* +*/ + + + +// INCLUDE FILES +#include +#include +#include +#include +#include +#include +#include "DrmKeyStorage.h" + +#ifdef _DEBUG +#define LOGGING +#endif +/* +#ifdef LOGGING +_LIT(KLogDir, "DRM"); +_LIT(KLogName, "KeyStorage.log"); +#include "flogger.h" +#define LOG(string) \ + RFileLogger::Write(KLogDir, KLogName, \ + EFileLoggingModeAppend, string); +#define LOGHEX(buffer) \ + RFileLogger::HexDump(KLogDir, KLogName, \ + EFileLoggingModeAppend, _S(""), _S(""), \ + buffer.Ptr(), buffer.Length()); +#else +#define LOG(string) +#define LOGHEX(buffer) +#endif +*/ +typedef MDrmKeyStorage*(*TStorageConstructor)(RLibrary); + +_LIT(KStdKeyStorageName, "drmstdkeystorage.dll"); +_LIT(KBb5KeyStorageName, "drmbb5keystorage.dll"); +static const TInt KConstructorOrdinal = 1; + +// ----------------------------------------------------------------------------- +// MDrmKeyStorage:: +// +// ----------------------------------------------------------------------------- +// +MDrmKeyStorage::~MDrmKeyStorage() + { + } + +EXPORT_C MDrmKeyStorage* DrmKeyStorageNewL() + { + RLibrary library; + MDrmKeyStorage* storage; + TInt r; + TStorageConstructor constructor; + + r = library.Load(KBb5KeyStorageName); + if (r != KErrNone) + { + r = library.Load(KStdKeyStorageName); + } + User::LeaveIfError(r); + constructor = reinterpret_cast( + library.Lookup(KConstructorOrdinal)); + if (constructor == NULL) + { + User::Leave(KErrNotFound); + } + storage = reinterpret_cast(constructor(library)); + return storage; + } + +// end of file