os/security/cryptoservices/filebasedcertificateandkeystores/test/keytool/keytool_remove.cpp
First public contribution.
2 * Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <mctkeystore.h>
21 #include "keytool_utils.h"
22 #include "keytool_commands.h"
23 #include "keytool_controller.h"
25 #include <keytool.rsg>
27 /*static*/ CKeytoolRemove* CKeytoolRemove::NewLC(CKeyToolController* aController)
29 CKeytoolRemove* self = new (ELeave) CKeytoolRemove(aController);
30 CleanupStack::PushL(self);
35 /*static*/ CKeytoolRemove* CKeytoolRemove::NewL(CKeyToolController* aController)
37 CKeytoolRemove* self = CKeytoolRemove::NewLC(aController);
38 CleanupStack::Pop(self);
42 CKeytoolRemove::CKeytoolRemove(CKeyToolController* aController) : CKeytoolList(aController)
46 CKeytoolRemove::~CKeytoolRemove()
52 void CKeytoolRemove::RunL()
54 if (iStatus.Int() != KErrNone)
56 User::Leave(iStatus.Int());
63 iKeyList = KeyToolUtils::MatchKey(iKeys, *iParams->iDefault);
64 if (iKeyList.Count() > 0)
66 iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus);
72 User::Leave(KErrNotFound);
74 /*CCTKeyInfo* theKey = KeyToolUtils::findKey(iKeys, *iParams->iDefault);
77 iKeyStore->DeleteKey(theKey->Handle(), iStatus);
84 User::Leave(KErrNotFound);
92 if (idx < iKeyList.Count())
94 iKeyStore->DeleteKey(iKeyList[idx]->Handle(), iStatus);
99 iController->DisplayLocalisedMsgL(R_KEYTOOL_ERR_DELETESUCCESS);
100 CActiveScheduler::Stop();
106 User::Panic(_L("REMOVE action: Illegal state."), 1);