|
// 这个是我这边调用流程。
CallAuth(2);
static void CallAuth(int request){
BVRAuthParam param;
memset(¶m, 0, sizeof(param));
param.iSize = sizeof(param);
// 参数对应改下
strcpy(param.termInfo.CPU, "ARM");
strcpy(param.termInfo.Desc, "Besovideo copyright");
strcpy(param.termInfo.HardwareProvider, lo_billRequest.stEntity.szBrand);
strcpy(param.termInfo.HardwareSN, lo_billRequest.stEntity.szFingerPrint);
strcpy(param.termInfo.HardwareVersion, "1.0");
strcpy(param.termInfo.ID, lo_billRequest.szAppDeviceID);
strcpy(param.termInfo.IMEI, lo_billRequest.stEntity.szDeviceID);
strcpy(param.termInfo.MAC, lo_billRequest.stEntity.szMacAddress);
strcpy(param.termInfo.ModelNumber, lo_billRequest.stEntity.szModel);
strcpy(param.termInfo.DeviceModelNumber, lo_billRequest.stEntity.szModel);
strcpy(param.termInfo.OSID, lo_billRequest.stEntity.szAndroidID);
strcpy(param.termInfo.OSType, "Android");
sprintf(param.termInfo.OSVersion,"%d", lo_billRequest.stEntity.iAPILevel);
strcpy(param.termInfo.SoftwareProvider, "Besovideo");
strcpy(param.termInfo.SoftwareVersion, "v1.0");
strcpy(param.termInfo.Type, lo_billRequest.szAppType);
strcpy(param.termInfo.UserLabel,lo_billRequest.szUserLabel);
LOGI("CallAuth lo_billRequest.szProductKey = %s", lo_billRequest.szProductKey);
strcpy(param.termInfo.ProductKey,lo_billRequest.szProductKey);
AU_RSA* rsa = NULL;
char* n = "xxxxxxxxxxxxxx";
char* e = "xxxxxxxxxxxxxxx";
char data[256];
int data_len = 0;
int len = 0;
char base64[512];
int base64_len;
char encrypt[512];
int encrypt_len = 0;
data_len = sizeof(data);
memset(data, 0, sizeof(data));
encrypt_len = sizeof(encrypt);
memset(encrypt, 0, sizeof(encrypt));
base64_len = sizeof(base64);
memset(base64, 0, sizeof(base64));
au_rsa_init();
au_rsa_key_get_hex(&rsa, n, e, NULL);
// 获取需要字符串
BVCSP_GetEncryptedData(data, &data_len);
len = au_rsa_encrypt(rsa, data, data_len, encrypt, encrypt_len);
if (len > 0) {
base64_len = base64_encode((const unsigned char*) encrypt, len, base64);
strcpy(param.appInfo.appId, "app_xxxxxxxxx");
param.appInfo.ciph_data = base64;
param.appInfo.ciph_len = strlen(base64);
}
if(strlen(lo_billRequest.szInnerInfo) > 0){
param.innerInfo.ciphertext = lo_billRequest.szInnerInfo;
param.innerInfo.length = strlen(lo_billRequest.szInnerInfo)+1;
}
memcpy(param.SerialNumber, lo_billRequest.szSerialNumber, 128);
param.user_data = (void*)request;
param.OnAuthEvent = BVOnAuthEvent;
param.OnMessage =BVOnMessage;
#if 1
BVCU_Result br = BVCSP_Auth(¶m);
if(BVCU_Result_FAILED(br)){
LOGI("auth call error!");
}else{
LOGI("auth call success!");
}
#endif
LOGI("***************>> request: %d\n", request);
}
|
|