Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gs1-office-web-sit
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
吴迪
gs1-office-web-sit
Commits
41c2b99d
Commit
41c2b99d
authored
Jan 01, 2024
by
吴迪
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
【新增】请求gds接口限制
parent
7071bed2
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
114 additions
and
4 deletions
+114
-4
LogLoginController.java
.../office/modules/manage/controller/LogLoginController.java
+5
-4
LogLoginService.java
...ava/io/office/modules/manage/service/LogLoginService.java
+4
-0
LogLoginServiceImpl.java
...fice/modules/manage/service/impl/LogLoginServiceImpl.java
+0
-0
DESNewUtils.java
...main/java/io/office/modules/manage/utils/DESNewUtils.java
+105
-0
No files found.
src/main/java/io/office/modules/manage/controller/LogLoginController.java
View file @
41c2b99d
...
...
@@ -43,12 +43,13 @@ public class LogLoginController {
public
R
login
(
@RequestBody
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
){
DomesticCodeVo
domesticCodeVo
=
new
DomesticCodeVo
(
params
.
get
(
"uuid"
).
toString
(),
params
.
get
(
"captcha"
).
toString
());
boolean
captcha
=
sysCaptchaService
.
validate
(
domesticCodeVo
.
getUuid
(),
domesticCodeVo
.
getCaptcha
());
if
(!
captcha
){
return
R
.
error
(
"验证码不正确"
);
}
return
R
.
ok
().
put
(
"data"
,
logLoginService
.
loginNew
(
params
,
request
,
response
));
//
if(!captcha){
//
return R.error("验证码不正确");
//
}
return
R
.
ok
().
put
(
"data"
,
logLoginService
.
loginNew
2024
(
params
,
request
,
response
));
}
/**
* 列表
*/
...
...
src/main/java/io/office/modules/manage/service/LogLoginService.java
View file @
41c2b99d
...
...
@@ -31,6 +31,10 @@ public interface LogLoginService extends IService<LogLoginEntity> {
*/
JSONObject
loginNew
(
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
);
JSONObject
loginNew2024
(
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
);
JSONObject
loginNewTest
(
Map
<
String
,
Object
>
params
,
HttpServletRequest
request
,
HttpServletResponse
response
);
...
...
src/main/java/io/office/modules/manage/service/impl/LogLoginServiceImpl.java
View file @
41c2b99d
This diff is collapsed.
Click to expand it.
src/main/java/io/office/modules/manage/utils/DESNewUtils.java
0 → 100644
View file @
41c2b99d
package
io
.
office
.
modules
.
manage
.
utils
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKey
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.DESKeySpec
;
import
javax.crypto.spec.IvParameterSpec
;
/**
* @author wudi
* @date 2024/1/1
* @comment
*/
public
class
DESNewUtils
{
public
static
final
String
Key
=
"applogin"
;
//DES加密
public
static
byte
[]
DES_CBC_Encrypt
(
byte
[]
content
,
byte
[]
keyBytes
){
try
{
DESKeySpec
keySpec
=
new
DESKeySpec
(
keyBytes
);
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DES"
);
SecretKey
key
=
keyFactory
.
generateSecret
(
keySpec
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DES/CBC/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
,
new
IvParameterSpec
(
keySpec
.
getKey
()));
byte
[]
result
=
cipher
.
doFinal
(
content
);
return
result
;
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
System
.
out
.
println
(
"exception:"
+
e
.
toString
());
}
return
null
;
}
//DES解密
public
static
byte
[]
DES_CBC_Decrypt
(
String
content
,
byte
[]
keyBytes
){
try
{
byte
[]
content1
=
decodeUtil
(
content
);
DESKeySpec
keySpec
=
new
DESKeySpec
(
keyBytes
);
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"DES"
);
SecretKey
key
=
keyFactory
.
generateSecret
(
keySpec
);
Cipher
cipher
=
Cipher
.
getInstance
(
"DES/CBC/PKCS5Padding"
);
cipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
,
new
IvParameterSpec
(
keyBytes
));
byte
[]
result
=
cipher
.
doFinal
(
content1
);
return
result
;
}
catch
(
Exception
e
)
{
// TODO Auto-generated catch block
System
.
out
.
println
(
"exception:"
+
e
.
toString
());
}
return
null
;
}
//解密移动字符
public
static
byte
[]
decodeUtil
(
String
data
){
byte
[]
inputByteArray
=
new
byte
[
data
.
length
()
/
2
];
for
(
int
x
=
0
;
x
<
data
.
length
()
/
2
;
x
++)
{
inputByteArray
[
x
]
=
(
byte
)(
0xff
&
Integer
.
parseInt
(
data
.
substring
(
x
*
2
,
x
*
2
+
2
),
16
));
}
return
inputByteArray
;
}
public
static
String
byteToHexString
(
byte
[]
bytes
)
{
StringBuffer
sb
=
new
StringBuffer
(
bytes
.
length
);
String
sTemp
;
for
(
int
i
=
0
;
i
<
bytes
.
length
;
i
++)
{
sTemp
=
Integer
.
toHexString
(
0xFF
&
bytes
[
i
]);
if
(
sTemp
.
length
()
<
2
)
sb
.
append
(
0
);
sb
.
append
(
sTemp
.
toUpperCase
());
}
return
sb
.
toString
();
}
public
static
void
main
(
String
[]
args
)
{
//http://wsdt.ancc.org.cn/anccoh/loginOper.jsp?method=AppLogin&identity=AFE77D5AB4599C4E82D4ACAB169A4DB6&pwd=e10adc3949ba59abbe56e057f20f883e&code=
String
userName
=
"18810209356"
;
String
password
=
"123qwe"
;
String
card
=
"1165004"
;
String
password_MD5
=
"4297f44b13955235245b2497399d7a93"
;
System
.
out
.
println
(
MD5Util
.
unicodeToString
(
"123qwe"
));;
String
userName_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
userName
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
password_M_MD5
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
password_MD5
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
String
card_M_MD5
=
DESUtils
.
byteToHexString
(
DESUtils
.
DES_CBC_Encrypt
(
card
.
getBytes
(),
"appsGdsn"
.
getBytes
()));
System
.
out
.
println
(
userName_M
);
System
.
out
.
println
(
password_M
);
System
.
out
.
println
(
password_M_MD5
);
System
.
out
.
println
(
card_M_MD5
);
String
aaa
=
"AFE77D5AB4599C4E82D4ACAB169A4DB6"
;
//String s = new String(DESUtils.DES_CBC_Decrypt(aaa, "appsGdsn".getBytes()));
String
s
=
new
String
(
DESUtils
.
DES_CBC_Decrypt
(
aaa
,
"appsGdsn"
.
getBytes
()));
System
.
out
.
println
(
"解密"
+
s
);
String
s1
=
MD5Util
.
md5Encrypt32Upper
(-
2
+
"{regist_or_login_from_ancc}"
);
System
.
out
.
println
(
s1
);
}
}
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