Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
sdk_jni
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sobot_android
sdk_jni
Commits
bd0ca7a6
Commit
bd0ca7a6
authored
Jan 27, 2022
by
app_dev@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
内存泄漏优化
parent
5adb637c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
5 deletions
+12
-5
.DS_Store
.DS_Store
+0
-0
sobot.c
jni/sobot.c
+9
-4
sdk密钥使用so加密文档.md
sdk密钥使用so加密文档.md
+3
-1
No files found.
.DS_Store
View file @
bd0ca7a6
No preview for this file type
jni/sobot.c
View file @
bd0ca7a6
...
...
@@ -52,14 +52,15 @@ JNIEXPORT jstring JNICALL Java_com_sobot_chat_core_SobotUtil_getKey
char
*
aa
=
jstringToChar
(
env
,
a
);
char
*
cc
=
jstringToChar
(
env
,
c
);
char
*
dd
=
jstringToChar
(
env
,
d
);
char
*
result
=
(
char
*
)
malloc
(
strlen
(
aa
)
+
strlen
(
dd
)
+
strlen
(
cc
)
+
strlen
(
getKey
()));
int
len
=
strlen
(
aa
)
+
strlen
(
dd
)
+
strlen
(
cc
)
+
strlen
(
getKey
())
+
1
;
char
*
result
=
(
char
*
)
malloc
(
len
);
memset
(
result
,
0
,
len
);
sprintf
(
result
,
"%s%s%s%s"
,
aa
,
dd
,
cc
,
getKey
());
MD5_CTX
context
=
{
0
};
MD5Init
(
&
context
);
MD5Update
(
&
context
,
result
,
strlen
(
result
));
unsigned
char
dest
[
16
]
=
{
0
};
MD5Final
(
dest
,
&
context
);
(
*
env
)
->
ReleaseStringUTFChars
(
env
,
c
,
result
);
int
i
=
0
;
char
szMd5
[
33
]
=
{
0
};
...
...
@@ -67,6 +68,9 @@ JNIEXPORT jstring JNICALL Java_com_sobot_chat_core_SobotUtil_getKey
{
sprintf
(
szMd5
,
"%s%02x"
,
szMd5
,
dest
[
i
]);
}
free
((
void
*
)
aa
);
free
((
void
*
)
cc
);
free
((
void
*
)
dd
);
free
((
void
*
)
result
);
return
(
*
env
)
->
NewStringUTF
(
env
,
szMd5
);
}
}
\ No newline at end of file
sdk密钥使用so加密文档.md
View file @
bd0ca7a6
**and
roid Studio 基于NDK加密,防止反编译获取加密key**
**and
roid Studio 基于NDK加密,防止反编译获取加密key**
...
...
@@ -95,6 +95,8 @@ sobot.c
6.
打开命令窗口,进入jni文件夹,执行命令
**ndk-build**
,会自动生成一个libs文件夹。里边的 .so 文件供调用
注意:有时候出现找不到ndk-build,1、看下环境变量里有没ndk路径, 2、执行source .bash_profile,然后在进入jni文件夹下,执行ndk-build
三、调用生成的 .so文件
1.
把so文件复制到module下的libs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment