|
|
|
@ -833,8 +833,8 @@ Java_com_xypower_mpapp_MicroPhotoService_querySecVersion(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extern "C" JNIEXPORT jboolean JNICALL
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_requestCert(
|
|
|
|
|
JNIEnv* env, jclass cls, jint type, jint index, jstring subject, jstring outputPath) {
|
|
|
|
|
Java_com_xypower_mpapp_MicroPhotoService_genCertRequest(
|
|
|
|
|
JNIEnv* env, jclass cls, jint index, jint type, jstring subject, jstring outputPath) {
|
|
|
|
|
|
|
|
|
|
#ifdef USING_NRSEC
|
|
|
|
|
if (env->GetStringUTFLength(subject) <=0 || env->GetStringUTFLength(outputPath) <=0)
|
|
|
|
@ -852,9 +852,8 @@ Java_com_xypower_mpapp_MicroPhotoService_requestCert(
|
|
|
|
|
uint8_t output[1024] = { 0 };
|
|
|
|
|
uint16_t len = 0;
|
|
|
|
|
const char* subjectStr = env->GetStringUTFChars(subject, 0);
|
|
|
|
|
|
|
|
|
|
std::string titleStr(subjectStr);
|
|
|
|
|
bool res = nrsec.SM2cert(type, index, titleStr, output, &len) == 0;
|
|
|
|
|
|
|
|
|
|
bool res = nrsec.SM2cert(type, index, MakeString(subjectStr), output, &len) == 0;
|
|
|
|
|
nrsec.Close();
|
|
|
|
|
env->ReleaseStringUTFChars(subject, subjectStr);
|
|
|
|
|
if (!res)
|
|
|
|
@ -921,7 +920,7 @@ Java_com_xypower_mpapp_MicroPhotoService_exportPublicKeyFile(
|
|
|
|
|
|
|
|
|
|
#ifdef USING_NRSEC
|
|
|
|
|
|
|
|
|
|
if (env->GetStringUTFLength(outputPath)<=0)
|
|
|
|
|
if (env->GetStringUTFLength(outputPath) <= 0)
|
|
|
|
|
{
|
|
|
|
|
return JNI_FALSE;
|
|
|
|
|
}
|
|
|
|
@ -934,8 +933,8 @@ Java_com_xypower_mpapp_MicroPhotoService_exportPublicKeyFile(
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool res = false;
|
|
|
|
|
std::vector<unsigned char> data(64,0);
|
|
|
|
|
uint8_t len=0;
|
|
|
|
|
std::vector<unsigned char> data(64, 0);
|
|
|
|
|
uint8_t len = 0;
|
|
|
|
|
res = nrsec.SM2ExportPublicKey(index, &data[0], &len) == 0;
|
|
|
|
|
nrsec.Close();
|
|
|
|
|
if (!res)
|
|
|
|
@ -978,8 +977,8 @@ Java_com_xypower_mpapp_MicroPhotoService_exportPrivateFile(
|
|
|
|
|
|
|
|
|
|
bool res = false;
|
|
|
|
|
std::vector<unsigned char> data(64,0);
|
|
|
|
|
uint8_t len=0;
|
|
|
|
|
res = nrsec.SM2ExportPrivateKey(index, &data[0],&len) == 0;
|
|
|
|
|
uint8_t len = 0;
|
|
|
|
|
res = nrsec.SM2ExportPrivateKey(index, &data[0], &len) == 0;
|
|
|
|
|
nrsec.Close();
|
|
|
|
|
if (!res)
|
|
|
|
|
{
|
|
|
|
|