cryptoservices/filebasedcertificateandkeystores/test/certtool/certtool_addapps.cpp
equal
deleted
inserted
replaced
33 CCertToolAddApps* self = CCertToolAddApps::NewLC(aController); |
33 CCertToolAddApps* self = CCertToolAddApps::NewLC(aController); |
34 CleanupStack::Pop(self); |
34 CleanupStack::Pop(self); |
35 return self; |
35 return self; |
36 } |
36 } |
37 |
37 |
38 CCertToolAddApps::CCertToolAddApps(CCertToolController* aController) : CCertToolList(aController) |
38 CCertToolAddApps::CCertToolAddApps(CCertToolController* aController) : CCertToolList(aController), iCertIndex (-1) |
39 { |
39 { |
40 } |
40 } |
41 |
41 |
42 |
42 |
43 CCertToolAddApps::~CCertToolAddApps() |
43 CCertToolAddApps::~CCertToolAddApps() |
65 else |
65 else |
66 { |
66 { |
67 if (iParams->iDefault) |
67 if (iParams->iDefault) |
68 { |
68 { |
69 // Look for a specific certificate |
69 // Look for a specific certificate |
70 TInt certIndex = -1; |
|
71 for (TInt j = 0; j < iCertInfos.Count(); j++) |
70 for (TInt j = 0; j < iCertInfos.Count(); j++) |
72 { |
71 { |
73 if (iCertInfos[j]->Label() == *iParams->iDefault) |
72 if (iCertInfos[j]->Label() == *iParams->iDefault) |
74 { |
73 { |
75 certIndex = j; |
74 iCertIndex = j; |
76 break; |
75 break; |
77 } |
76 } |
78 } |
77 } |
79 |
78 |
80 if (certIndex != -1) |
79 if (iCertIndex != -1) |
81 { |
80 { |
82 iIndex = certIndex; |
|
83 // Certificate found set app uids! |
81 // Certificate found set app uids! |
84 if (iParams->iCertstoreIndex == -1) |
82 if (iParams->iCertstoreIndex == -1) |
85 { |
83 { |
86 iParams->iCertstoreIndex = 0; |
84 iParams->iCertstoreIndex = 0; |
87 } |
85 } |
88 if (iParams->iCertstoreIndex >= iCertStore->CertStoreCount()) |
86 if (iParams->iCertstoreIndex >= iCertStore->CertStoreCount()) |
89 { |
87 { |
90 iController->DisplayLocalisedMsgL(R_CERTTOOL_ERR_NOTEXIST); |
88 iController->DisplayLocalisedMsgL(R_CERTTOOL_ERR_NOTEXIST); |
91 User::Leave(KErrArgument); |
89 User::Leave(KErrArgument); |
92 } |
90 } |
93 iCertStore->Applications(*iCertInfos[iIndex], iApps, iStatus); |
91 iCertStore->Applications(*iCertInfos[iCertIndex], iApps, iStatus); |
94 iState = ESetApps; |
92 iState = ESetApps; |
95 SetActive(); |
93 SetActive(); |
96 } |
94 } |
97 else |
95 else |
98 { |
96 { |
129 // add the apps to the array |
127 // add the apps to the array |
130 for (TInt j = 0; j < iApps.Count(); j++) |
128 for (TInt j = 0; j < iApps.Count(); j++) |
131 { |
129 { |
132 iParams->iUIDs.Append(iApps[j]); |
130 iParams->iUIDs.Append(iApps[j]); |
133 } |
131 } |
|
132 if(iCertInfos[iCertIndex]->CertificateOwnerType() == ECACertificate) |
|
133 { |
|
134 iState = ESetTrust; |
|
135 } |
|
136 else |
|
137 { |
|
138 iState = EFinished; |
|
139 } |
|
140 iCertStore->SetApplicability(*iCertInfos[iCertIndex], iParams->iUIDs, iStatus); |
|
141 SetActive(); |
|
142 } |
|
143 break; |
|
144 case ESetTrust: |
|
145 { |
134 iState = EFinished; |
146 iState = EFinished; |
135 iCertStore->SetApplicability(*iCertInfos[iIndex], iParams->iUIDs, iStatus); |
147 const TBool caCert = ETrue; |
136 SetActive(); |
148 iCertStore->SetTrust(*iCertInfos[iCertIndex],caCert,iStatus); |
|
149 SetActive(); |
137 } |
150 } |
138 break; |
151 break; |
139 case EFinished: |
152 case EFinished: |
140 { |
153 { |
141 iCertInfos.Close(); |
154 iCertInfos.Close(); |