vpnengine/pkiservice/src/pkisupport.cpp
changeset 4 29b591713d44
parent 1 c9c2ad51f972
child 38 9f4e37332ce5
equal deleted inserted replaced
3:2df28d7a2299 4:29b591713d44
   723 // ---------------------------------------------------------------------------
   723 // ---------------------------------------------------------------------------
   724 // ?description_if_needed
   724 // ?description_if_needed
   725 // ---------------------------------------------------------------------------
   725 // ---------------------------------------------------------------------------
   726 //
   726 //
   727 void CPKISupport::RetrieveCertificateL(const TDesC &aLabel, 
   727 void CPKISupport::RetrieveCertificateL(const TDesC &aLabel, 
   728     const TPKIKeyIdentifier& aCertificateKeyId,
       
   729     TPtr8 &aBufferPtr, const TPKICertificateOwnerType& aType, 
   728     TPtr8 &aBufferPtr, const TPKICertificateOwnerType& aType, 
   730     TRequestStatus& aStatus)
   729     TRequestStatus& aStatus)
   731 {
   730 {
   732     LOG(Log::Printf(_L("Retrieve certificate\n")));
   731     LOG(Log::Printf(_L("Retrieve certificate\n")));
   733     iSupportStatus = KErrNone;
   732     iSupportStatus = KErrNone;
   734     iCerts.Close();
   733     iCerts.Close();
   735     iSubState = ESSContinue;
   734     iSubState = ESSContinue;
   736     iOutBufferPtr = &aBufferPtr;
   735     iOutBufferPtr = &aBufferPtr;
   737     SetCallerStatusPending( aStatus );
   736     SetCallerStatusPending( aStatus );
   738     SelectCertificateL(aLabel, aCertificateKeyId, aType);
   737     SelectCertificateL(aLabel, aType);
   739 }
   738 }
   740 
   739 
   741 // ---------------------------------------------------------------------------
   740 // ---------------------------------------------------------------------------
   742 // ?description_if_needed
   741 // ?description_if_needed
   743 // ---------------------------------------------------------------------------
   742 // ---------------------------------------------------------------------------
  1069 // ---------------------------------------------------------------------------
  1068 // ---------------------------------------------------------------------------
  1070 // ?description_if_needed
  1069 // ?description_if_needed
  1071 // ---------------------------------------------------------------------------
  1070 // ---------------------------------------------------------------------------
  1072 //
  1071 //
  1073 void CPKISupport::RemoveCertificateL(const TDesC &aLabel, 
  1072 void CPKISupport::RemoveCertificateL(const TDesC &aLabel, 
  1074     const TPKIKeyIdentifier& aCertificateKeyId,
       
  1075     TRequestStatus& aStatus)
  1073     TRequestStatus& aStatus)
  1076 {
  1074 {
  1077     LOG(Log::Printf(_L("Remove certificate\n")));
  1075     LOG(Log::Printf(_L("Remove certificate\n")));
  1078     iSupportStatus = KErrNone;
  1076     iSupportStatus = KErrNone;
  1079     iCerts.Close();
  1077     iCerts.Close();
  1080     iSubState = ESSContinue;
  1078     iSubState = ESSContinue;
  1081     SetCallerStatusPending( aStatus );
  1079     SetCallerStatusPending( aStatus );
  1082     SelectCertificateL(aLabel, aCertificateKeyId);
  1080     SelectCertificateL(aLabel);
  1083 }
  1081 }
  1084 
  1082 
  1085 // ---------------------------------------------------------------------------
  1083 // ---------------------------------------------------------------------------
  1086 // ?description_if_needed
  1084 // ?description_if_needed
  1087 // ---------------------------------------------------------------------------
  1085 // ---------------------------------------------------------------------------
  1098 // ---------------------------------------------------------------------------
  1096 // ---------------------------------------------------------------------------
  1099 // ?description_if_needed
  1097 // ?description_if_needed
  1100 // ---------------------------------------------------------------------------
  1098 // ---------------------------------------------------------------------------
  1101 //
  1099 //
  1102 void CPKISupport::SetTrustL(const TDesC &aLabel, 
  1100 void CPKISupport::SetTrustL(const TDesC &aLabel, 
  1103     const TPKIKeyIdentifier& aCertificateKeyId,
       
  1104     TBool aTrusted, TRequestStatus& aStatus)
  1101     TBool aTrusted, TRequestStatus& aStatus)
  1105 {
  1102 {
  1106     LOG(Log::Printf(_L("SetTrust\n")));
  1103     LOG(Log::Printf(_L("SetTrust\n")));
  1107     iSupportStatus = KErrNone;
  1104     iSupportStatus = KErrNone;
  1108     iCerts.Close();
  1105     iCerts.Close();
  1109     iSubState = ESSContinue;
  1106     iSubState = ESSContinue;
  1110     iTrusted = aTrusted;
  1107     iTrusted = aTrusted;
  1111     SetCallerStatusPending( aStatus );
  1108     SetCallerStatusPending( aStatus );
  1112     SelectCertificateL(aLabel, aCertificateKeyId);
  1109     SelectCertificateL(aLabel);
  1113 }
  1110 }
  1114 
  1111 
  1115 // ---------------------------------------------------------------------------
  1112 // ---------------------------------------------------------------------------
  1116 // ?description_if_needed
  1113 // ?description_if_needed
  1117 // ---------------------------------------------------------------------------
  1114 // ---------------------------------------------------------------------------
  1127 // ---------------------------------------------------------------------------
  1124 // ---------------------------------------------------------------------------
  1128 // ?description_if_needed
  1125 // ?description_if_needed
  1129 // ---------------------------------------------------------------------------
  1126 // ---------------------------------------------------------------------------
  1130 //
  1127 //
  1131 void CPKISupport::TrustedL(const TDesC &aLabel, 
  1128 void CPKISupport::TrustedL(const TDesC &aLabel, 
  1132                            const TPKIKeyIdentifier& aCertificateKeyId, 
       
  1133                            TRequestStatus& aStatus)
  1129                            TRequestStatus& aStatus)
  1134 {
  1130 {
  1135     LOG(Log::Printf(_L("Trusted\n")));
  1131     LOG(Log::Printf(_L("Trusted\n")));
  1136     iSupportStatus = KErrNone;
  1132     iSupportStatus = KErrNone;
  1137     iCerts.Close();
  1133     iCerts.Close();
  1138     iSubState = ESSContinue;
  1134     iSubState = ESSContinue;
  1139     SetCallerStatusPending( aStatus );
  1135     SetCallerStatusPending( aStatus );
  1140     SelectCertificateL(aLabel, aCertificateKeyId);
  1136     SelectCertificateL(aLabel);
  1141 }
  1137 }
  1142 
  1138 
  1143 // ---------------------------------------------------------------------------
  1139 // ---------------------------------------------------------------------------
  1144 // ?description_if_needed
  1140 // ?description_if_needed
  1145 // ---------------------------------------------------------------------------
  1141 // ---------------------------------------------------------------------------
  1155 // ---------------------------------------------------------------------------
  1151 // ---------------------------------------------------------------------------
  1156 // ?description_if_needed
  1152 // ?description_if_needed
  1157 // ---------------------------------------------------------------------------
  1153 // ---------------------------------------------------------------------------
  1158 //
  1154 //
  1159 void CPKISupport::SetApplicabilityL(const TDesC &aLabel, 
  1155 void CPKISupport::SetApplicabilityL(const TDesC &aLabel, 
  1160                                     const TPKIKeyIdentifier& aCertificateKeyId,
       
  1161                                     const RArray<TUid>& aApplUids, TRequestStatus& aStatus)
  1156                                     const RArray<TUid>& aApplUids, TRequestStatus& aStatus)
  1162 {
  1157 {
  1163     LOG(Log::Printf(_L("SetApplicability\n")));
  1158     LOG(Log::Printf(_L("SetApplicability\n")));
  1164     iSupportStatus = KErrNone;
  1159     iSupportStatus = KErrNone;
  1165     iCerts.Close();
  1160     iCerts.Close();
  1168 	for(TInt i = 0;i<aApplUids.Count();i++)
  1163 	for(TInt i = 0;i<aApplUids.Count();i++)
  1169 		{
  1164 		{
  1170 		iApplUids.Append(aApplUids[i]);
  1165 		iApplUids.Append(aApplUids[i]);
  1171 		}
  1166 		}
  1172     SetCallerStatusPending( aStatus );
  1167     SetCallerStatusPending( aStatus );
  1173     SelectCertificateL(aLabel, aCertificateKeyId);
  1168     SelectCertificateL(aLabel);
  1174 }
  1169 }
  1175 
  1170 
  1176 // ---------------------------------------------------------------------------
  1171 // ---------------------------------------------------------------------------
  1177 // ContinueSetApplicability
  1172 // ContinueSetApplicability
  1178 // ---------------------------------------------------------------------------
  1173 // ---------------------------------------------------------------------------
  1188 
  1183 
  1189 // ---------------------------------------------------------------------------
  1184 // ---------------------------------------------------------------------------
  1190 // ?description_if_needed
  1185 // ?description_if_needed
  1191 // ---------------------------------------------------------------------------
  1186 // ---------------------------------------------------------------------------
  1192 //
  1187 //
  1193 void CPKISupport::ApplicationsL(const TDesC &aLabel, const TPKIKeyIdentifier& aCertificateKeyId,
  1188 void CPKISupport::ApplicationsL(const TDesC &aLabel,
  1194                                 TRequestStatus& aStatus)
  1189                                 TRequestStatus& aStatus)
  1195 {
  1190 {
  1196     LOG(Log::Printf(_L("Applications\n")));
  1191     LOG(Log::Printf(_L("Applications\n")));
  1197     iSupportStatus = KErrNone;
  1192     iSupportStatus = KErrNone;
  1198     iCerts.Close();
  1193     iCerts.Close();
  1199     iSubState = ESSContinue;
  1194     iSubState = ESSContinue;
  1200     SetCallerStatusPending( aStatus );
  1195     SetCallerStatusPending( aStatus );
  1201     SelectCertificateL(aLabel, aCertificateKeyId);
  1196     SelectCertificateL(aLabel);
  1202 }
  1197 }
  1203 
  1198 
  1204 // ---------------------------------------------------------------------------
  1199 // ---------------------------------------------------------------------------
  1205 // ContinueApplications
  1200 // ContinueApplications
  1206 // ---------------------------------------------------------------------------
  1201 // ---------------------------------------------------------------------------
  1218 // ---------------------------------------------------------------------------
  1213 // ---------------------------------------------------------------------------
  1219 // SelectCertificateL
  1214 // SelectCertificateL
  1220 // ---------------------------------------------------------------------------
  1215 // ---------------------------------------------------------------------------
  1221 //
  1216 //
  1222 void CPKISupport::SelectCertificateL(const TDesC &aLabel, 
  1217 void CPKISupport::SelectCertificateL(const TDesC &aLabel, 
  1223                                      const TPKIKeyIdentifier& aCertificateKeyId,
       
  1224                                      const TPKICertificateOwnerType& aType )
  1218                                      const TPKICertificateOwnerType& aType )
  1225 {
  1219 {
  1226     delete iCertFilter;
  1220     delete iCertFilter;
  1227     iCertFilter = NULL;
  1221     iCertFilter = NULL;
  1228     iCertFilter = CCertAttributeFilter::NewL();
  1222     iCertFilter = CCertAttributeFilter::NewL();
  1229 
  1223 
  1230     LOG(Log::Printf(_L(" Select by label: %S\n"), &aLabel));
  1224     LOG(Log::Printf(_L(" Select by label: %S\n"), &aLabel));
  1231     iCertFilter->SetLabel(aLabel);
  1225     iCertFilter->SetLabel(aLabel);
  1232     iCertFilter->SetSubjectKeyId(aCertificateKeyId);
  1226 
  1233     if (aType != 0) 
  1227     if (aType != 0) 
  1234         {
  1228         {
  1235         LOG_1(" Select by owner type: %d", aType);
  1229         LOG_1(" Select by owner type: %d", aType);
  1236         iCertFilter->SetOwnerType(TCertificateOwnerType(aType));
  1230         iCertFilter->SetOwnerType(TCertificateOwnerType(aType));
  1237         }
  1231         }