Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
dmhub-plugin
Project
Project
Details
Activity
Releases
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
qinxunjia
dmhub-plugin
Commits
36041958
Commit
36041958
authored
Jun 22, 2020
by
qinxunjia
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
生产参数配置
parent
7cbc29fa
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
6 deletions
+83
-6
pom.xml
pom.xml
+1
-1
CryptoUtils.java
src/main/java/com/bgy/util/CryptoUtils.java
+78
-0
application-prod.yml
src/main/resources/application-prod.yml
+4
-5
No files found.
pom.xml
View file @
36041958
...
...
@@ -6,7 +6,7 @@
<groupId>
org.example
</groupId>
<artifactId>
dmhub-plugin
</artifactId>
<version>
1.0
-SNAPSHOT
</version>
<version>
1.0
.0
</version>
<name>
插件服务
</name>
<description>
DM hub集成插件服务
</description>
...
...
src/main/java/com/bgy/util/CryptoUtils.java
0 → 100644
View file @
36041958
package
com
.
bgy
.
util
;
import
com.alibaba.fastjson.JSONObject
;
import
javax.crypto.Cipher
;
import
javax.crypto.SecretKeyFactory
;
import
javax.crypto.spec.DESedeKeySpec
;
import
javax.crypto.spec.IvParameterSpec
;
import
java.nio.charset.StandardCharsets
;
import
java.security.Key
;
import
java.security.spec.AlgorithmParameterSpec
;
import
java.util.Base64
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Objects
;
public
class
CryptoUtils
{
private
AlgorithmParameterSpec
iv
;
private
Key
key
;
public
CryptoUtils
(
String
_DESkey
,
String
_vi
)
throws
Exception
{
DESedeKeySpec
keySpec
=
new
DESedeKeySpec
(
_DESkey
.
getBytes
(
StandardCharsets
.
UTF_8
));
iv
=
new
IvParameterSpec
(
_vi
.
getBytes
(
StandardCharsets
.
UTF_8
));
SecretKeyFactory
keyFactory
=
SecretKeyFactory
.
getInstance
(
"desede"
);
key
=
keyFactory
.
generateSecret
(
keySpec
);
}
public
static
void
main
(
String
[]
args
)
throws
Exception
{
Map
<
String
,
String
>
querMap
=
new
HashMap
<>();
querMap
.
put
(
"bipid"
,
"888"
);
CryptoUtils
des
=
new
CryptoUtils
(
"BF7834FA210A407BA449A2B8"
,
"BD162758"
);
String
encodeParam
=
des
.
encode
(
Objects
.
requireNonNull
(
JSONObject
.
toJSONString
(
querMap
)));
Map
<
String
,
String
>
paramMap
=
new
HashMap
<>();
paramMap
.
put
(
"package"
,
encodeParam
);
paramMap
.
put
(
"companyid"
,
"3C877D40-DCB1-4304-AC50-242E032A761A"
);
paramMap
.
put
(
"channelid"
,
"FHYMA"
);
String
retStr
=
HttpUtil
.
sendPost
(
"https://xstest.bgy.com.cn/ApiBgyTest/MerchantAlliance/GetAccountLimit"
,
JSONObject
.
toJSONString
(
paramMap
));
String
test
=
"{\"bipId\":\"shenxiang11\"}"
;
JSONObject
retJson
=
JSONObject
.
parseObject
(
retStr
);
String
packageInfo
=
retJson
.
getString
(
"package"
);
String
decode
=
des
.
decode
(
packageInfo
);
System
.
out
.
println
(
""
+
test
);
System
.
out
.
println
(
""
+
des
.
encode
(
test
));
System
.
out
.
println
(
""
+
des
.
decode
(
des
.
encode
(
test
)));
}
/**
* CBC加密
*
* @return Base64编码的密文
*/
public
String
encode
(
String
data
)
throws
Exception
{
Cipher
enCipher
=
Cipher
.
getInstance
(
"desede/CBC/PKCS5Padding"
);
enCipher
.
init
(
Cipher
.
ENCRYPT_MODE
,
key
,
iv
);
byte
[]
pasByte
=
enCipher
.
doFinal
(
data
.
getBytes
(
StandardCharsets
.
UTF_8
));
return
Base64
.
getEncoder
().
encodeToString
(
pasByte
);
}
/**
* CBC解密
*
* @return 明文
*/
public
String
decode
(
String
data
)
throws
Exception
{
Cipher
deCipher
=
Cipher
.
getInstance
(
"desede/CBC/PKCS5Padding"
);
deCipher
.
init
(
Cipher
.
DECRYPT_MODE
,
key
,
iv
);
byte
[]
pasByte
=
deCipher
.
doFinal
(
Base64
.
getDecoder
().
decode
(
data
));
return
new
String
(
pasByte
,
StandardCharsets
.
UTF_8
);
}
}
\ No newline at end of file
src/main/resources/application-prod.yml
View file @
36041958
...
...
@@ -22,7 +22,6 @@ spring:
idleTimeout
:
600000
pool-name
:
dmhub-plug-pool
redis
:
database
:
0
host
:
rs67xf4p.redisrep.db.pcloud.localdomain
...
...
@@ -37,10 +36,10 @@ system:
areaId
:
XXJSB
api
:
SendSms
dmHub
:
applicationId
:
cl0
300171a6012c21
applicationKey
:
4017078e9dfd593b2d9a0ede58eff589644fbe50
tokenUrl
:
https://api
.convertlab.com
/security/accesstoken
report
:
https://api
.convertlab.com
/v1/sms/report
applicationId
:
cl0
16b172dab13e2b
applicationKey
:
834f5758ce3ab9d9c01b80e6d0a51ff3dda48bd3
tokenUrl
:
https://api
-xscdp.bgy.com.cn
/security/accesstoken
report
:
https://api
-xscdp.bgy.com.cn
/v1/sms/report
appId
:
1smsdemo
appSecret
:
ac031765c3a8c9acc4747808e4fe5918
...
...
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