- PublicKey is retrieved as unsigned character and some of its value
is missed during converting into const char due to some hexdata such as 0x00.
- It would cause security issue such as one application could access
shared/trusted of other non-trusted application.
- Fix codes to convert unsigned character value properly.
Change-Id: Iaca2f7c0fa60677d7aa5852725bb5b120ed54a09
Signed-off-by: Junghyun Yeon <jungh.yeon@samsung.com>
size_t len;
(*it)->getPublicKeyDER(&public_key, &len);
std::string author_id =
- ci::EncodeBase64(reinterpret_cast<const char*>(public_key));
+ ci::EncodeBase64(public_key, len);
cert_info->author_id.set(author_id);
cert_info->author_certificate.set(*it);
// cert_list has at least 3 certificates: end-user, intermediate, root
namespace common_installer {
-std::string EncodeBase64(const std::string& val) {
+std::string EncodeBase64(unsigned char* val, size_t len) {
std::stringstream os;
- std::copy(base64_encode(val.c_str()),
- base64_encode(val.c_str() + val.size()), std::ostream_iterator<char>(os));
+ std::copy(base64_encode(val), base64_encode(val + len),
+ std::ostream_iterator<char>(os));
return os.str();
}
namespace common_installer {
-std::string EncodeBase64(const std::string& val);
+std::string EncodeBase64(unsigned char* val, size_t len);
} // namespace common_installer