From: Krzysztof Jackiewicz Date: Tue, 4 Apr 2023 07:51:40 +0000 (+0200) Subject: [ITC][key-manager][Non-ACR] Fix pkcs test X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=32db9ca7c75e9580ce8b1aa9f85a92feea789128;p=test%2Ftct%2Fnative%2Fapi.git [ITC][key-manager][Non-ACR] Fix pkcs test The test uses empty passwords when saving pkcs but it passes non-empty passwords when getting the pkcs back. The test was passing before because key-manager silently ignored such cases. Now it returns an error. Also the polices were passed in incorrect order. Fix the test by using passwords both when saving and getting the pkcs and fixing the policy order. Change-Id: I8963a73c0e7cf3547dc5dba1db55960edd9f3d3b --- diff --git a/src/itc/key-manager/ITs-key-manager.c b/src/itc/key-manager/ITs-key-manager.c index c495f37a7..f51a6354c 100755 --- a/src/itc/key-manager/ITs-key-manager.c +++ b/src/itc/key-manager/ITs-key-manager.c @@ -1041,10 +1041,10 @@ int ITc_ckmc_get_save_pkcs12_p(void) ckmc_policy_s cert_policy; ckmc_policy_s policy; - cert_policy.password = NULL; + cert_policy.password = (char*)cert_password; cert_policy.extractable = true; - policy.password = NULL; + policy.password = (char*)key_password; policy.extractable = true; if ( false == KeyManagerAppendToAppDataPath(PATHPFX, pszFilePath) ) @@ -1056,7 +1056,7 @@ int ITc_ckmc_get_save_pkcs12_p(void) int nRet = ckmc_pkcs12_load(pszFilePath, PASSPHRASEPFX, &pkcs12); //Target API PRINT_RESULT_CLEANUP(CKMC_ERROR_NONE, nRet, "ckmc_pkcs12_load", KeyMngrGetError(nRet), RemoveAlias(pszAlias)); - nRet = ckmc_save_pkcs12(pszAlias, pkcs12, cert_policy, policy); + nRet = ckmc_save_pkcs12(pszAlias, pkcs12, policy, cert_policy); PRINT_RESULT_CLEANUP(CKMC_ERROR_NONE, nRet, "ckmc_save_pkcs12", KeyMngrGetError(nRet), RemoveAlias(pszAlias)); nRet = ckmc_get_pkcs12(pszAlias, key_password, cert_password, &pkcs12);