Refactor log system
[platform/core/security/cert-svc.git] / vcore / src / vcore / CertificateLoader.cpp
index a934f67..1fc800f 100644 (file)
  */
 #include <dpl/assert.h>
 #include <openssl/x509v3.h>
-#include <dpl/log/wrt_log.h>
+#include <dpl/log/log.h>
 #include <dpl/noncopyable.h>
 #include <openssl/ecdsa.h>
 #include <openssl/evp.h>
 
 #include <vcore/Base64.h>
 #include <vcore/CertificateLoader.h>
+
 #ifdef TIZEN_FEATURE_CERT_SVC_OCSP_CRL
 #include <vcore/SSLContainers.h>
 #endif
 
 namespace {
 const int MIN_RSA_KEY_LENGTH = 1024;
-//const char *OID_CURVE_SECP256R1 = "urn:oid:1.2.840.10045.3.1.7";
 } // namespace anonymous
 
 namespace ValidationCore {
-//// COMPARATOR CLASS START ////
-
-//class CertificateLoaderECDSA : public CertificateLoader::CertificateLoaderComparator, VcoreDPL::Noncopyable {
-//public:
-//    CertificateLoaderECDSA(const std::string &publicKey)
-//      : m_ecPublicKey(NULL)
-//      , m_searchKey(NULL)
-//    {
-//        m_bnCtx = BN_CTX_new(); // if fails we can continue anyway
-//        m_tmpPoint = BN_new();  // if fails we can continue anyway
-//        m_initialized = CertificateLoader::convertBase64NodeToBigNum(publicKey, &m_searchKey);
-//
-//        if(!m_initialized)
-//            WrtLogE("Init failed!");
-//    }
-//
-//    virtual bool compare(X509 *x509cert){
-//        if(!m_initialized)
-//            return false;
-//
-//        EVP_PKEY_free(m_ecPublicKey);
-//
-//        m_ecPublicKey = X509_get_pubkey(x509cert);
-//
-//        if(m_ecPublicKey == NULL)
-//            return false;
-//
-//        if(m_ecPublicKey->type != EVP_PKEY_EC){
-//            WrtLogE("ecPublicKey has wrong type!");
-//            return false;
-//        }
-//
-//        // Pointer to internal data of ecPublicKey. Do not free!
-//        EC_KEY *eckey = m_ecPublicKey->pkey.ec;
-//
-//        const EC_POINT *ecpoint = EC_KEY_get0_public_key(eckey);
-//        const EC_GROUP *ecgroup = EC_KEY_get0_group(eckey);
-//
-//        m_tmpPoint = EC_POINT_point2bn(ecgroup, ecpoint, POINT_CONVERSION_UNCOMPRESSED, m_tmpPoint, m_bnCtx);
-//
-//        if(BN_cmp(m_tmpPoint, m_searchKey) == 0)
-//            return true;
-//
-//        return false;
-//    }
-//
-//    ~CertificateLoaderECDSA(){
-//        BN_CTX_free(m_bnCtx);
-//        EVP_PKEY_free(m_ecPublicKey);
-//        BN_free(m_searchKey);
-//        BN_free(m_tmpPoint);
-//    }
-//
-//private:
-//    bool        m_initialized;
-//    EVP_PKEY   *m_ecPublicKey;
-//    BN_CTX     *m_bnCtx;
-//    BIGNUM     *m_searchKey;
-//    BIGNUM     *m_tmpPoint;
-//};
-
-///// COMPARETORS CLASS END /////
-
-//// COMPARATOR RSA CLASS START ////
-
-//class CertificateLoaderRSA : public CertificateLoader::CertificateLoaderComparator, VcoreDPL::Noncopyable {
-//public:
-//    CertificateLoaderRSA(const std::string &m_modulus,const std::string &m_exponent )
-//      : m_rsaPublicKey(NULL)
-//      , m_modulus_bn(NULL)
-//      , m_exponent_bn(NULL)
-//    {
-//
-//        m_initialized_modulus = CertificateLoader::convertBase64NodeToBigNum(m_modulus, &m_modulus_bn);
-//        m_initialized_exponent = CertificateLoader::convertBase64NodeToBigNum(m_exponent, &m_exponent_bn);
-//
-//        if(!m_initialized_modulus || !m_initialized_exponent)
-//            WrtLogE("Init failed!");
-//    }
-//
-//    virtual bool compare(X509 *x509cert){
-//
-//        if(!m_initialized_modulus || !m_initialized_exponent)
-//            return false;
-//
-//        EVP_PKEY_free(m_rsaPublicKey);
-//        m_rsaPublicKey = X509_get_pubkey(x509cert);
-//
-//        if(m_rsaPublicKey == NULL)
-//            return false;
-//
-//        if(m_rsaPublicKey->type != EVP_PKEY_RSA){
-//            WrtLogI("rsaPublicKey has wrong type!");
-//            return false;
-//        }
-//
-//        RSA *rsa = NULL;
-//        rsa = m_rsaPublicKey->pkey.rsa;
-//
-//        if (BN_cmp(m_modulus_bn, rsa->n) == 0 &&
-//            BN_cmp(m_exponent_bn, rsa->e) == 0 ){
-//            WrtLogE ("Compare TRUE");
-//            return true;
-//        }
-//        return false;
-//    }
-//
-//    ~CertificateLoaderRSA(){
-//        EVP_PKEY_free(m_rsaPublicKey);
-//        BN_free(m_modulus_bn);
-//        BN_free(m_exponent_bn);
-//
-//    }
-//
-//private:
-//    bool        m_initialized_modulus;
-//    bool        m_initialized_exponent;
-//    EVP_PKEY   *m_rsaPublicKey;
-//    BIGNUM     *m_modulus_bn;
-//    BIGNUM     *m_exponent_bn;
-//};
-
-///// COMPARETORS RSA CLASS END /////
-
 CertificateLoader::CertificateLoaderResult CertificateLoader::
     loadCertificateBasedOnExponentAndModulus(const std::string &m_modulus,
         const std::string &m_exponent)
 {
     (void) m_modulus;
     (void) m_exponent;
-    WrtLogE("Not implemented.");
+    LogError("Not implemented.");
     return UNKNOWN_ERROR;
-    //    if (m_exponent.empty() || m_modulus.empty())
-    //        return WRONG_ARGUMENTS;
-    //
-    //    CertificateLoaderRSA comparator(m_modulus,m_exponent);
-    //
-    //    CertificateLoaderResult result = NO_ERROR;
-    //    for(int i=0; storeId[i]; ++i){
-    //        result = loadCertificate(std::string(storeId[i]), &comparator);
-    //
-    //        if(result == ERR_NO_MORE_CERTIFICATES)
-    //            continue;
-    //
-    //        return result;
-    //    }
-    //
-    //    return result;
 }
 
 CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificate(
@@ -188,248 +48,26 @@ CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificate(
 {
     (void) storageName;
     (void) cmp;
-    WrtLogE("Not Implemented");
+    LogError("Not Implemented");
     return UNKNOWN_ERROR;
-    //    long int result = OPERATION_SUCCESS;
-    //
-    //    char storeId[CERTMGR_MAX_PLUGIN_ID_SIZE];
-    //    char type[CERTMGR_MAX_CERT_TYPE_SIZE];
-    //    certmgr_cert_id certId;
-    //    certmgr_ctx context;
-    //    certmgr_mem_buff certRetrieved;
-    //    unsigned char buffer[CERTMGR_MAX_BUFFER_SIZE];
-    //
-    //    certmgr_cert_descriptor descriptor;
-    //
-    //    certRetrieved.data = buffer;
-    //    certRetrieved.firstFree = 0;
-    //    certRetrieved.size = CERTMGR_MAX_BUFFER_SIZE;
-    //    certId.storeId = storeId;
-    //    certId.type = type;
-    //
-    //    CERTMGR_INIT_CONTEXT((&context), (sizeof(context)))
-    //
-    //    strncpy(context.storeId, storageName.c_str(), storageName.size());
-    //
-    //    for(certRetrieved.firstFree = 0;
-    //        OPERATION_SUCCESS == (result = certmgr_retrieve_certificate_from_store(&context, &certRetrieved, &certId));
-    //        certRetrieved.firstFree = 0)
-    //    {
-    //
-    //        if(OPERATION_SUCCESS!=certmgr_extract_certificate_data(&certRetrieved, &descriptor)){
-    //            WrtLogE("Extracting Certificate Data failed ");
-    //            continue;
-    //        }
-    //
-    //        const unsigned char *ptr = certRetrieved.data;
-    //
-    //        X509 *x509cert = d2i_X509(NULL, &ptr, certRetrieved.size);
-    //        if(x509cert == NULL){
-    //            certmgr_release_certificate_data(&descriptor);
-    //            WrtLogE("Error extracting certificate (d2i_X509).");
-    //            return UNKNOWN_ERROR;
-    //        }
-    //
-    //        WrtLogD("The subject of this certificate is %s", (descriptor.mandatory.subject));
-    //        if(cmp->compare(x509cert)){
-    //            WrtLogD("Found match. Coping bytes: %d", certRetrieved.size);
-    //            m_certificatePtr = CertificatePtr(new Certificate(certRetrieved));
-    //            certmgr_release_certificate_data(&descriptor);
-    //            X509_free(x509cert);
-    //            break;
-    //        }
-    //
-    //        WrtLogD("Release");
-    //        X509_free(x509cert);
-    //        certmgr_release_certificate_data(&descriptor);
-    //    }
-    //
-    //    if(ERR_NO_MORE_CERTIFICATES == result){
-    //        WrtLogE("Certificates for given DN not found");
-    //        return CERTIFICATE_NOT_FOUND;
-    //    }
-    //
-    //    if(result!= OPERATION_SUCCESS){
-    //        WrtLogE("Certificate Manager Error");
-    //        return UNKNOWN_ERROR;
-    //    }
-    //
-    //    WrtLogD("Exit");
-    //    return NO_ERROR;
 }
 
-// TODO
 CertificateLoader::CertificateLoaderResult CertificateLoader::
     loadCertificateBasedOnSubjectName(const std::string &subjectName)
 {
     (void) subjectName;
-    WrtLogE("Not implemented.");
+    LogError("Not implemented.");
     return UNKNOWN_ERROR;
-    //    if(subjectName.empty())
-    //    {
-    //        return WRONG_ARGUMENTS;
-    //    }
-    //
-    //    long int result = OPERATION_SUCCESS;
-    //
-    //    char storeId[CERTMGR_MAX_PLUGIN_ID_SIZE];
-    //    char type[CERTMGR_MAX_CERT_TYPE_SIZE];
-    //    certmgr_cert_id certId;
-    //    certmgr_ctx context;
-    //    certmgr_mem_buff certRetrieved;
-    //    unsigned char buffer[CERTMGR_MAX_BUFFER_SIZE];
-    //
-    //    certmgr_cert_descriptor descriptor;
-    //
-    //    certRetrieved.data = buffer;
-    //    certRetrieved.firstFree = 0;
-    //    certRetrieved.size = CERTMGR_MAX_BUFFER_SIZE;
-    //    certId.storeId = storeId;
-    //    certId.type = type;
-    //
-    //    CERTMGR_INIT_CONTEXT((&context), (sizeof(context)))
-    //
-    //    for(certRetrieved.firstFree = 0;
-    //        OPERATION_SUCCESS == (result = certmgr_retrieve_certificate_from_store(&context, &certRetrieved, &certId));
-    //        certRetrieved.firstFree = 0)
-    //    {
-    //
-    //        if(OPERATION_SUCCESS!=certmgr_extract_certificate_data(&certRetrieved, &descriptor)){
-    //            WrtLogE("Extracting Certificate Data failed ");
-    //            continue;
-    //        }
-    //
-    //        if(!strcmp(subjectName.c_str(), descriptor.mandatory.subject)){
-    //            WrtLogD("The subject of this certificate is %s", descriptor.mandatory.subject);
-    //            m_certificatePtr = CertificatePtr(new Certificate(certRetrieved));
-    //            certmgr_release_certificate_data(&descriptor);
-    //            break;
-    //        }
-    //        WrtLogD("Release");
-    //        certmgr_release_certificate_data(&descriptor);
-    //    }
-    //
-    //    if(ERR_NO_MORE_CERTIFICATES == result) {
-    //        WrtLogE("Certificates for given DN not found");
-    //        return CERTIFICATE_NOT_FOUND;
-    //    }
-    //    if(result!= OPERATION_SUCCESS){
-    //        WrtLogE("Certificate Manager Error");
-    //        return UNKNOWN_ERROR;
-    //    }
-    //    WrtLogD("Exit");
-    //    return NO_ERROR;
 }
 
-// KW CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateBasedOnIssuerName(const std::string &issuerName, const std::string &serialNumber)
-// KW {
-// KW     if(issuerName.empty() || serialNumber.empty())
-// KW     {
-// KW         return WRONG_ARGUMENTS;
-// KW     }
-// KW
-// KW     if(m_cmBuff.data){
-// KW         delete[] m_cmBuff.data;
-// KW         memset(&m_cmBuff, 0, sizeof(certmgr_mem_buff));
-// KW     }
-// KW
-// KW     WrtLogD("IssuerName: %s , serialNumber: %s", issuerName.c_str(), serialNumber.c_str());
-// KW
-// KW     //used to check status of retrieved certificate
-// KW     long int result = OPERATION_SUCCESS;
-// KW     char storeId[CERTMGR_MAX_PLUGIN_ID_SIZE];
-// KW     char type[CERTMGR_MAX_CERT_TYPE_SIZE];
-// KW     certmgr_cert_id certId;
-// KW     certmgr_ctx context;
-// KW     certmgr_mem_buff certRetrieved;
-// KW     unsigned char buffer[CERTMGR_MAX_BUFFER_SIZE];
-// KW
-// KW     certmgr_cert_descriptor descriptor;
-// KW
-// KW     certRetrieved.data = buffer;
-// KW     certRetrieved.firstFree = 0;
-// KW     certRetrieved.size = CERTMGR_MAX_BUFFER_SIZE;
-// KW     certId.storeId = storeId;
-// KW     certId.type = type;
-// KW
-// KW     CERTMGR_INIT_CONTEXT((&context), (sizeof(context)))
-// KW
-// KW     for(certRetrieved.firstFree = 0;
-// KW         OPERATION_SUCCESS == (result = certmgr_retrieve_certificate_from_store(&context, &certRetrieved, &certId));
-// KW         certRetrieved.firstFree = 0)
-// KW     {
-// KW
-// KW         WrtLogD("Extracting certificate from CertMgr");
-// KW
-// KW         if( OPERATION_SUCCESS != certmgr_extract_certificate_data(&certRetrieved, &descriptor) ){
-// KW             WrtLogE("Extracting Certificate Data failed ");
-// KW             continue;
-// KW         }
-// KW
-// KW         WrtLogD("Issuer: %s", (descriptor.mandatory.issuer).c_str());
-// KW
-// KW         const unsigned char *ptr = certRetrieved.data;
-// KW         char *tmp;
-// KW
-// KW         X509 *x509cert = d2i_X509(NULL, &ptr, certRetrieved.size);
-// KW         std::string serialNO = std::string(tmp = i2s_ASN1_INTEGER(NULL, X509_get_serialNumber(x509cert)));
-// KW         OPENSSL_free(tmp);
-// KW         X509_free(x509cert);
-// KW
-// KW         WrtLogI("Certificate number found: %d", serialNO);
-// KW         WrtLogI("Certificate number looking for: %d", serialNumber);
-// KW
-// KW         if(!strcmp(issuerName.c_str(), descriptor.mandatory.issuer)
-// KW               && serialNumber == serialNO)
-// KW         {
-// KW             WrtLogE("The issuer of this certificate is %s", (descriptor.mandatory.issuer).c_str());
-// KW
-// KW             m_cmBuff.data = new unsigned char[certRetrieved.size];
-// KW             m_cmBuff.firstFree = m_cmBuff.size = certRetrieved.size;
-// KW             memcpy(m_cmBuff.data, certRetrieved.data, certRetrieved.size);
-// KW             certmgr_release_certificate_data(&descriptor);
-// KW             break;
-// KW         }
-// KW         certmgr_release_certificate_data(&descriptor);
-// KW     }
-// KW
-// KW     if(ERR_NO_MORE_CERTIFICATES == result) {
-// KW         WrtLogE("Certificates not found");
-// KW         return CERTIFICATE_NOT_FOUND;
-// KW     }
-// KW     if(result != OPERATION_SUCCESS){
-// KW         WrtLogE("Certificate Manager Error");
-// KW         return UNKNOWN_ERROR;
-// KW     }
-// KW     return NO_ERROR;
-// KW }
-
 CertificateLoader::CertificateLoaderResult CertificateLoader::
     loadCertificateWithECKEY(const std::string &curveName,
         const std::string &publicKey)
 {
     (void) curveName;
     (void) publicKey;
-    WrtLogE("Not implemented.");
+    LogError("Not implemented.");
     return UNKNOWN_ERROR;
-    //    if(curveName != OID_CURVE_SECP256R1){
-    //        WrtLogE("Found field id: %s Expected:", curveName.c_str(), OID_CURVE_SECP256R1.c_str());
-    //        return UNSUPPORTED_CERTIFICATE_FIELD;
-    //    }
-    //
-    //    CertificateLoaderECDSA comparator(publicKey);
-    //
-    //    CertificateLoaderResult result = NO_ERROR;
-    //    for(int i=0; storeId[i]; ++i){
-    //        result = loadCertificate(std::string(storeId[i]), &comparator);
-    //
-    //        if(result == ERR_NO_MORE_CERTIFICATES)
-    //            continue;
-    //
-    //        return result;
-    //    }
-    //
-    //    return result;
 }
 
 CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateFromRawData(const std::string &rawData)
@@ -437,7 +75,7 @@ CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateFro
     VcoreTry {
         m_certificatePtr = CertificatePtr(new Certificate(rawData, Certificate::FORM_BASE64));
     } VcoreCatch(Certificate::Exception::Base) {
-        WrtLogW("Error reading certificate by openssl.");
+        LogWarning("Error reading certificate by openssl.");
         return UNKNOWN_ERROR;
     }
 
@@ -453,12 +91,11 @@ CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateFro
 
                 // key Length (modulus) is in bytes
                 keyLength <<= 3;
-                WrtLogD("RSA key length: %d bits", keyLength);
+                LogDebug("RSA key length: " << keyLength << " bits");
 
                 if (keyLength < MIN_RSA_KEY_LENGTH) {
-                    WrtLogE(
-                        "RSA key too short! Has only %d bits", keyLength);
-                         return CERTIFICATE_SECURITY_ERROR;
+                    LogError("RSA key too short! Has only " << keyLength << " bits");
+                    return CERTIFICATE_SECURITY_ERROR;
                 }
             }
         }
@@ -467,65 +104,6 @@ CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateFro
     return NO_ERROR;
 }
 
