int lenSerialNo = 0;
int certId = 0;
int keyIdB64Length = 0;
- char* pFileName = null;
- char* pPriKeyFileName = null;
char subjectNameBuffer[_MAX_ISSUER_SUBJECT_NAME_SIZE] = {0, };
char szIssuerName[_MAX_ISSUER_SUBJECT_NAME_SIZE] = {0, };
char serialName[_MAX_SERIAL_NUMBER_SIZE] = {0, };
}
else
{
- pPriKeyFileName = null;
privateKeyLen = 0;
}
memcpy(certRecord.certPubKeyHash, pId64.get(), keyIdB64Length); //Base64 encoded device id
certRecord.certFormat = static_cast< int >(certFormat);
- pFileName = Tizen::Base::_StringConverter::CopyToCharArrayN(tempFileName);
+ std::unique_ptr< char > pFileName(Tizen::Base::_StringConverter::CopyToCharArrayN(tempFileName));
SysTryReturnResult(NID_SEC_CERT, pFileName != null, E_SYSTEM, "Failed to get attributes.");
- strcpy(certRecord.fileName, pFileName);
+ strcpy(certRecord.fileName, pFileName.get());
certRecord.subjectNameLen = lenSubjectName;
memcpy(certRecord.subjectName, subjectNameBuffer, lenSubjectName);
certRecord.issuerNameLen = lenIssuerName;
memcpy(certRecord.issuerName, szIssuerName, lenIssuerName);
- pPriKeyFileName = Tizen::Base::_StringConverter::CopyToCharArrayN(privateKeyFile);
+ std::unique_ptr< char > pPriKeyFileName(Tizen::Base::_StringConverter::CopyToCharArrayN(privateKeyFile));
SysTryReturnResult(NID_SEC_CERT, pPriKeyFileName != null, E_SYSTEM, "Failed to get attributes.");
- strcpy(certRecord.prvKeyPath, pPriKeyFileName);
+ strcpy(certRecord.prvKeyPath, pPriKeyFileName.get());
certRecord.prvKeyLen = privateKeyLen;
certRecord.parentCa = certId;
strcpy(certRecord.installed, installedRecord);
r = pCertDb->UpdateCaCertificateFromBuffer(type, certFormat, reinterpret_cast< byte* >(pDerCertBufferOld.get()), derCertBufferLengthOld, reinterpret_cast< byte* >(pDerCertBufferNew.get()), derCertBufferLengthNew);
if (r == E_DATA_NOT_FOUND)
{
- SysTryReturnResult(NID_SEC_CERT, !IsFailed(r), E_OBJ_NOT_FOUND, "Certificate not found in db.");
+ SysTryReturnResult(NID_SEC_CERT, false, E_OBJ_NOT_FOUND, "Certificate not found in db.");
}
SysTryReturnResult(NID_SEC_CERT, !IsFailed(r), E_SYSTEM, "An unexpected system error occurred.");