Source release 15.0.0
This commit is contained in:
@@ -9,6 +9,18 @@
|
||||
|
||||
#include "privacy_crypto.h"
|
||||
|
||||
#include "log.h"
|
||||
|
||||
#ifdef __APPLE__
|
||||
# include <CommonCrypto/CommonDigest.h>
|
||||
# define SHA256 CC_SHA256
|
||||
# define SHA256_DIGEST_LENGTH CC_SHA256_DIGEST_LENGTH
|
||||
# define MD5 CC_MD5
|
||||
# define MD5_DIGEST_LENGTH CC_MD5_DIGEST_LENGTH
|
||||
#else
|
||||
# error "No hash algorithm known for this platform."
|
||||
#endif
|
||||
|
||||
namespace wvcdm {
|
||||
|
||||
AesCbcKey::AesCbcKey() {}
|
||||
@@ -38,4 +50,24 @@ bool RsaPublicKey::VerifySignature(const std::string& message,
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool ExtractExtensionValueFromCertificate(const std::string& cert,
|
||||
const std::string& extension_oid,
|
||||
size_t cert_index, uint32_t* value) {
|
||||
LOGE("ExtractExtensionValueFromCertificate: Not supported in this build.");
|
||||
return false;
|
||||
}
|
||||
|
||||
std::string Md5Hash(const std::string& data) {
|
||||
std::string hash(MD5_DIGEST_LENGTH, '\0');
|
||||
MD5(data.data(), data.size(), reinterpret_cast<uint8_t*>(&hash[0]));
|
||||
return hash;
|
||||
}
|
||||
|
||||
std::string Sha256Hash(const std::string& data) {
|
||||
std::string hash(SHA256_DIGEST_LENGTH, '\0');
|
||||
SHA256(data.data(), data.size(), reinterpret_cast<uint8_t*>(&hash[0]));
|
||||
return hash;
|
||||
}
|
||||
|
||||
} // namespace wvcdm
|
||||
|
||||
Reference in New Issue
Block a user