Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
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
Sobot_module_Dev
Commits
0f4802cd
Commit
0f4802cd
authored
Jan 07, 2023
by
郑娜伟
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
net 发布1.1.3 版本 okhttp 信任所有证书
parent
40da7eff
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
4 deletions
+28
-4
build.gradle
sobot_common/build.gradle
+2
-2
sobot-network-publish-mavencentral.gradle
sobot_network/sobot-network-publish-mavencentral.gradle
+1
-1
SobotOkHttpUtils.java
...rc/main/java/com/sobot/network/http/SobotOkHttpUtils.java
+25
-1
No files found.
sobot_common/build.gradle
View file @
0f4802cd
...
@@ -21,12 +21,12 @@ dependencies {
...
@@ -21,12 +21,12 @@ dependencies {
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:picture:1.1.4'
// api 'com.sobot.library:picture:1.1.4'
// api 'com.sobot.library:net:1.1.
2
'
// api 'com.sobot.library:net:1.1.
3
'
// api 'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:utils:1.1.1'
// api 'com.sobot.library:picture_x:1.1.4'
// api 'com.sobot.library:picture_x:1.1.4'
// api 'com.sobot.library:net:1.1.
2
'
// api 'com.sobot.library:net:1.1.
3
'
// api 'com.sobot.library:gson:1.1.1'
// api 'com.sobot.library:gson:1.1.1'
}
}
...
...
sobot_network/sobot-network-publish-mavencentral.gradle
View file @
0f4802cd
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
...
@@ -12,7 +12,7 @@ task androidSourcesJar(type: Jar) {
ext
{
ext
{
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_GROUP_ID
=
"com.sobot.library"
//项目包名
PUBLISH_ARTIFACT_ID
=
'net'
//项目名
PUBLISH_ARTIFACT_ID
=
'net'
//项目名
PUBLISH_VERSION
=
'1.1.
2
'
//版本号
PUBLISH_VERSION
=
'1.1.
3
'
//版本号
}
}
...
...
sobot_network/src/main/java/com/sobot/network/http/SobotOkHttpUtils.java
View file @
0f4802cd
...
@@ -20,6 +20,7 @@ import com.sobot.network.http.request.RequestCall;
...
@@ -20,6 +20,7 @@ import com.sobot.network.http.request.RequestCall;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.security.KeyStore
;
import
java.security.KeyStore
;
import
java.security.SecureRandom
;
import
java.security.SecureRandom
;
import
java.security.cert.X509Certificate
;
import
java.util.Arrays
;
import
java.util.Arrays
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
...
@@ -296,7 +297,7 @@ public class SobotOkHttpUtils {
...
@@ -296,7 +297,7 @@ public class SobotOkHttpUtils {
try
{
try
{
SSLContext
sc
=
SSLContext
.
getInstance
(
"TLS"
);
SSLContext
sc
=
SSLContext
.
getInstance
(
"TLS"
);
sc
.
init
(
null
,
new
TrustManager
[]{
manager
}
,
sc
.
init
(
null
,
getTrustManager
()
,
new
SecureRandom
());
new
SecureRandom
());
sSLSocketFactory
=
sc
.
getSocketFactory
();
sSLSocketFactory
=
sc
.
getSocketFactory
();
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
...
@@ -305,4 +306,26 @@ public class SobotOkHttpUtils {
...
@@ -305,4 +306,26 @@ public class SobotOkHttpUtils {
return
sSLSocketFactory
;
return
sSLSocketFactory
;
}
}
//获取TrustManager
private
static
TrustManager
[]
getTrustManager
()
{
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{
}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{
}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[]{};
}
}
};
return
trustAllCerts
;
}
}
}
\ No newline at end of file
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