diff options
author | Piotr Sawicki <p.sawicki2@partner.samsung.com> | 2017-09-18 15:59:15 +0200 |
---|---|---|
committer | Piotr Sawicki <p.sawicki2@partner.samsung.com> | 2017-09-19 11:17:26 +0200 |
commit | f13b881aa15173401d63e4fad73d248268edaf41 (patch) | |
tree | e186b614d8ede1336e5a8f2dd0012d1faa2b50ec | |
parent | f5502639c446f67e735e9fb33d91122fe8baa1a3 (diff) | |
download | cert-svc-tizen_4.0_tv.tar.gz cert-svc-tizen_4.0_tv.tar.bz2 cert-svc-tizen_4.0_tv.zip |
Let the import function return list with real aliasestizen_4.0_tv
To be consistent with certsvc_pkcs12_load_certificate_list_from_store(),
the new function certsvc_pkcs12_import_from_file_to_store_ret_list()
should return the list of intermediate certificates with aliases taken
from an imported certificate chain.
Change-Id: I22d31c59fc8943b9e08113a6ac290bfe1867a1eb
-rw-r--r-- | src/vcore/pkcs12.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/vcore/pkcs12.cpp b/src/vcore/pkcs12.cpp index 3e0cc70..5734004 100644 --- a/src/vcore/pkcs12.cpp +++ b/src/vcore/pkcs12.cpp @@ -296,9 +296,9 @@ int installChainCert(CertStoreType storeType, const std::string &cert, const std::string &gname, const std::string &endCertGname, + const std::string &commonName, CertType type) { - std::string commonName = getCommonName(type, cert); return vcore_client_install_certificate_to_store( storeType, gname.c_str(), @@ -710,19 +710,19 @@ int insertToStore(CertStoreType storeTypes, } for (size_t i = 0; i < ncerts; i++) { - if (i == ncerts - 1) - result = installChainCert(storeType, certChainBuffer[i], certChainName[i], endCertName, - P12_TRUSTED); - else - result = installChainCert(storeType, certChainBuffer[i], certChainName[i], endCertName, - P12_INTERMEDIATE); + CertType type = (i == ncerts - 1) ? P12_TRUSTED : P12_INTERMEDIATE; + + std::string commonName = getCommonName(type, certChainBuffer[i]); + + result = installChainCert(storeType, certChainBuffer[i], certChainName[i], endCertName, + commonName, type); if (result != CERTSVC_SUCCESS) { LogError("Failed to install the ca certificates. result : " << result); return result; } - int res = appendStoreListNode(certList, length, certChainName[i], alias, storeType); + int res = appendStoreListNode(certList, length, certChainName[i], commonName, storeType); if (res != CERTSVC_SUCCESS) { LogError("Failed to append store list node."); return result; |