记得上下班打卡 | git大法好,push需谨慎
Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
liquidnet-bus-v1
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
董敬伟
liquidnet-bus-v1
Commits
de9e3b8d
Commit
de9e3b8d
authored
Feb 22, 2022
by
anjiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
调试加密解密相关接口
parent
c06121f1
Changes
19
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
335 additions
and
19 deletions
+335
-19
ZxlnftConfig.java
...om/liquidnet/common/third/zxlnft/config/ZxlnftConfig.java
+27
-0
ZxlnftConstant.java
...iquidnet/common/third/zxlnft/constant/ZxlnftConstant.java
+1
-1
Nft001RegisterVerifyCodeReq.java
...mon/third/zxlnft/dto/nft/Nft001RegisterVerifyCodeReq.java
+4
-0
Nft001RegisterVerifyCodeResp.java
...on/third/zxlnft/dto/nft/Nft001RegisterVerifyCodeResp.java
+3
-0
Nft002RegisterPersonReq.java
.../common/third/zxlnft/dto/nft/Nft002RegisterPersonReq.java
+9
-0
Nft002RegisterPersonResp.java
...common/third/zxlnft/dto/nft/Nft002RegisterPersonResp.java
+7
-0
Nft003RegisterPersonPlatformReq.java
...third/zxlnft/dto/nft/Nft003RegisterPersonPlatformReq.java
+13
-0
Nft003RegisterPersonPlatformResp.java
...hird/zxlnft/dto/nft/Nft003RegisterPersonPlatformResp.java
+7
-0
Nft054QueryUserAddressBelongToUserReq.java
...zxlnft/dto/nft/Nft054QueryUserAddressBelongToUserReq.java
+32
-0
Nft054QueryUserAddressBelongToUserResp.java
...xlnft/dto/nft/Nft054QueryUserAddressBelongToUserResp.java
+21
-0
SignByPriKeyReq.java
...idnet/common/third/zxlnft/dto/wallet/SignByPriKeyReq.java
+9
-0
SignByPriKeyResp.java
...dnet/common/third/zxlnft/dto/wallet/SignByPriKeyResp.java
+9
-0
VerifyByPubKeyReq.java
...net/common/third/zxlnft/dto/wallet/VerifyByPubKeyReq.java
+10
-0
VerifyByPubKeyResp.java
...et/common/third/zxlnft/dto/wallet/VerifyByPubKeyResp.java
+1
-0
WalletSdkService.java
...quidnet/common/third/zxlnft/service/WalletSdkService.java
+12
-12
WalletSdkServiceImpl.java
...ommon/third/zxlnft/service/impl/WalletSdkServiceImpl.java
+46
-2
ZxlnftSdkServiceImpl.java
...ommon/third/zxlnft/service/impl/ZxlnftSdkServiceImpl.java
+42
-0
ZxlnftSdkUtil.java
...com/liquidnet/common/third/zxlnft/util/ZxlnftSdkUtil.java
+14
-4
TestZxlWalletSdkUtil.java
...m/liquidnet/service/zxlnft/test/TestZxlWalletSdkUtil.java
+68
-0
No files found.
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/config/ZxlnftConfig.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
config
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
config
;
import
com.liquidnet.commons.lang.util.BASE64Util
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
java.io.UnsupportedEncodingException
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -20,6 +23,10 @@ public class ZxlnftConfig {
...
@@ -20,6 +23,10 @@ public class ZxlnftConfig {
private
String
appKey
;
private
String
appKey
;
@Value
(
"${liquidnet.zxlnft.nftPlatformAddress:ZXa66c8a684727d0f9aaa434044362aa8a18b61bb4}"
)
@Value
(
"${liquidnet.zxlnft.nftPlatformAddress:ZXa66c8a684727d0f9aaa434044362aa8a18b61bb4}"
)
private
String
nftPlatformAddress
;
private
String
nftPlatformAddress
;
@Value
(
"${liquidnet.zxlnft.nftPlatformPubKey:LS0tLS1CRUdJTiBQVUJMSUMgS0VZLS0tLS0KTUZrd0V3WUhLb1pJemowQ0FRWUlLb0VjejFVQmdpMERRZ0FFbFNTQk00MHJIZlJFa0NjWUxlRm1RZzE0SHlIcAp5Rk9uSktzblFqbDBCL2JXOStFWnZPblArNW0vMEdkUCtXM29yeG5Kd3p5OHNoYS9OYkQ4QVBmNXlBPT0KLS0tLS1FTkQgUFVCTElDIEtFWS0tLS0tCg==}"
)
private
String
nftPlatformPubKey
;
@Value
(
"${liquidnet.zxlnft.nftPlatformPriKey:LS0tLS1CRUdJTiBQUklWQVRFIEtFWS0tLS0tCk1JR1RBZ0VBTUJNR0J5cUdTTTQ5QWdFR0NDcUJITTlWQVlJdEJIa3dkd0lCQVFRZ1VhbTVWM2V6ZFZJTmNoZ28KVDRKL28zMHArMGJCd3hQWUZFL01FdEU3MTZhZ0NnWUlLb0VjejFVQmdpMmhSQU5DQUFTVkpJRXpqU3NkOUVTUQpKeGd0NFdaQ0RYZ2ZJZW5JVTZja3F5ZENPWFFIOXRiMzRSbTg2Yy83bWIvUVowLzViZWl2R2NuRFBMeXlGcjgxCnNQd0E5L25JCi0tLS0tRU5EIFBSSVZBVEUgS0VZLS0tLS0K}"
)
private
String
nftPlatformPriKey
;
@Value
(
"${liquidnet.zxlnft.walletSdkUrl:'http://127.0.0.1:30505'}"
)
@Value
(
"${liquidnet.zxlnft.walletSdkUrl:'http://127.0.0.1:30505'}"
)
private
String
walletSdkUrl
;
private
String
walletSdkUrl
;
@Value
(
"${liquidnet.zxlnft.nftApiUrl:'https://nfttest2.zxinchain.com'}"
)
@Value
(
"${liquidnet.zxlnft.nftApiUrl:'https://nfttest2.zxinchain.com'}"
)
...
@@ -37,6 +44,26 @@ public class ZxlnftConfig {
...
@@ -37,6 +44,26 @@ public class ZxlnftConfig {
return
nftPlatformAddress
;
return
nftPlatformAddress
;
}
}
public
String
getNftPlatformPubKey
(){
String
pubKey
=
null
;
try
{
pubKey
=
BASE64Util
.
decode
(
nftPlatformPubKey
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
pubKey
;
}
public
String
getNftPlatformPriKey
(){
String
priKey
=
null
;
try
{
priKey
=
BASE64Util
.
decode
(
nftPlatformPriKey
);
}
catch
(
UnsupportedEncodingException
e
)
{
e
.
printStackTrace
();
}
return
priKey
;
}
public
String
getWalletSdkUrl
(){
public
String
getWalletSdkUrl
(){
return
walletSdkUrl
;
return
walletSdkUrl
;
}
}
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/constant/ZxlnftConstant.java
View file @
de9e3b8d
...
@@ -20,7 +20,7 @@ public class ZxlnftConstant {
...
@@ -20,7 +20,7 @@ public class ZxlnftConstant {
public
static
String
WALLET_SDK_07_PRI_KEY_2_PUB_KEY
=
"/PriKey2PubKey"
;
public
static
String
WALLET_SDK_07_PRI_KEY_2_PUB_KEY
=
"/PriKey2PubKey"
;
public
static
String
WALLET_SDK_08_PUB_KEY_2_ADDRESS
=
"/PubKey2Address"
;
public
static
String
WALLET_SDK_08_PUB_KEY_2_ADDRESS
=
"/PubKey2Address"
;
public
static
String
WALLET_SDK_09_PRI_KEY_2_ADDRESS
=
"/PriKey2Address"
;
public
static
String
WALLET_SDK_09_PRI_KEY_2_ADDRESS
=
"/PriKey2Address"
;
public
static
String
WALLET_SDK_10_VERIFY_BY_PUB_KEY
=
"/
v
erifyByPubKey"
;
public
static
String
WALLET_SDK_10_VERIFY_BY_PUB_KEY
=
"/
V
erifyByPubKey"
;
public
static
String
WALLET_SDK_11_SM3_HASH
=
"/SM3Hash"
;
public
static
String
WALLET_SDK_11_SM3_HASH
=
"/SM3Hash"
;
public
static
String
WALLET_SDK_12_SM3_HASH_ENCODE
=
"/SM3HashEncode"
;
public
static
String
WALLET_SDK_12_SM3_HASH_ENCODE
=
"/SM3HashEncode"
;
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft001RegisterVerifyCodeReq.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,7 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,7 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:20
* @date 2022/2/18 15:20
*/
*/
@Data
public
class
Nft001RegisterVerifyCodeReq
{
public
class
Nft001RegisterVerifyCodeReq
{
private
String
mobile
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft001RegisterVerifyCodeResp.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,6 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,6 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:20
* @date 2022/2/18 15:20
*/
*/
@Data
public
class
Nft001RegisterVerifyCodeResp
{
public
class
Nft001RegisterVerifyCodeResp
{
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft002RegisterPersonReq.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,12 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,12 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:20
* @date 2022/2/18 15:20
*/
*/
@Data
public
class
Nft002RegisterPersonReq
{
public
class
Nft002RegisterPersonReq
{
private
String
personName
;
private
String
email
;
private
String
mobile
;
private
String
verifyCode
;
private
String
idCard
;
private
int
cardType
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft002RegisterPersonResp.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,10 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,10 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:20
* @date 2022/2/18 15:20
*/
*/
@Data
public
class
Nft002RegisterPersonResp
{
public
class
Nft002RegisterPersonResp
{
/**
* 用户唯一标识
*/
private
String
userIdentification
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft003RegisterPersonPlatformReq.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,16 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,16 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:22
* @date 2022/2/18 15:22
*/
*/
@Data
public
class
Nft003RegisterPersonPlatformReq
{
public
class
Nft003RegisterPersonPlatformReq
{
private
String
personName
;
/**
* 用户邮箱(非必填)
*/
private
String
email
;
private
String
mobile
;
private
String
idCard
;
private
int
cardType
;
private
String
platformPubKey
;
private
String
platformSignData
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft003RegisterPersonPlatformResp.java
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @version V1.0
...
@@ -9,5 +11,10 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
...
@@ -9,5 +11,10 @@ package com.liquidnet.common.third.zxlnft.dto.nft;
* @Copyright: LightNet @ Copyright (c) 2021
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/18 15:22
* @date 2022/2/18 15:22
*/
*/
@Data
public
class
Nft003RegisterPersonPlatformResp
{
public
class
Nft003RegisterPersonPlatformResp
{
/**
* 用户唯一标识
*/
private
String
userIdentification
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft054QueryUserAddressBelongToUserReq.java
0 → 100644
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: Nft054QueryUserAddressBelongToUser
* @Package com.liquidnet.common.third.zxlnft.dto.nft
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/21 15:01
*/
@Data
public
class
Nft054QueryUserAddressBelongToUserReq
{
/**
* 第一个地址
*/
private
String
address1
;
/**
* 第二个地址
*/
private
String
address2
;
/**
* 平台公钥
*/
private
String
platformPubKey
;
/**
* 平台签名信息:sign(address1+address2)
*/
private
String
platformSignData
;
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/nft/Nft054QueryUserAddressBelongToUserResp.java
0 → 100644
View file @
de9e3b8d
package
com
.
liquidnet
.
common
.
third
.
zxlnft
.
dto
.
nft
;
import
lombok.Data
;
/**
* @author AnJiabin <anjiabin@zhengzai.tv>
* @version V1.0
* @Description: TODO
* @class: Nft054QueryUserAddressBelongToUser
* @Package com.liquidnet.common.third.zxlnft.dto.nft
* @Copyright: LightNet @ Copyright (c) 2021
* @date 2022/2/21 15:01
*/
@Data
public
class
Nft054QueryUserAddressBelongToUserResp
{
/**
* true 同一主体
* false: 非同一主体
*/
private
Boolean
result
;
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/wallet/SignByPriKeyReq.java
View file @
de9e3b8d
...
@@ -21,4 +21,13 @@ public class SignByPriKeyReq {
...
@@ -21,4 +21,13 @@ public class SignByPriKeyReq {
* 签名后的数据
* 签名后的数据
*/
*/
private
String
data
;
private
String
data
;
private
static
final
SignByPriKeyReq
obj
=
new
SignByPriKeyReq
();
public
static
SignByPriKeyReq
getNew
()
{
try
{
return
(
SignByPriKeyReq
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
SignByPriKeyReq
();
}
}
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/wallet/SignByPriKeyResp.java
View file @
de9e3b8d
...
@@ -21,4 +21,13 @@ public class SignByPriKeyResp {
...
@@ -21,4 +21,13 @@ public class SignByPriKeyResp {
* 签名后的数据
* 签名后的数据
*/
*/
private
String
signedData
;
private
String
signedData
;
private
static
final
SignByPriKeyResp
obj
=
new
SignByPriKeyResp
();
public
static
SignByPriKeyResp
getNew
()
{
try
{
return
(
SignByPriKeyResp
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
SignByPriKeyResp
();
}
}
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/wallet/VerifyByPubKeyReq.java
View file @
de9e3b8d
...
@@ -25,4 +25,14 @@ public class VerifyByPubKeyReq {
...
@@ -25,4 +25,14 @@ public class VerifyByPubKeyReq {
* 签名前的数据
* 签名前的数据
*/
*/
private
String
data
;
private
String
data
;
private
static
final
VerifyByPubKeyReq
obj
=
new
VerifyByPubKeyReq
();
public
static
VerifyByPubKeyReq
getNew
()
{
try
{
return
(
VerifyByPubKeyReq
)
obj
.
clone
();
}
catch
(
CloneNotSupportedException
e
)
{
return
new
VerifyByPubKeyReq
();
}
}
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/dto/wallet/VerifyByPubKeyResp.java
View file @
de9e3b8d
...
@@ -15,4 +15,5 @@ import lombok.Data;
...
@@ -15,4 +15,5 @@ import lombok.Data;
public
class
VerifyByPubKeyResp
{
public
class
VerifyByPubKeyResp
{
private
String
err
;
private
String
err
;
private
Boolean
isValid
;
private
Boolean
isValid
;
}
}
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/service/WalletSdkService.java
View file @
de9e3b8d
...
@@ -4,84 +4,84 @@ import com.liquidnet.common.third.zxlnft.dto.wallet.*;
...
@@ -4,84 +4,84 @@ import com.liquidnet.common.third.zxlnft.dto.wallet.*;
public
interface
WalletSdkService
{
public
interface
WalletSdkService
{
/**
/**
* 生成助记词
*
1.
生成助记词
* @param req
* @param req
* @return
* @return
*/
*/
CreateMnemonicResp
createMnemonic
(
CreateMnemonicReq
req
);
CreateMnemonicResp
createMnemonic
(
CreateMnemonicReq
req
);
/**
/**
* Api签名
*
2.
Api签名
* @param req
* @param req
* @return
* @return
*/
*/
GenerateApiSignResp
generateApiSign
(
GenerateApiSignReq
req
);
GenerateApiSignResp
generateApiSign
(
GenerateApiSignReq
req
);
/**
/**
* 文件上传至cos
*
3.
文件上传至cos
* @param req
* @param req
* @return
* @return
*/
*/
UploadToCosResp
uploadToCos
(
UploadToCosReq
req
);
UploadToCosResp
uploadToCos
(
UploadToCosReq
req
);
/**
/**
* 文件上传至cos(form-data文件提交)
*
4.
文件上传至cos(form-data文件提交)
* @param req
* @param req
* @return
* @return
*/
*/
UploadFileToCosResp
uploadFileToCos
(
UploadFileToCosReq
req
);
UploadFileToCosResp
uploadFileToCos
(
UploadFileToCosReq
req
);
/**
/**
* 派生生成子公司钥对
*
5.
派生生成子公司钥对
* @param req
* @param req
* @return
* @return
*/
*/
DeriveKeyPairResp
deriveKeyPair
(
DeriveKeyPairReq
req
);
DeriveKeyPairResp
deriveKeyPair
(
DeriveKeyPairReq
req
);
/**
/**
* sdk-签名
*
6.
sdk-签名
* @param req
* @param req
* @return
* @return
*/
*/
SignByPriKeyResp
signByPriKey
(
SignByPriKeyReq
req
);
SignByPriKeyResp
signByPriKey
(
SignByPriKeyReq
req
);
/**
/**
* sdk-私钥生成对应公钥
*
7.
sdk-私钥生成对应公钥
* @param req
* @param req
* @return
* @return
*/
*/
PriKey2PubKeyResp
priKey2PubKey
(
PriKey2PubKeyReq
req
);
PriKey2PubKeyResp
priKey2PubKey
(
PriKey2PubKeyReq
req
);
/**
/**
* sdk-公钥生成对应地址
*
8.
sdk-公钥生成对应地址
* @param req
* @param req
* @return
* @return
*/
*/
PubKey2AddressResp
pubKey2Address
(
PubKey2AddressReq
req
);
PubKey2AddressResp
pubKey2Address
(
PubKey2AddressReq
req
);
/**
/**
* sdk-私钥生成对应地址
*
9.
sdk-私钥生成对应地址
* @param req
* @param req
* @return
* @return
*/
*/
PriKey2AddressResp
priKey2Address
(
PriKey2AddressReq
req
);
PriKey2AddressResp
priKey2Address
(
PriKey2AddressReq
req
);
/**
/**
* sdk-签名
*
10.
sdk-签名
* @param req
* @param req
* @return
* @return
*/
*/
VerifyByPubKeyResp
verifyByPubKey
(
VerifyByPubKeyReq
req
);
VerifyByPubKeyResp
verifyByPubKey
(
VerifyByPubKeyReq
req
);
/**
/**
* sdk-SM3哈希
*
11.
sdk-SM3哈希
* @param req
* @param req
* @return
* @return
*/
*/
SM3HashResp
sM3Hash
(
SM3HashReq
req
);
SM3HashResp
sM3Hash
(
SM3HashReq
req
);
/**
/**
* sdk-SM3哈希EnCode
*
12.
sdk-SM3哈希EnCode
* @param req
* @param req
* @return
* @return
*/
*/
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/service/impl/WalletSdkServiceImpl.java
View file @
de9e3b8d
...
@@ -98,7 +98,29 @@ public class WalletSdkServiceImpl implements WalletSdkService {
...
@@ -98,7 +98,29 @@ public class WalletSdkServiceImpl implements WalletSdkService {
@Override
@Override
public
SignByPriKeyResp
signByPriKey
(
SignByPriKeyReq
req
)
{
public
SignByPriKeyResp
signByPriKey
(
SignByPriKeyReq
req
)
{
return
null
;
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"priKey"
,
req
.
getPriKey
());
json
.
put
(
"data"
,
req
.
getData
());
String
requestUrl
=
zxlnftConfig
.
getWalletSdkUrl
()
+
ZxlnftConstant
.
WALLET_SDK_06_SIGN_BY_PRI_KEY
;
log
.
info
(
"signByPriKey--->>> request url : {} body : {} "
,
requestUrl
,
json
.
toString
());
String
response
=
null
;
// ObjectNode objectNode = JsonUtils.OM().createObjectNode();
try
{
response
=
HttpUtil
.
postJson
(
requestUrl
,
json
.
toString
(),
commonHeader
);
}
catch
(
HttpClientErrorException
e
)
{
log
.
error
(
"signByPriKey error"
,
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"signByPriKey error"
,
e
);
}
log
.
info
(
"signByPriKey--->>> response : {} "
,
response
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
null
;
}
SignByPriKeyResp
resp
=
JsonUtils
.
fromJson
(
response
,
SignByPriKeyResp
.
class
);
return
resp
;
}
}
@Override
@Override
...
@@ -118,7 +140,29 @@ public class WalletSdkServiceImpl implements WalletSdkService {
...
@@ -118,7 +140,29 @@ public class WalletSdkServiceImpl implements WalletSdkService {
@Override
@Override
public
VerifyByPubKeyResp
verifyByPubKey
(
VerifyByPubKeyReq
req
)
{
public
VerifyByPubKeyResp
verifyByPubKey
(
VerifyByPubKeyReq
req
)
{
return
null
;
JSONObject
json
=
new
JSONObject
();
json
.
put
(
"pubKey"
,
req
.
getPubKey
());
json
.
put
(
"signedData"
,
req
.
getSignedData
());
json
.
put
(
"data"
,
req
.
getData
());
String
requestUrl
=
zxlnftConfig
.
getWalletSdkUrl
()
+
ZxlnftConstant
.
WALLET_SDK_10_VERIFY_BY_PUB_KEY
;
log
.
info
(
"verifyByPubKey--->>> request url : {} body : {} "
,
requestUrl
,
json
.
toString
());
String
response
=
null
;
try
{
response
=
HttpUtil
.
postJson
(
requestUrl
,
json
.
toString
(),
commonHeader
);
}
catch
(
HttpClientErrorException
e
)
{
log
.
error
(
"verifyByPubKey error"
,
e
);
}
catch
(
Exception
e
)
{
log
.
error
(
"verifyByPubKey error"
,
e
);
}
log
.
info
(
"verifyByPubKey--->>> response : {} "
,
response
);
if
(
StringUtils
.
isEmpty
(
response
))
{
return
null
;
}
VerifyByPubKeyResp
resp
=
JsonUtils
.
fromJson
(
response
,
VerifyByPubKeyResp
.
class
);
return
resp
;
}
}
@Override
@Override
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/service/impl/ZxlnftSdkServiceImpl.java
View file @
de9e3b8d
...
@@ -32,6 +32,48 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
...
@@ -32,6 +32,48 @@ public class ZxlnftSdkServiceImpl implements ZxlnftSdkService
private
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
private
MultiValueMap
<
String
,
String
>
commonHeader
=
new
LinkedMultiValueMap
();
// @Override
// public Nft001RegisterVerifyCodeResp nft001RegisterVerifyCode(Nft001RegisterVerifyCodeReq req) {
// zxlnftBiz.buildHeader(commonHeader);
//
// JSONObject json = new JSONObject();
// json.put("mobile", req.get);
// json.put("apKey", req.getAppKey());
//
// String requestUrl = zxlnftConfig.getNftApiUrl() + ZxlnftConstant.ZXL_NFT_016_IDENTITY_BIND_QUERY_URL;
// log.info("nft001RegisterVerifyCode--->>> request url : {} body : {} ",requestUrl, params.toString());
//
// String response = null;
//// ObjectNode objectNode = JsonUtils.OM().createObjectNode();
// try {
// response = HttpUtil.postJson(requestUrl,json.toString(),commonHeader);
// } catch(HttpClientErrorException e) {
// log.error("nft001RegisterVerifyCode error", e);
// }catch (Exception e) {
// log.error("nft001RegisterVerifyCode error",e);
// }
// log.info("nft001RegisterVerifyCode--->>> response : {} ",response);
//
// if (StringUtils.isEmpty(response)) {
// return null;
// }
//
// Nft001RegisterVerifyCodeResp resp = Nft001RegisterVerifyCodeResp.getNew();
// JSONObject json = JSONObject.parseObject(response);
// if (json.containsKey("retCode") && json.containsKey("data") && json.getInteger("retCode").intValue() == 0) {
// JSONObject data = json.getJSONObject("data");
// resp = JsonUtils.fromJson(data.toJSONString(),Nft001RegisterVerifyCodeResp.class);
// }else {
// if (json.containsKey("retCode") && json.getInteger("retCode").intValue() != 0) {
// throw new ZxlNftException(String.valueOf(json.getInteger("retCode")), json.getString("retMsg") + ", address:" + req.getAddressList());
// }
// throw new ZxlNftException(json.getString("retCode"), json.getString("retMsg") + ", address:" + req.getAddressList());
// }
//
// log.info("nft001RegisterVerifyCode--->>> return result : {} ",resp.toString());
// return resp;
// }
@Override
@Override
public
Nft001RegisterVerifyCodeResp
nft001RegisterVerifyCode
(
Nft001RegisterVerifyCodeReq
req
)
{
public
Nft001RegisterVerifyCodeResp
nft001RegisterVerifyCode
(
Nft001RegisterVerifyCodeReq
req
)
{
return
null
;
return
null
;
...
...
liquidnet-bus-common/liquidnet-common-third/liquidnet-common-third-zxlnft/src/main/java/com/liquidnet/common/third/zxlnft/util/ZxlnftSdkUtil.java
View file @
de9e3b8d
...
@@ -3,10 +3,7 @@ package com.liquidnet.common.third.zxlnft.util;
...
@@ -3,10 +3,7 @@ package com.liquidnet.common.third.zxlnft.util;
import
com.liquidnet.common.third.zxlnft.config.ZxlnftConfig
;
import
com.liquidnet.common.third.zxlnft.config.ZxlnftConfig
;
import
com.liquidnet.common.third.zxlnft.dto.nft.Nft016IdentityBindQueryReq
;
import
com.liquidnet.common.third.zxlnft.dto.nft.Nft016IdentityBindQueryReq
;
import
com.liquidnet.common.third.zxlnft.dto.nft.Nft016IdentityBindQueryResp
;
import
com.liquidnet.common.third.zxlnft.dto.nft.Nft016IdentityBindQueryResp
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.*
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicResp
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.GenerateApiSignReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.GenerateApiSignResp
;
import
com.liquidnet.common.third.zxlnft.service.WalletSdkService
;
import
com.liquidnet.common.third.zxlnft.service.WalletSdkService
;
import
com.liquidnet.common.third.zxlnft.service.ZxlnftSdkService
;
import
com.liquidnet.common.third.zxlnft.service.ZxlnftSdkService
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
...
@@ -33,6 +30,8 @@ public class ZxlnftSdkUtil {
...
@@ -33,6 +30,8 @@ public class ZxlnftSdkUtil {
@Autowired
@Autowired
private
ZxlnftSdkService
zxlnftSdkService
;
private
ZxlnftSdkService
zxlnftSdkService
;
public
CreateMnemonicResp
createMnemonic
(
CreateMnemonicReq
req
){
public
CreateMnemonicResp
createMnemonic
(
CreateMnemonicReq
req
){
CreateMnemonicResp
resp
=
walletSdkService
.
createMnemonic
(
req
);
CreateMnemonicResp
resp
=
walletSdkService
.
createMnemonic
(
req
);
return
resp
;
return
resp
;
...
@@ -43,6 +42,17 @@ public class ZxlnftSdkUtil {
...
@@ -43,6 +42,17 @@ public class ZxlnftSdkUtil {
return
resp
;
return
resp
;
}
}
public
SignByPriKeyResp
signByPriKey
(
SignByPriKeyReq
req
){
SignByPriKeyResp
resp
=
walletSdkService
.
signByPriKey
(
req
);
return
resp
;
}
public
VerifyByPubKeyResp
verifyByPubKey
(
VerifyByPubKeyReq
req
){
VerifyByPubKeyResp
resp
=
walletSdkService
.
verifyByPubKey
(
req
);
return
resp
;
}
public
Nft016IdentityBindQueryResp
nft016IdentityBindQuery
(
Nft016IdentityBindQueryReq
req
){
public
Nft016IdentityBindQueryResp
nft016IdentityBindQuery
(
Nft016IdentityBindQueryReq
req
){
req
.
setAddressList
(
zxlnftConfig
.
getNftPlatformAddress
());
req
.
setAddressList
(
zxlnftConfig
.
getNftPlatformAddress
());
Nft016IdentityBindQueryResp
resp
=
zxlnftSdkService
.
nft016IdentityBindQuery
(
req
);
Nft016IdentityBindQueryResp
resp
=
zxlnftSdkService
.
nft016IdentityBindQuery
(
req
);
...
...
liquidnet-bus-service/liquidnet-service-zxlnft/liquidnet-service-zxlnft-impl/src/test/java/com/liquidnet/service/zxlnft/test/TestZxl
nf
tSdkUtil.java
→
liquidnet-bus-service/liquidnet-service-zxlnft/liquidnet-service-zxlnft-impl/src/test/java/com/liquidnet/service/zxlnft/test/TestZxl
Walle
tSdkUtil.java
View file @
de9e3b8d
package
com
.
liquidnet
.
service
.
zxlnft
.
test
;
package
com
.
liquidnet
.
service
.
zxlnft
.
test
;
import
com.liquidnet.common.third.zxlnft.config.ZxlnftConfig
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.CreateMnemonicReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.GenerateApiSignReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.GenerateApiSignReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.SignByPriKeyReq
;
import
com.liquidnet.common.third.zxlnft.dto.wallet.VerifyByPubKeyReq
;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
com.liquidnet.common.third.zxlnft.util.ZxlnftSdkUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.Test
;
import
org.junit.Test
;
...
@@ -22,10 +25,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
...
@@ -22,10 +25,13 @@ import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@Slf4j
@Slf4j
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@RunWith
(
SpringJUnit4ClassRunner
.
class
)
@SpringBootTest
@SpringBootTest
public
class
TestZxl
nf
tSdkUtil
{
public
class
TestZxl
Walle
tSdkUtil
{
@Autowired
@Autowired
private
ZxlnftSdkUtil
zxlnftSdkUtil
;
private
ZxlnftSdkUtil
zxlnftSdkUtil
;
@Autowired
private
ZxlnftConfig
zxlnftConfig
;
@Test
@Test
public
void
createMnemonic
(){
public
void
createMnemonic
(){
CreateMnemonicReq
req
=
CreateMnemonicReq
.
getNew
();
CreateMnemonicReq
req
=
CreateMnemonicReq
.
getNew
();
...
@@ -39,4 +45,24 @@ public class TestZxlnftSdkUtil {
...
@@ -39,4 +45,24 @@ public class TestZxlnftSdkUtil {
req
.
setAppKey
(
""
);
req
.
setAppKey
(
""
);
zxlnftSdkUtil
.
generateApiSign
(
req
);
zxlnftSdkUtil
.
generateApiSign
(
req
);
}
}
@Test
public
void
signByPriKey
(){
SignByPriKeyReq
req
=
SignByPriKeyReq
.
getNew
();
// req.setPriKey(zxlnftConfig.getNftPlatformPriKey());
req
.
setPriKey
(
zxlnftConfig
.
getNftPlatformPriKey
());
req
.
setData
(
"ZXa66c8a684727d0f9aaa434044362aa8a18b61bb4"
);
//3045022072ba19d02f43ae883764ffa43d111ab62fd0bcd6ace31bc91356e7ce38756cbb022100deb5f7666f4768f297ccdf386a867d2a0d71227548f2595a62130e5016fb1d54
zxlnftSdkUtil
.
signByPriKey
(
req
);
}
@Test
public
void
verifyByPubKey
(){
VerifyByPubKeyReq
req
=
VerifyByPubKeyReq
.
getNew
();
req
.
setPubKey
(
zxlnftConfig
.
getNftPlatformPubKey
());
req
.
setData
(
"ZXa66c8a684727d0f9aaa434044362aa8a18b61bb4-"
);
req
.
setSignedData
(
"3045022072ba19d02f43ae883764ffa43d111ab62fd0bcd6ace31bc91356e7ce38756cbb022100deb5f7666f4768f297ccdf386a867d2a0d71227548f2595a62130e5016fb1d54"
);
//3045022072ba19d02f43ae883764ffa43d111ab62fd0bcd6ace31bc91356e7ce38756cbb022100deb5f7666f4768f297ccdf386a867d2a0d71227548f2595a62130e5016fb1d54
zxlnftSdkUtil
.
verifyByPubKey
(
req
);
}
}
}
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