smf/smfcredentialmgr/smfcredmgrclient/smfcredmgrclient.cpp
changeset 24 1cee9f1b95e0
parent 18 013a02bf2bb0
child 26 83d6a149c755
equal deleted inserted replaced
23:574948b60dab 24:1cee9f1b95e0
    33 
    33 
    34 QString SmfCredMgrClient::StoreAuthData(SmfAuthParams Set, QDateTime Validity,
    34 QString SmfCredMgrClient::StoreAuthData(SmfAuthParams Set, QDateTime Validity,
    35 		QList<QUrl> URLList, QStringList PluginList, QString AuthAppId,
    35 		QList<QUrl> URLList, QStringList PluginList, QString AuthAppId,
    36 		bool Flag)
    36 		bool Flag)
    37 	{
    37 	{
       
    38 	QString qs = NULL;
    38 	if (!(Set.isEmpty() || URLList.isEmpty() || PluginList.isEmpty()
    39 	if (!(Set.isEmpty() || URLList.isEmpty() || PluginList.isEmpty()
    39 			|| AuthAppId.isEmpty() || Validity.isNull()))
    40 			|| AuthAppId.isEmpty() || Validity.isNull()))
    40 		{
    41 		{
    41 		QT_TRAP_THROWING( return (m_SmfClientPrivate->storeAuthDataL(Set, Validity, URLList,
    42 		QT_TRAP_THROWING(qs  = m_SmfClientPrivate->storeAuthDataL(Set, Validity, URLList,
    42 				PluginList, AuthAppId, Flag)) );
    43 					PluginList, AuthAppId, Flag));
    43 		}
    44 		}
    44 	else
    45 	return qs;
    45 		{
       
    46 		return NULL;
       
    47 		}
       
    48 	}
    46 	}
    49 
    47 
    50 QStringList SmfCredMgrClient::AuthenticatedPluginList(QString RegistrationToken) const
    48 QStringList SmfCredMgrClient::AuthenticatedPluginList(QString RegistrationToken) const
    51 	{
    49 	{
    52 	QStringList List;
    50 	QStringList List;
    87 		}
    85 		}
    88 	}
    86 	}
    89 
    87 
    90 bool SmfCredMgrClient::CheckPluginAuthentication(QString PluginID) const
    88 bool SmfCredMgrClient::CheckPluginAuthentication(QString PluginID) const
    91 	{
    89 	{
       
    90 	bool tb = false;
    92 	if (!(PluginID.isEmpty()))
    91 	if (!(PluginID.isEmpty()))
    93 		{
    92 		{
    94 		QT_TRAP_THROWING ( return (m_SmfClientPrivate->isPluginAuthenticatedL(PluginID)) );
    93 		QT_TRAP_THROWING (tb = m_SmfClientPrivate->isPluginAuthenticatedL(PluginID));
    95 		}
    94 		}
    96 	else
    95 	return tb;
    97 		{
       
    98 		return false;
       
    99 		}
       
   100 	}
    96 	}
   101 
    97 
   102 bool SmfCredMgrClient::AuthDataSet(QString RegToken, QDateTime Validity,
    98 bool SmfCredMgrClient::AuthDataSet(QString RegToken, QDateTime Validity,
   103 		SmfAuthParams& AuthTokenSet) const
    99 		SmfAuthParams& AuthTokenSet) const
   104 	{
   100 	{
   106 		{
   102 		{
   107 		TBool Flag = EFalse;
   103 		TBool Flag = EFalse;
   108 		QT_TRAP_THROWING ( Flag = m_SmfClientPrivate->AuthDataSetL(RegToken, Validity, AuthTokenSet));
   104 		QT_TRAP_THROWING ( Flag = m_SmfClientPrivate->AuthDataSetL(RegToken, Validity, AuthTokenSet));
   109 		if (Flag)
   105 		if (Flag)
   110 			return true;
   106 			return true;
       
   107 		else
       
   108 			return false;
   111 		}
   109 		}
   112 	else
   110 	else
   113 		{
   111 		{
   114 		AuthTokenSet.clear();
   112 		AuthTokenSet.clear();
   115 		return false;
   113 		return false;
   117 	}
   115 	}
   118 
   116 
   119 QString SmfCredMgrClient::StoreRSAKeys(const QString KeyLabel,
   117 QString SmfCredMgrClient::StoreRSAKeys(const QString KeyLabel,
   120 		const QString keydata, const QDateTime Validity)
   118 		const QString keydata, const QDateTime Validity)
   121 	{
   119 	{
       
   120 	QString qs = NULL;
   122 	if (!(KeyLabel.isEmpty() || keydata.isEmpty()) && Validity.isValid())
   121 	if (!(KeyLabel.isEmpty() || keydata.isEmpty()) && Validity.isValid())
   123 		{
   122 		{
   124 		QT_TRAP_THROWING ( return (m_SmfClientPrivate->storeRSAKeysL(KeyLabel, keydata, Validity)) );
   123 		QT_TRAP_THROWING (qs = m_SmfClientPrivate->storeRSAKeysL(KeyLabel, keydata, Validity));
   125 		}
   124 		}
   126 	else
   125 	return qs;
   127 		{
       
   128 		return NULL;
       
   129 		}
       
   130 	}
   126 	}
       
   127 
   131 SMFCredMgrErrorCode SmfCredMgrClient::SignMessage(QString Message, QString Key,
   128 SMFCredMgrErrorCode SmfCredMgrClient::SignMessage(QString Message, QString Key,
   132 		QString& Signature, SmfSignatureMethod AlgorithmUsed)
   129 		QString& Signature, SmfSignatureMethod AlgorithmUsed)
   133 	{
   130 	{
       
   131 	SMFCredMgrErrorCode ec = SmfErrBadParameter;
   134 	if (!(Message.isEmpty() || Key.isEmpty()))
   132 	if (!(Message.isEmpty() || Key.isEmpty()))
   135 		{
   133 		{
   136 		QT_TRAP_THROWING ( return (m_SmfClientPrivate->signMessageL(Message, Key, Signature,
   134 		QT_TRAP_THROWING ( ec = m_SmfClientPrivate->signMessageL(Message, Key, 
   137 				AlgorithmUsed)) );
   135 				Signature,AlgorithmUsed));
   138 		}
   136 		}
   139 	else
   137 	return ec;
   140 		{
       
   141 		return SmfErrBadParameter;
       
   142 		}
       
   143 	}
   138 	}
   144 
   139 
   145 void SmfCredMgrClient::DeleteRSAKey(QString KeyLabel)
   140 void SmfCredMgrClient::DeleteRSAKey(QString KeyLabel)
   146 	{
   141 	{
   147 	if (!(KeyLabel.isEmpty()))
   142 	if (!(KeyLabel.isEmpty()))