Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
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
杨凯
YDL-Component-Medical
Commits
a1ed8f19
Commit
a1ed8f19
authored
Jan 11, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:加密代码优化
parent
585a0570
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
14 additions
and
74 deletions
+14
-74
EncryptionParams.java
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
+0
-56
AccountSettingActivity.java
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
+0
-1
RegisterAndLoginActivity.kt
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
+0
-1
EncryptionParams.java
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
+14
-15
HttpConfig.kt
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
+0
-1
No files found.
m-user/src/main/java/com/yidianling/user/http/EncryptionParams.java
deleted
100644 → 0
View file @
585a0570
package
com
.
yidianling
.
user
.
http
;
import
android.os.Build
;
import
android.support.annotation.RequiresApi
;
import
android.util.Log
;
import
com.ydl.burypointlib.MD5Util
;
import
com.ydl.ydlcommon.base.BaseApp
;
import
com.ydl.ydlcommon.base.config.HttpConfig
;
import
com.yidianling.common.tools.RxAppTool
;
import
java.util.Arrays
;
import
java.util.Comparator
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
* Created by Ykai on 2021/1/11.
*
* 获取加密参数类
*/
public
class
EncryptionParams
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
public
static
Map
<
String
,
String
>
getParams
(
String
path
){
String
timestamp
=
String
.
valueOf
(
System
.
currentTimeMillis
());
//值应该为毫秒数的字符串形式
Map
<
String
,
String
>
map
=
new
HashMap
<>();
map
.
put
(
"timestamp"
,
timestamp
);
map
.
put
(
"path"
,
path
);
map
.
put
(
"version"
,
"1.0.0"
);
List
<
String
>
storedKeys
=
Arrays
.
stream
(
map
.
keySet
()
.
toArray
(
new
String
[]{}))
.
sorted
(
Comparator
.
naturalOrder
())
.
collect
(
Collectors
.
toList
());
String
sign
=
storedKeys
.
stream
()
// .map(key -> String.join("", key, map.get(key)))
.
map
(
key
->
key
+
map
.
get
(
key
))
.
collect
(
Collectors
.
joining
()).
trim
()
.
concat
(
"ABA88F2FF7E64A688D2213B20A9B3A3E"
);
Log
.
e
(
"sign"
,
sign
);
sign
=
MD5Util
.
md5
(
sign
).
toUpperCase
();
// sign = MD5.md5(sign).toUpperCase();
Log
.
e
(
"sign"
,
sign
);
Map
<
String
,
String
>
headersMap
=
new
HashMap
<>();
headersMap
.
put
(
"appKey"
,
"20BB42485BD448DE888DD745899C457D"
);
headersMap
.
put
(
"sign"
,
sign
);
// headersMap.put("sign","2410C6CDC7235DC6318F5CF0FFFAA0B7");
headersMap
.
put
(
"timestamp"
,
timestamp
);
// headersMap.put("timestamp","1610352010360");
return
headersMap
;
}
}
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
View file @
a1ed8f19
...
@@ -31,7 +31,6 @@ import com.yidianling.user.UserConstants;
...
@@ -31,7 +31,6 @@ import com.yidianling.user.UserConstants;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.UserHelper
;
import
com.yidianling.user.api.event.RefreshRecentContactListEvent
;
import
com.yidianling.user.api.event.RefreshRecentContactListEvent
;
import
com.yidianling.user.event.UpdateBindStatusEvent
;
import
com.yidianling.user.event.UpdateBindStatusEvent
;
import
com.yidianling.user.http.EncryptionParams
;
import
com.yidianling.user.http.LoginApiRequestUtil
;
import
com.yidianling.user.http.LoginApiRequestUtil
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttp
;
import
com.yidianling.user.http.UserHttpImpl
;
import
com.yidianling.user.http.UserHttpImpl
;
...
...
m-user/src/main/java/com/yidianling/user/ui/login/RegisterAndLoginActivity.kt
View file @
a1ed8f19
...
@@ -44,7 +44,6 @@ import com.yidianling.user.UserHelper
...
@@ -44,7 +44,6 @@ import com.yidianling.user.UserHelper
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.api.bean.UserResponseBean
import
com.yidianling.user.bean.AliAuthBean
import
com.yidianling.user.bean.AliAuthBean
import
com.yidianling.user.constants.UserBIConstants
import
com.yidianling.user.constants.UserBIConstants
import
com.yidianling.user.http.EncryptionParams
import
com.yidianling.user.http.request.BindPhoneJavaParam
import
com.yidianling.user.http.request.BindPhoneJavaParam
import
com.yidianling.user.http.request.PhoneLoginAutoParam
import
com.yidianling.user.http.request.PhoneLoginAutoParam
import
com.yidianling.user.http.response.ChcekPhoneResponeBean
import
com.yidianling.user.http.response.ChcekPhoneResponeBean
...
...
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/EncryptionParams.java
View file @
a1ed8f19
...
@@ -20,24 +20,23 @@ import java.util.stream.Collectors;
...
@@ -20,24 +20,23 @@ import java.util.stream.Collectors;
*/
*/
public
class
EncryptionParams
{
public
class
EncryptionParams
{
@RequiresApi
(
api
=
Build
.
VERSION_CODES
.
N
)
public
static
String
getSign
(
String
path
,
String
timestamp
){
public
static
String
getSign
(
String
path
,
String
timestamp
){
Map
<
String
,
String
>
map
=
new
HashMap
<>();
// Map<String,String> map = new HashMap<>();
map
.
put
(
"timestamp"
,
timestamp
);
// map.put("timestamp",timestamp);
map
.
put
(
"path"
,
path
);
// map.put("path",path);
map
.
put
(
"version"
,
"1.0.0"
);
// map.put("version", "1.0.0");
//
List
<
String
>
storedKeys
=
Arrays
.
stream
(
map
.
keySet
()
// List<String> storedKeys = Arrays.stream(map.keySet()
.
toArray
(
new
String
[]{}))
// .toArray(new String[]{}))
.
sorted
(
Comparator
.
naturalOrder
())
// .sorted(Comparator.naturalOrder())
.
collect
(
Collectors
.
toList
());
// .collect(Collectors.toList());
String
sign
=
storedKeys
.
stream
()
// String sign = storedKeys.stream()
.
map
(
key
->
key
+
map
.
get
(
key
))
// .map(key -> key+map.get(key))
.
collect
(
Collectors
.
joining
()).
trim
()
// .collect(Collectors.joining()).trim()
.
concat
(
HttpConfig
.
Companion
.
getENCRYPTION_APP_SECRET
());
// .concat();
String
sign
=
(
"path"
+
path
+
"timestamp"
+
timestamp
+
"version1.0.0"
).
concat
(
HttpConfig
.
Companion
.
getENCRYPTION_APP_SECRET
());
LogUtil
.
e
(
"sign"
,
sign
);
LogUtil
.
e
(
"sign"
,
sign
);
sign
=
MD5Util
.
md5
(
sign
).
toUpperCase
();
sign
=
MD5Util
.
md5
(
sign
).
toUpperCase
();
LogUtil
.
e
(
"sign"
,
sign
);
return
sign
;
return
sign
;
}
}
}
}
ydl-platform/src/main/java/com/ydl/ydlcommon/base/config/HttpConfig.kt
View file @
a1ed8f19
...
@@ -173,7 +173,6 @@ class HttpConfig {
...
@@ -173,7 +173,6 @@ class HttpConfig {
path
+
it
.
request
().
url
().
encodedPath
()
path
+
it
.
request
().
url
().
encodedPath
()
}
}
}
}
LogUtil
.
e
(
"path"
,
it
.
request
().
url
().
toString
())
val
sign
=
EncryptionParams
.
getSign
(
path
,
timestamp
)
val
sign
=
EncryptionParams
.
getSign
(
path
,
timestamp
)
val
request
=
it
.
request
().
newBuilder
()
val
request
=
it
.
request
().
newBuilder
()
.
addHeader
(
"appKey"
,
ENCRYPTION_APP_KEY
)
.
addHeader
(
"appKey"
,
ENCRYPTION_APP_KEY
)
...
...
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