-// DEPRACETED FUNCTION
-//CertificateLoader::CertificateLoaderResult CertificateLoader::loadCertificateFromRawData(const std::string &rawData)
-//{
-//    certmgr_mem_buff cmBuff = {0,0,0};
-//
-//    long int size;
-//    cmBuff.data = certmgr_util_base64_decode(const_cast<void*>(static_cast<const void*>(rawData.c_str())), rawData.size(), &size);
-//
-//    cmBuff.firstFree = cmBuff.size = size;
-//
-//    certmgr_cert_descriptor descriptor;
-//
-//    long int result = certmgr_extract_certificate_data(&cmBuff, &descriptor);
-//
-//    if (result != OPERATION_SUCCESS)
-//    {
-//        WrtLogE("Unable to load certificate");
-//        return UNKNOWN_ERROR;
-//    }
-//
-//    certmgr_release_certificate_data(&descriptor);
-//
-//    m_certificatePtr = CertificatePtr(new Certificate(cmBuff));
-//
-//    // we have to use temp pointer cause d2i_x509 modifies its input
-//    const unsigned char* tmpPtr = cmBuff.data;
-//    X509* pCertificate = d2i_X509(NULL, &tmpPtr, cmBuff.size);
-//
-//    if (pCertificate)
-//    {
-//        SSLSmartContainer<X509> pX509(pCertificate);
-//
-//        // Check the key length if sig algorithm is RSA
-//        EVP_PKEY *pKey = X509_get_pubkey(pX509);
-//
-//        if (pKey->type == EVP_PKEY_RSA)
-//        {
-//            RSA* pRSA = pKey->pkey.rsa;
-//
-//            if (pRSA)
-//            {
-//                int keyLength = RSA_size(pRSA);
-//
-//                // key Length (modulus) is in bytes
-//                keyLength <<= 3;
-//                WrtLogD("RSA key length: %d bits", keyLength);
-//
-//                if (keyLength < MIN_RSA_KEY_LENGTH)
-//                {
-//                    WrtLogE("RSA key too short! Has only %d bits.", keyLength);
-//                    return CERTIFICATE_SECURITY_ERROR;
-//                }
-//            }
-//        }
-//    }
-//
-//    return NO_ERROR;
-//}
-
 CertificateLoader::CertificateLoaderResult CertificateLoader::
     loadCertificateBasedOnDSAComponents(const std::string& strP,
         const std::string& strQ,
@@ -542,111 +120,8 @@ CertificateLoader::CertificateLoaderResult CertificateLoader::
     (void) strJ;
     (void) strSeed;
     (void) strPGenCounter;
-    WrtLogE("Not implemented.");
+    LogError("Not implemented.");
     return UNKNOWN_ERROR;
-    //    (void)strY;
-    //    (void)strJ;
-    //    (void)strSeed;
-    //    (void)strPGenCounter;
-    //
-    //    long int result = UNKNOWN_ERROR;
-    //
-    //    char storeId[CERTMGR_MAX_PLUGIN_ID_SIZE];
-    //    char type[CERTMGR_MAX_CERT_TYPE_SIZE];
-    //    certmgr_cert_id certId;
-    //    certmgr_ctx context;
-    //    certmgr_mem_buff certRetrieved;
-    //
-    //    unsigned char buffer[CERTMGR_MAX_BUFFER_SIZE];
-    //
-    //    certmgr_cert_descriptor descriptor;
-    //
-    //    certRetrieved.data = buffer;
-    //    certRetrieved.firstFree = 0;
-    //    certRetrieved.size = CERTMGR_MAX_BUFFER_SIZE;
-    //    certId.storeId = storeId;
-    //    certId.type = type;
-    //
-    //    CERTMGR_INIT_CONTEXT((&context), (sizeof(context)))
-    //    std::string strStoreType("Operator");
-    //    strncpy(context.storeId, strStoreType.c_str(),  strStoreType.length());
-    //
-    //    for (certRetrieved.firstFree = 0;
-    //      OPERATION_SUCCESS == (result = certmgr_retrieve_certificate_from_store(&context, &certRetrieved, &certId));
-    //      certRetrieved.firstFree = 0)
-    //    {
-    //
-    //        if (OPERATION_SUCCESS != certmgr_extract_certificate_data(&certRetrieved, &descriptor))
-    //        {
-    //            WrtLogD("unable to retrieve cert from storage");
-    //            continue;
-    //        }
-    //
-    //        X509* pCertificate = d2i_X509(NULL, (const unsigned char**) &(certRetrieved.data), certRetrieved.size);
-    //
-    //        if (pCertificate)
-    //        {
-    //            EVP_PKEY *pKey = X509_get_pubkey(pCertificate);
-    //
-    //            if (pKey->type == EVP_PKEY_DSA)
-    //            {
-    //                DSA* pDSA = pKey->pkey.dsa;
-    //
-    //                if (pDSA)
-    //                {
-    //                    BIGNUM *pDSApBigNum = NULL, *pDSAqBigNum = NULL, *pDSAgBigNum = NULL;
-    //
-    //                    convertBase64NodeToBigNum(strP, &pDSApBigNum);
-    //                    convertBase64NodeToBigNum(strQ, &pDSAqBigNum);
-    //                    convertBase64NodeToBigNum(strG, &pDSAgBigNum);
-    //
-    //                    if (pDSApBigNum && pDSAqBigNum && pDSAgBigNum &&
-    //                      BN_cmp(pDSApBigNum, pDSA->p) == 0 &&
-    //                      BN_cmp(pDSAqBigNum, pDSA->q) == 0 &&
-    //                      BN_cmp(pDSAgBigNum, pDSA->g) == 0)
-    //                    {
-    //                        WrtLogI("DSA Certificate found");
-    //                        /* TODO load this certificate to m_cmBuff value */
-    //                        WrtLogE("Not implemented!");
-    //
-    //                        EVP_PKEY_free(pKey);
-    //                        X509_free(pCertificate);
-    //
-    //                        BN_free(pDSApBigNum);
-    //                        BN_free(pDSAqBigNum);
-    //                        BN_free(pDSAgBigNum);
-    //
-    //                        certmgr_release_certificate_data(&descriptor);
-    //                        return NO_ERROR;
-    //                    }
-    //
-    //                    if (pDSApBigNum)
-    //                    {
-    //                        BN_free(pDSApBigNum);
-    //                    }
-    //                    if (pDSAqBigNum)
-    //                    {
-    //                        BN_free(pDSAqBigNum);
-    //                    }
-    //                    if (pDSAgBigNum)
-    //                    {
-    //                        BN_free(pDSAgBigNum);
-    //                    }
-    //
-    //                }
-    //                EVP_PKEY_free(pKey);
-    //            }
-    //            X509_free(pCertificate);
-    //        }
-    //        else
-    //            WrtLogE("Unable to load certificate");
-    //
-    //        certmgr_release_certificate_data(&descriptor);
-    //    }
-    //
-    //    WrtLogE("No DSA certificate with given parameters");
-    //
-    //    return CERTIFICATE_NOT_FOUND;
 }
 
 bool CertificateLoader::convertBase64NodeToBigNum(const std::string& strNode,
@@ -654,67 +129,9 @@ bool CertificateLoader::convertBase64NodeToBigNum(const std::string& strNode,
 {
     (void) strNode;
     (void) ppBigNum;
-    WrtLogE("Not implemented.");
+    LogError("Not implemented.");
     return false;
-    //    if (!ppBigNum || *ppBigNum != NULL)
-    //    {
-    //        WrtLogE("Ptr variable not initialized properly!");
-    //        return false;
-    //    }
-    //
-    //    // decode base64 to binary
-    //    long int binBuffLength = 0;
-    //    unsigned char* binBuff = NULL;
-    //
-    //    binBuff = certmgr_util_base64_decode(const_cast<char*> (strNode.c_str()), strNode.length(), &binBuffLength);
-    //
-    //    if (!binBuff)
-    //    {
-    //        WrtLogE("base64 decode failed");
-    //        return false;
-    //    }
-    //
-    //    // convert binary to bignum
-    //    *ppBigNum = BN_bin2bn(binBuff, binBuffLength, *ppBigNum);
-    //
-    //    free(binBuff);
-    //
-    //    if (!(*ppBigNum))
-    //    {
-    //        WrtLogE("Conversion from node to bignum failed");
-    //        return false;
-    //    }
-    //
-    //    return true;
 }
 
-// KW bool CertificateLoader::convertBigNumToBase64Node(const BIGNUM* pBigNum, std::string& strNode)
-// KW {
-// KW     if (!pBigNum)
-// KW     {
-// KW         WrtLogE("null ptr");
-// KW         return false;
-// KW     }
-// KW
-// KW     int nNumLength = BN_num_bytes(pBigNum);
-// KW     unsigned char* buffer = new unsigned char[nNumLength + 1];
-// KW
-// KW     // convert bignum to binary format
-// KW     if (BN_bn2bin(pBigNum, buffer) < 0)
-// KW     {
-// KW         WrtLogE("Conversion from bignum to binary failed");
-// KW         delete []buffer;
-// KW         return false;
-// KW     }
-// KW
-// KW     char* pBase64Node = NULL;
-// KW     unsigned long int buffLen = 0;
-// KW     certmgr_util_base64_encode(buffer, (unsigned long int) nNumLength, &pBase64Node, &buffLen);
-// KW
-// KW     strNode.assign(pBase64Node, buffLen);
-// KW
-// KW     delete []buffer;
-// KW     return true;
-// KW }
 } // namespace ValidationCore