Skip to content

Commit bc7e600

Browse files
authored
Update CryptoDES.cpp
1 parent 1970829 commit bc7e600

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

native/CryptoDES.cpp

+11-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,16 @@ extern"C" JNIEXPORT jbyteArray JNICALL Java_helloworld_ByteCodeEncryptor_encrypt
1414
env->SetByteArrayRegion(j_array, 0, strlen(dst), (jbyte*)dst);
1515
return j_array;
1616
}
17-
17+
extern"C" JNIEXPORT jbyteArray JNICALL Java_helloworld_ByteCodeEncryptor_decrypt(JNIEnv* env, jclass cla, jbyteArray j_array)
18+
{
19+
char* dst = (char*)env->GetByteArrayElements(j_array, 0);
20+
des_init(0);
21+
des_set_key((char*)key);
22+
des_decrypt(dst);
23+
//des_done();
24+
env->SetByteArrayRegion(j_array, 0, strlen(dst), (jbyte*)dst);
25+
return j_array;
26+
}
1827
void JNICALL ClassDecryptCallback(
1928
jvmtiEnv* jvmti_env,
2029
JNIEnv* jni_env,
@@ -42,7 +51,7 @@ void JNICALL ClassDecryptCallback(
4251
des_init(0);
4352
des_set_key((char*)key);
4453
des_decrypt((char*)_data);
45-
des_done();
54+
//des_done();
4655
}
4756
else {
4857
for (int i = 0; i < class_data_len; i++)

0 commit comments

Comments
 (0)