#include <openssl/evp.h>
#include <openssl/x509.h>
#include <openssl/pkcs12.h>
+#include <dukgen.h>
#include <FIoFile.h>
#include <FIoFileAttributes.h>
#include <FBaseByteBuffer.h>
#include <FBaseString.h>
#include <FBaseResult.h>
#include <FBaseSysLog.h>
-#include <FSec_DeviceKeyGenerator.h>
#include <FSecISecretKey.h>
#include "FSecCert_CertPrivateKeyInfo.h"
result r = E_SUCCESS;
byte uniqueKey[16] = {0};
byte ivData[16] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f};
+ char certMgrInfo[16] = {0x09, 0x25, 0x19, 0x87, 0xBF, 0x02, 0x14, 0x19, 0x88, 0xDD, 0x12, 0x30, 0x19, 0x86, 0xAD, 0xED};
+ int certMgrInfoLen = 16;
int aesBlockLen = 16;
int outLength = 0;
int lenData = 0;
int err = 0;
EVP_CIPHER_CTX ctx;
- std::unique_ptr< ISecretKey > pSecKey(reinterpret_cast< ISecretKey* >(_DeviceKeyGenerator::GenerateDeviceKeyN(aesBlockLen)));
+ std::unique_ptr< ISecretKey > pSecKey(reinterpret_cast< ISecretKey* >(GetDeviceUniqueKey(certMgrInfo, certMgrInfoLen, aesBlockLen)));
SysTryReturnResult(NID_SEC_CERT, pSecKey != null, E_SYSTEM, "Failed to generate secret key.");
std::unique_ptr< ByteBuffer > pKeyBuf(pSecKey->GetEncodedN());
{
result r = E_SUCCESS;
byte uniqueKey[16] = {0};
+ char certMgrInfo[16] = {0x09, 0x25, 0x19, 0x87, 0xBF, 0x02, 0x14, 0x19, 0x88, 0xDD, 0x12, 0x30, 0x19, 0x86, 0xAD, 0xED};
+ int certMgrInfoLen = 16;
int aesBlockLen = 16;
const EVP_CIPHER* pCipher = null;
X509_SIG* pPkcs8Key = null;
long tempkeyLen = 0;
byte* pPrivKey = null;
- std::unique_ptr< ISecretKey > pSecKey(reinterpret_cast< ISecretKey* >(_DeviceKeyGenerator::GenerateDeviceKeyN(aesBlockLen)));
+ std::unique_ptr< ISecretKey > pSecKey(reinterpret_cast< ISecretKey* >(GetDeviceUniqueKey(certMgrInfo, certMgrInfoLen, aesBlockLen)));
SysTryReturnResult(NID_SEC_CERT, pSecKey != null, E_SYSTEM, "Failed to generate secret key.");
std::unique_ptr< ByteBuffer > pKeyBuf(pSecKey->GetEncodedN());