+++ /dev/null
-//
-// Open Service Platform
-// Copyright (c) 2012 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Apache License, Version 2.0 (the License);
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//
-/**
- * @file DeviceManager.cpp
- * @brief This is the implementation file for %DeviceManager class.
- */
-
-#include <dlfcn.h>
-#include <unique_ptr.h>
-
-#include <FIoRegistry.h>
-#include <FBase_StringConverter.h>
-
-#include "DeviceManager.h"
-#include "InstallerDefs.h"
-
-using namespace Tizen::Base;
-using namespace Tizen::Base::Collection;
-using namespace Tizen::Io;
-
-DeviceManager::DeviceManager(void)
-:__pContext(null)
-,__isMdmEnable(false)
-{
- if (IsMdmEnable() == true)
- {
- __isMdmEnable = true;
- }
-}
-
-DeviceManager::~DeviceManager(void)
-{
- if (__isMdmEnable == true)
- {
- ReleaseService();
- }
-}
-
-bool
-DeviceManager::Construct(InstallationContext* pContext)
-{
- __pContext = pContext;
-
- return true;
-}
-
-bool
-DeviceManager::IsInstallationDisabled() const
-{
- if (__isMdmEnable == false)
- {
- return false;
- }
-
- TryReturn(__pContext, false, "__pContext is null.");
- TryReturn(__pContext->__packageId.IsEmpty() == false, false, "packageId is empty.");
-
- std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__pContext->__packageId));
- TryReturn(pPackageId, false, "pPackageId is null.");
-
- int res = IsInstallationDisabled(pPackageId.get());
- if (res == 1)
- {
- AppLog("[%s] can't be installed.", pPackageId.get());
- return true;
- }
- else
- {
- AppLog("[%s] can be installed.", pPackageId.get());
- return false;
- }
-}
-
-bool
-DeviceManager::IsUninstallationDisabled() const
-{
- if (__isMdmEnable == false)
- {
- return false;
- }
-
- TryReturn(__pContext, false, "__pContext is null.");
- TryReturn(__pContext->__packageId.IsEmpty() == false, false, "packageId is empty.");
-
- std::unique_ptr<char[]> pPackageId(_StringConverter::CopyToCharArrayN(__pContext->__packageId));
- TryReturn(pPackageId, false, "pPackageId is null.");
-
- int res = IsUninstallationDisabled(pPackageId.get());
- if (res == 1)
- {
- AppLog("[%s] can't be uninstalled.", pPackageId.get());
- return true;
- }
- else
- {
- AppLog("[%s] can be uninstalled.", pPackageId.get());
- return false;
- }
-}
-
-bool
-DeviceManager::IsPrivilegeBlacklist() const
-{
- if (__isMdmEnable == false)
- {
- return true;
- }
-
- TryReturn(__pContext, false, "__pContext is null.");
- TryReturn(__pContext->__pPrivilegeList, false, "pPrivilegeList is null.");
-
- return IsPrivilegeBlacklist(__pContext->__pPrivilegeList);
-}
-
-bool
-DeviceManager::IsSignatureBlacklist() const
-{
- if (__isMdmEnable == false)
- {
- return true;
- }
-
- TryReturn(__pContext, false, "__pContext is null.");
- TryReturn(__pContext->__pAuthorCertList, false, "pAuthorCertList is null.");
-
- return IsSignatureBlacklist(__pContext->__pAuthorCertList);
-}
-
-bool
-DeviceManager::IsMdmEnable() const
-{
- result r;
- Registry reg;
- String section(L"feature");
- String entry(L"mdm");
- String value;
-
- r = reg.Construct(CONFIG_PATH, "r");
- TryReturn(!IsFailed(r), false, "CONFIG file is not found.");
-
- r = reg.GetValue(section, entry, value);
- TryReturn(!IsFailed(r), false, "GetValue is failed. entry = [%ls]", entry.GetPointer());
-
- AppLog("[%ls is %ls.]", entry.GetPointer(), value.GetPointer());
-
- if (value == L"on")
- {
- if (GetService() == 0)
- {
- return true;
- }
- }
-
- return false;
-}
-
-int
-DeviceManager::GetService() const
-{
- int ret = 0;
- void* pHandle = null;
- char* pErrorMsg = null;
- int (*mdm_get_service)(void) = null;
-
- pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL);
- if (!pHandle)
- {
- AppLog("dlopen() failed. [%s]", dlerror());
- return -1;
- }
-
- mdm_get_service = reinterpret_cast <int (*)(void)>(dlsym(pHandle, "mdm_get_service"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != null) || (mdm_get_service == null))
- {
- AppLog("dlsym() failed. [%s]", pErrorMsg);
- dlclose(pHandle);
- return -1;
- }
-
- AppLog("[mdm] mdm_get_service()");
- ret = mdm_get_service();
- AppLog("[mdm] mdm_get_service, result = [%d]", ret);
-
- dlclose(pHandle);
-
- return ret;
-}
-
-int
-DeviceManager::ReleaseService() const
-{
- int ret = 0;
- void* pHandle = null;
- char* pErrorMsg = null;
- int (*mdm_release_service)(void) = null;
-
- pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL);
- if (!pHandle)
- {
- AppLog("dlopen() failed. [%s]", dlerror());
- return -1;
- }
-
- mdm_release_service = reinterpret_cast <int (*)(void)>(dlsym(pHandle, "mdm_release_service"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != null) || (mdm_release_service == null))
- {
- AppLog("dlsym() failed. [%s]", pErrorMsg);
- dlclose(pHandle);
- return -1;
- }
-
- AppLog("[mdm] mdm_release_service()");
- ret = mdm_release_service();
- AppLog("[mdm] mdm_release_service, result = [%d]", ret);
-
- dlclose(pHandle);
-
- return ret;
-}
-
-int
-DeviceManager::IsInstallationDisabled(const char* pPackageId) const
-{
- int ret = 0;
- void* pHandle = null;
- char* pErrorMsg = null;
- int (*mdm_get_application_installation_disabled)(const char*) = null;
-
- pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL);
- if (!pHandle)
- {
- AppLog("dlopen() failed. [%s]", dlerror());
- return -1;
- }
-
- mdm_get_application_installation_disabled = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "mdm_get_application_installation_disabled"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != null) || (mdm_get_application_installation_disabled == null))
- {
- AppLog("dlsym() failed. [%s]", pErrorMsg);
- dlclose(pHandle);
- return -1;
- }
-
- AppLog("[mdm] mdm_get_application_installation_disabled(%s)", pPackageId);
- ret = mdm_get_application_installation_disabled(pPackageId);
- AppLog("[mdm] mdm_get_application_installation_disabled(%s), result = [%d]", pPackageId, ret);
-
- dlclose(pHandle);
-
- return ret;
-}
-
-int
-DeviceManager::IsUninstallationDisabled(const char* pPackageId) const
-{
- int ret = 0;
- void* pHandle = null;
- char* pErrorMsg = null;
- int (*mdm_get_application_uninstallation_disabled)(const char*) = null;
-
- pHandle = dlopen("/usr/lib/libmdm.so.1", RTLD_LAZY | RTLD_GLOBAL);
- if (!pHandle)
- {
- AppLog("dlopen() failed. [%s]", dlerror());
- return -1;
- }
-
- mdm_get_application_uninstallation_disabled = reinterpret_cast <int (*)(const char*)>(dlsym(pHandle, "mdm_get_application_uninstallation_disabled"));
- pErrorMsg = dlerror();
- if ((pErrorMsg != null) || (mdm_get_application_uninstallation_disabled == null))
- {
- AppLog("dlsym() failed. [%s]", pErrorMsg);
- dlclose(pHandle);
- return -1;
- }
-
- AppLog("[mdm] mdm_get_application_uninstallation_disabled(%s)", pPackageId);
- ret = mdm_get_application_uninstallation_disabled(pPackageId);
- AppLog("[mdm] mdm_get_application_uninstallation_disabled(%s), result = [%d]", pPackageId, ret);
-
- dlclose(pHandle);
-
- return ret;
-}
-
-bool
-DeviceManager::IsPrivilegeBlacklist(ArrayList* pPrivilegeList) const
-{
- //mdm_data_t *mdm_get_app_privilege_blacklist(void);
- return true;
-}
-
-bool
-DeviceManager::IsSignatureBlacklist(IListT<String *>* pSignatureList) const
-{
- //mdm_data_t *mdm_get_app_signature_blacklist(void);
- return true;
-}
SignatureManager::SignatureManager(void)
:__pContext(null)
-//,__pAuthorSignature(null)
-//,__pDistributorSignature(null)
-//,__pAuthorCertPath(null)
-//,__pDistributorCertPath(null)
{
}
SignatureManager::~SignatureManager(void)
{
-// delete __pAuthorSignature;
-// delete __pDistributorSignature;
-// delete __pAuthorCertPath;
-// delete __pDistributorCertPath;
}
bool
return PRIVILEGE_LEVEL_PUBLIC;
}
-#if 0
-bool
-SignatureManager::SetSignature()
-{
- TryReturn(__pContext, false, "__pContext is null.");
-
- bool ret = true;
- char* pSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetSignatureXmlPath());
- char* pAuthorSignaturePath = _StringConverter::CopyToCharArrayN(__pContext->GetAuthorSignatureXmlPath());
-
- __pDistributorSignature = new (std::nothrow) SignatureHandler;
- TryCatch(__pDistributorSignature, ret = false, "__pDistributorSignature is null");
-
- ret = __pDistributorSignature->Construct(__pContext);
- TryCatch(ret == true, ret = false, "__pDistributorSignature->Construct is failed.");
-
- ret = __pDistributorSignature->Parse(pSignaturePath);
- TryCatch(ret == true, ret = false, "__pDistributorSignature->Parse is failed.");
-
- __pAuthorSignature = new (std::nothrow) SignatureHandler;
- TryCatch(__pAuthorSignature, ret = false, "__pAuthorSignature is null");
-
- ret = __pAuthorSignature->Construct(__pContext);
- TryCatch(ret == true, ret = false, "__pAuthorSignature->Construct is failed.");
-
- ret = __pAuthorSignature->Parse(pAuthorSignaturePath);
- TryCatch(ret == true, ret = false, "__pAuthorSignature->Parse is failed.");
-
-CATCH:
- delete[] pSignaturePath;
- delete[] pAuthorSignaturePath;
- return ret;
-}
-
-bool
-SignatureManager::AddCert()
-{
- TryReturn(__pAuthorSignature, false, "__pAuthorSignature is null.");
- TryReturn(__pDistributorSignature, false, "__pDistributorSignature is null.");
-
- bool ret = true;
- IList* pAuthorCertChain = __pAuthorSignature->GetAuthorCertChain();
- IList* pDistributorCertChain = __pDistributorSignature->GetDistributorCertChain();
-
- if (pAuthorCertChain)
- {
- AppLog("AddCertificate - AuthorCertChain");
-
- __pAuthorCertPath = new (std::nothrow) X509CertificatePath();
- TryCatch(__pAuthorCertPath, ret = false, "__pAuthorCertPath is null.");
-
- ret = AddCertificate(__pAuthorCertPath, pAuthorCertChain);
- TryCatch(ret == true, ret = false, "AddCertificate(AuthorCert) is failed.");
-
- ret = AddAuthorRootCert(__pAuthorCertPath);
- TryCatch(ret == true, ret = false, "AddAuthorRootCert(AuthorCertPath) is failed.");
- }
-
- if (pDistributorCertChain)
- {
- AppLog("AddCertificate - DistributorCert");
-
- __pDistributorCertPath = new (std::nothrow) X509CertificatePath();
- TryCatch(__pDistributorCertPath, ret = false, "__pDistributorCertPath is null.");
-
- ret = AddCertificate(__pDistributorCertPath, pDistributorCertChain);
- TryCatch(ret == true, ret = false, "AddCertificate(DistributorCert) is failed.");
-
- ret = AddDistributorRootCert(__pDistributorCertPath);
- TryCatch(ret == true, ret = false, "AddDistributorRootCert(DistributorCert) is failed.");
- }
-
-CATCH:
- return ret;
-}
-
-bool
-SignatureManager::VerifyChain()
-{
- TryReturn(__pAuthorCertPath, false, "__pAuthorCertPath is null.");
- TryReturn(__pDistributorCertPath, false, "__pDistributorCertPath is null.");
-
- bool ret = true;
-
- AppLog("AuthorCert Validate - START");
- ret = Validate(__pAuthorCertPath);
- AppLog("AuthorCert Validate - END");
- TryCatch(ret == true, ret = false, "Validate(AuthorCert) is failed.");
-
- SetCertificatePath(SIGNATURE_FILE_TYPE_AUTHOR, __pAuthorCertPath);
- __pAuthorCertPath = null;
-
- AppLog("DistributorCert Validate - START");
- ret = Validate(__pDistributorCertPath);
- AppLog("DistributorCert Validate - END");
- TryCatch(ret == true, ret = false, "Validate(DistributorCert) is failed.");
-
- SetCertificatePath(SIGNATURE_FILE_TYPE_DISTRIBUTOR, __pDistributorCertPath);
- __pDistributorCertPath = null;
-
-CATCH:
- delete __pAuthorCertPath;
- __pAuthorCertPath = null;
- delete __pDistributorCertPath;
- __pDistributorCertPath = null;
-
- return ret;
-}
-#endif
-
bool
SignatureManager::SetAuthorCertValue(void* pHandle, IListT<String *>* pCertList) const
{
}
bool
-SignatureManager::SetCertificatePath(SignatureFileType type, X509CertificatePath* pCertPath)
-{
- TryReturn(pCertPath, false, "pCertPath is null.");
- TryReturn(__pContext, false, "__pContext is null.");
-
- IListT<String *>* pList = null;
-
- if (type == SIGNATURE_FILE_TYPE_AUTHOR)
- {
- pList = __pContext->__pAuthorCertList;
- }
- else if (type == SIGNATURE_FILE_TYPE_DISTRIBUTOR)
- {
- pList = __pContext->__pDistributorCertList;
- }
- else if (type == SIGNATURE_FILE_TYPE_DISTRIBUTOR2)
- {
- pList = __pContext->__pDistributorCertList2;
- }
- else
- {
- TryReturn(0, false, "SignatureFileType is unknown, type = [%d]", (int)type);
- }
-
- for (int i = 0; i < pCertPath->GetLength(); i++)
- {
- std::unique_ptr<ICertificate> pCert(pCertPath->GetCertificateN(i));
- TryReturn(pCert, false, "pCert is null, [%i].", i);
-
- bool res = false;
- String certValue;
- res = GetCertValue(pCert.get(), certValue);
- TryReturn(res == true, false, "GetCertValue() is failed, [%d].", i);
-
- result r = pList->Add(new String(certValue));
- TryReturn(!IsFailed(r), false, "pList->Add() is failed, [%d]", i);
-
- AppLog("------------------------------------------");
- AppLog("CertValue[%d], certType[%d]", i, (int)type);
- AppLog("[%ls]", certValue.GetPointer());
- }
-
- return true;
-}
-
-bool
SignatureManager::GetCertValue(ICertificate* pCert, String& value) const
{
result r = E_SUCCESS;
return true;
}
-
-#if 0
-bool
-SignatureManager::AddCertificate(X509CertificatePath* pCertPath, IList* pCertChain)
-{
- TryReturn(pCertChain, false, "pCertChain is null.");
-
- bool ret = true;
- result r = E_SUCCESS;
- X509Certificate* pCertificate = null;
-
- for (int i = 0; i < pCertChain->GetCount(); i++)
- {
- Tizen::Base::ByteBuffer* pByteBuffer = dynamic_cast <ByteBuffer*>(pCertChain->GetAt(i));
-
- if (pByteBuffer)
- {
- AppLog("[cert][%d]", i);
-
- pCertificate = new (std::nothrow) X509Certificate;
- TryCatch(pCertificate, ret = false, "pCertificate is null.");
-
- r = pCertificate->Construct(*pByteBuffer);
- TryCatch(!IsFailed(r), ret = false, "pCertificate->Construct() is failed.");
-
- r = pCertPath->AddCertificate(*pCertificate);
- TryCatch(!IsFailed(r), ret = false, "AddCertificate is failed.");
-
- delete pCertificate;
- pCertificate = null;
- }
- }
-
-CATCH:
- delete pCertificate;
- return ret;
-}
-
-bool
-SignatureManager::AddAuthorRootCert(X509CertificatePath* pCertPath)
-{
- TryReturn(pCertPath, false, "pCertPath is null.");
-
- result r = E_SUCCESS;
- bool ret = true;
- ByteBuffer byteBuffer;
- X509Certificate rootCert;
- int length = 0;
- const char* pAuthorRootCert = "MIICnzCCAggCCQCn+GGT4zh+BjANBgkqhkiG9w0BAQUFADCBkzELMAkGA1UEBhMC"
- "S1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6"
- "ZW4gVGVzdCBDQTElMCMGA1UECwwcVGl6ZW4gVGVzdCBEZXZlbG9wZXIgUm9vdCBD"
- "QTElMCMGA1UEAwwcVGl6ZW4gVGVzdCBEZXZlbG9wZXIgUm9vdCBDQTAeFw0xMjEw"
- "MjYwOTUwMTNaFw0yMjEwMjQwOTUwMTNaMIGTMQswCQYDVQQGEwJLUjEOMAwGA1UE"
- "CAwFU3V3b24xDjAMBgNVBAcMBVN1d29uMRYwFAYDVQQKDA1UaXplbiBUZXN0IENB"
- "MSUwIwYDVQQLDBxUaXplbiBUZXN0IERldmVsb3BlciBSb290IENBMSUwIwYDVQQD"
- "DBxUaXplbiBUZXN0IERldmVsb3BlciBSb290IENBMIGfMA0GCSqGSIb3DQEBAQUA"
- "A4GNADCBiQKBgQDWT6ZH5JyGadTUK1QmNwU8j+py4WtuElJE+4/wPFP8/KBmvvmI"
- "rGVjhUbKXToKIo8N6C/0SLxGEWuRAIoZHhg5JVbw1Ay7smgJJHizDUAqMTmV6LI9"
- "yTFbBV+OlO2Dir4LVdQ/XDBiqqslr7pqXgsg1V2g7x+tOI/f3dn2kWoVZQIDAQAB"
- "MA0GCSqGSIb3DQEBBQUAA4GBADGJYMtzUBDK+KKLZQ6zYmrKb+OWLlmEr/t/c2af"
- "KjTKUtommcz8VeTPqrDBOwxlVPdxlbhisCYzzvwnWeZk1aeptxxU3kdW9N3/wocN"
- "5nBzgqkkHJnj/ptqjrH2v/m0Z3hBuI4/akHIIfCBF8mUHwqcxYsRdcCIrkgp2Aiv"
- "bSaM";
-
- length = strlen(pAuthorRootCert);
- byteBuffer.Construct(length);
-
- r = byteBuffer.SetArray((byte*)pAuthorRootCert, 0, length);
- TryCatch(!IsFailed(r), ret = false, "SetArray() is failed.");
-
- byteBuffer.Flip();
-
- r = rootCert.Construct(byteBuffer);
- TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed.");
-
- r = pCertPath->AddCertificate(rootCert);
- TryCatch(!IsFailed(r), ret = false, "AddCertificate(AuthorRootCert) is failed.");
-
-CATCH:
- return ret;
-}
-
-bool
-SignatureManager::AddDistributorRootCert(X509CertificatePath* pCertPath)
-{
- TryReturn(pCertPath, false, "pCertPath is null.");
-
- result r = E_SUCCESS;
- bool ret = true;
- ICertificate* pIntermediateCA = null;
- String issuer;
-
- pIntermediateCA = pCertPath->GetCertificateN(1);
- TryCatch(pIntermediateCA, ret = false, "pIntermediateCA is null.");
-
- issuer = pIntermediateCA->GetIssuer();
-
- for(int certType = ROOT_CERTIFICATE_PUBLIC; certType <= ROOT_CERTIFICATE_PARTNER_MANUFACTURER; certType++)
- {
- const char* pRootCert = null;
- ByteBuffer byteBuffer;
- X509Certificate rootCert;
- int length = 0;
-
- if (certType == ROOT_CERTIFICATE_PUBLIC)
- {
- pRootCert = "MIICozCCAgwCCQD9XW6kNg4bbjANBgkqhkiG9w0BAQUFADCBlTELMAkGA1UEBhMC"
- "S1IxDjAMBgNVBAgMBVN1d29uMQ4wDAYDVQQHDAVTdXdvbjEWMBQGA1UECgwNVGl6"
- "ZW4gVGVzdCBDQTEjMCEGA1UECwwaVFRpemVuIERpc3RyaWJ1dG9yIFRlc3QgQ0Ex"
- "KTAnBgNVBAMMIFRpemVuIFB1YmxpYyBEaXN0cmlidXRvciBSb290IENBMB4XDTEy"
- "MTAyNjA4MDAyN1oXDTIyMTAyNDA4MDAyN1owgZUxCzAJBgNVBAYTAktSMQ4wDAYD"
- "VQQIDAVT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emVuIERpc3RyaWJ1dG9y"
- "IFRlc3QgQ0ExNzA1BgNVBAMMLlRpemVuIFBhcnRuZXItTWFudWZhY3R1cmVyIERp"
- "c3RyaWJ1dG9yIFJvb3QgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMJG"
- "0gq3XrDn7W7cIH58w7hSDMVENnXLmXm4Jl5teXXrgL/BgpORracGMgm0Fmxxq/Nq"
- "8OEI2RfmtrlN5nWGiphs3XqLHtO+BAPY1BbZS6YVZjrVXrGWdzk12zQxd6sXJMiV"
- "B08ECQiQ0qgKFbTDSEbH/p4eyKCMG9lnrBLPHTpJAgMBAAGjEDAOMAwGA1UdEwQF"
- "MAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAJTJYCr9GhZ1xXwvxsWLGd9XV9wixo1zk"
- "FV2+eJZbCc4xJyOSb0cZds8fYUuzw32oyElLvPhYfAHVTHu/WlkwSshZlKdI2hCT"
- "Iy03/Up+JNfuom8JLgF7qc3YtbuJHzoVu1jJ/akXU6y52D/J5CkYy2JSsV0KZuh2"
- "ZeRWlV2f1Uo=";
- }
-
- length = strlen(pRootCert);
- byteBuffer.Construct(length);
-
- r = byteBuffer.SetArray((byte*)pRootCert, 0, length);
- TryCatch(!IsFailed(r), ret = false, "SetArray() is failed.");
-
- byteBuffer.Flip();
-
- r = rootCert.Construct(byteBuffer);
- TryCatch(!IsFailed(r), ret = false, "rootCert.Construct() is failed.");
-
- String subject = rootCert.GetSubject();
- AppLog("------------------------------------------");
- AppLog("Issuer = [%ls]", issuer.GetPointer());
- AppLog("Subject = [%ls]", subject.GetPointer());
- AppLog("------------------------------------------");
-
- if (subject == issuer)
- {
- AppLog("subject, issuer is matched.");
-
- r = pCertPath->AddCertificate(rootCert);
- TryCatch(!IsFailed(r), ret = false, "AddCertificate(DistributorRootCert) is failed.");
-
- AppLog("AddCertificate() RootCert = [%d]", certType);
- __pContext->__rootCertType = (RootCertificateType)certType;
-
- ret = true;
-
- break;
- }
- else
- {
- AppLog("subject, issuer is not matched.");
- ret = false;
- }
- }
-
-CATCH:
- delete pIntermediateCA;
- return ret;
-}
-#endif