优化证书相关的实现

hdrplus
Matthew 1 year ago
parent a6598095bb
commit 34f4c62c1d

@ -833,8 +833,8 @@ Java_com_xypower_mpapp_MicroPhotoService_querySecVersion(
} }
extern "C" JNIEXPORT jboolean JNICALL extern "C" JNIEXPORT jboolean JNICALL
Java_com_xypower_mpapp_MicroPhotoService_requestCert( Java_com_xypower_mpapp_MicroPhotoService_genCertRequest(
JNIEnv* env, jclass cls, jint type, jint index, jstring subject, jstring outputPath) { JNIEnv* env, jclass cls, jint index, jint type, jstring subject, jstring outputPath) {
#ifdef USING_NRSEC #ifdef USING_NRSEC
if (env->GetStringUTFLength(subject) <=0 || env->GetStringUTFLength(outputPath) <=0) if (env->GetStringUTFLength(subject) <=0 || env->GetStringUTFLength(outputPath) <=0)
@ -853,8 +853,7 @@ Java_com_xypower_mpapp_MicroPhotoService_requestCert(
uint16_t len = 0; uint16_t len = 0;
const char* subjectStr = env->GetStringUTFChars(subject, 0); const char* subjectStr = env->GetStringUTFChars(subject, 0);
std::string titleStr(subjectStr); bool res = nrsec.SM2cert(type, index, MakeString(subjectStr), output, &len) == 0;
bool res = nrsec.SM2cert(type, index, titleStr, output, &len) == 0;
nrsec.Close(); nrsec.Close();
env->ReleaseStringUTFChars(subject, subjectStr); env->ReleaseStringUTFChars(subject, subjectStr);
if (!res) if (!res)

@ -53,8 +53,11 @@ public class CertActivity extends AppCompatActivity {
int index = intent.getIntExtra("index", 0); int index = intent.getIntExtra("index", 0);
MicroPhotoService.genKeys(index); MicroPhotoService.genKeys(index);
} else if (TextUtils.equals(action, ACTION_CERT_REQ)) { } else if (TextUtils.equals(action, ACTION_CERT_REQ)) {
// int index = intent.getIntExtra("index", 0); int index = intent.getIntExtra("index", 0);
// MicroPhotoService.genKeys(index); int type = intent.getIntExtra("type", 0);
String subject = intent.getStringExtra("subject");
String path = intent.getStringExtra("path");
MicroPhotoService.genCertRequest(index, type, subject, path);
} }
} }

@ -1145,7 +1145,7 @@ cellSignalStrengthGsm.getDbm();
public static native boolean genKeys(int index); public static native boolean genKeys(int index);
public static native String querySecVersion(); public static native String querySecVersion();
public static native boolean requestCert(int type, int index, String subject, String outputPath); public static native boolean genCertRequest(int index, int type, String subject, String outputPath);
public static native boolean importPrivateKeyFile(int index, String outputPath, String md5); public static native boolean importPrivateKeyFile(int index, String outputPath, String md5);
public static native boolean exportPublicKeyFile(int index, String outputPath); public static native boolean exportPublicKeyFile(int index, String outputPath);
public static native boolean exportPrivateFile(int index, String outputPath); public static native boolean exportPrivateFile(int index, String outputPath);

Loading…
Cancel
Save