├── .classpath
├── .github
└── workflows
│ └── docker.yml
├── .gitignore
├── .project
├── .settings
├── org.eclipse.buildship.core.prefs
└── org.eclipse.jdt.core.prefs
├── Changelog.md
├── LICENSE
├── README.md
├── bin
└── .gitignore
├── build.gradle
├── docker
└── build
│ ├── Dockerfile
│ └── build.sh
├── gradle
└── wrapper
│ ├── gradle-wrapper.jar
│ └── gradle-wrapper.properties
├── gradlew
├── gradlew.bat
├── release_note.txt
├── sider.yml
├── src
└── main
│ ├── java
│ └── com
│ │ └── webank
│ │ └── webase
│ │ └── sign
│ │ ├── Application.java
│ │ ├── api
│ │ ├── controller
│ │ │ ├── SignController.java
│ │ │ ├── UserController.java
│ │ │ └── VersionController.java
│ │ ├── dao
│ │ │ └── UserDao.java
│ │ └── service
│ │ │ ├── KeyStoreService.java
│ │ │ ├── SignService.java
│ │ │ └── UserService.java
│ │ ├── aspect
│ │ └── LogAspect.java
│ │ ├── config
│ │ ├── BeanConfig.java
│ │ ├── SwaggerConfig.java
│ │ ├── TableInitConfig.java
│ │ └── TomcatConfig.java
│ │ ├── constant
│ │ ├── ConstantProperties.java
│ │ └── VersionProperties.java
│ │ ├── enums
│ │ ├── CodeMessageEnums.java
│ │ ├── EncryptTypes.java
│ │ └── KeyStatus.java
│ │ ├── exception
│ │ ├── BaseException.java
│ │ ├── ExceptionsHandler.java
│ │ └── ParamException.java
│ │ ├── manager
│ │ └── LoggerManager.java
│ │ ├── pojo
│ │ ├── bo
│ │ │ ├── BaseQueryParam.java
│ │ │ ├── KeyStoreInfo.java
│ │ │ └── UserParam.java
│ │ ├── po
│ │ │ └── UserInfoPo.java
│ │ └── vo
│ │ │ ├── BasePageRspVo.java
│ │ │ ├── BaseRspVo.java
│ │ │ ├── ReqEncodeInfoVo.java
│ │ │ ├── ReqNewUserVo.java
│ │ │ ├── ReqSignMessageHashVo.java
│ │ │ ├── ReqUserInfoVo.java
│ │ │ ├── RspSignVo.java
│ │ │ └── RspUserInfoVo.java
│ │ ├── task
│ │ └── SynUsrTask.java
│ │ └── util
│ │ ├── AesUtils.java
│ │ ├── CommonUtils.java
│ │ └── JsonUtils.java
│ └── resources
│ ├── application-docker.yml
│ ├── application.yml
│ ├── log4j2.xml
│ ├── mapper
│ └── UserDao.xml
│ └── swagger
│ ├── favicon-16x16.png
│ ├── favicon-32x32.png
│ ├── index.html
│ ├── swagger-ui-bundle.js
│ ├── swagger-ui-bundle.js.map
│ ├── swagger-ui-standalone-preset.js
│ ├── swagger-ui-standalone-preset.js.map
│ ├── swagger-ui.css
│ ├── swagger-ui.css.map
│ ├── swagger-ui.js
│ └── swagger-ui.js.map
├── start.sh
├── status.sh
└── stop.sh
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 |
107 |
108 |
109 |
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 |
121 |
122 |
123 |
124 |
125 |
126 |
127 |
128 |
129 |
130 |
131 |
132 |
133 |
134 |
135 |
136 |
137 |
138 |
139 |
140 |
141 |
142 |
143 |
144 |
145 |
146 |
147 |
148 |
149 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
161 |
162 |
163 |
164 |
165 |
166 |
167 |
168 |
169 |
170 |
171 |
172 |
173 |
174 |
175 |
176 |
177 |
178 |
179 |
180 |
181 |
182 |
183 |
184 |
185 |
186 |
187 |
188 |
189 |
190 |
191 |
192 |
193 |
194 |
195 |
196 |
197 |
198 |
199 |
200 |
201 |
202 |
203 |
204 |
205 |
206 |
207 |
208 |
209 |
210 |
211 |
212 |
213 |
214 |
215 |
216 |
217 |
218 |
219 |
220 |
221 |
222 |
223 |
224 |
225 |
226 |
227 |
228 |
229 |
230 |
231 |
232 |
233 |
234 |
235 |
236 |
237 |
238 |
239 |
240 |
241 |
242 |
243 |
244 |
245 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
257 |
258 |
259 |
260 |
261 |
262 |
263 |
264 |
265 |
266 |
267 |
268 |
269 |
270 |
271 |
272 |
273 |
274 |
275 |
276 |
277 |
278 |
279 |
280 |
281 |
282 |
283 |
284 |
285 |
286 |
287 |
288 |
289 |
290 |
291 |
292 |
293 |
294 |
295 |
296 |
297 |
298 |
299 |
300 |
301 |
302 |
303 |
304 |
305 |
306 |
307 |
308 |
309 |
310 |
311 |
312 |
313 |
314 |
315 |
316 |
317 |
318 |
319 |
320 |
321 |
322 |
323 |
324 |
325 |
326 |
327 |
328 |
329 |
330 |
331 |
332 |
333 |
334 |
335 |
336 |
337 |
338 |
339 |
340 |
341 |
342 |
343 |
344 |
345 |
346 |
347 |
348 |
349 |
350 |
351 |
352 |
353 |
354 |
355 |
356 |
357 |
358 |
359 |
360 |
361 |
362 |
363 |
364 |
365 |
366 |
367 |
368 |
369 |
370 |
371 |
372 |
373 |
374 |
375 |
376 |
377 |
378 |
379 |
380 |
381 |
382 |
383 |
384 |
385 |
386 |
387 |
388 |
389 |
390 |
391 |
392 |
393 |
394 |
395 |
396 |
397 |
398 |
399 |
400 |
401 |
402 |
403 |
404 |
405 |
406 |
407 |
408 |
409 |
410 |
411 |
412 |
413 |
414 |
415 |
416 |
417 |
418 |
419 |
420 |
421 |
422 |
423 |
424 |
425 |
426 |
427 |
428 |
429 |
430 |
431 |
432 |
433 |
434 |
435 |
436 |
437 |
438 |
439 |
440 |
441 |
442 |
443 |
444 |
445 |
446 |
447 |
448 |
449 |
450 |
451 |
452 |
453 |
454 |
455 |
456 |
457 |
458 |
459 |
460 |
461 |
462 |
463 |
464 |
465 |
466 |
467 |
468 |
469 |
470 |
471 |
472 |
473 |
474 |
475 |
476 |
477 |
478 |
479 |
480 |
481 |
482 |
483 |
484 |
485 |
486 |
487 |
488 |
489 |
490 |
491 |
492 |
493 |
494 |
495 |
496 |
497 |
498 |
499 |
500 |
501 |
502 |
503 |
504 |
505 |
506 |
507 |
508 |
509 |
510 |
511 |
512 |
513 |
514 |
515 |
516 |
517 |
518 |
519 |
520 |
521 |
522 |
523 |
524 |
525 |
526 |
527 |
528 |
529 |
530 |
531 |
532 |
533 |
534 |
--------------------------------------------------------------------------------
/.github/workflows/docker.yml:
--------------------------------------------------------------------------------
1 | name: Docker Build And Push To Docker Hub
2 |
3 | on:
4 | # schedule:
5 | # - cron: '0 10 * * *' # everyday at 10am
6 | push:
7 | tags:
8 | - 'v*.*.*'
9 | # pull_request:
10 |
11 | env:
12 | DOCKER_REPOSITORY: webase-sign
13 |
14 |
15 | jobs:
16 | main:
17 | runs-on: ubuntu-latest
18 | steps:
19 | - name: Checkout
20 | uses: actions/checkout@v2
21 | - uses: actions/setup-java@v1
22 | with:
23 | java-version: 8
24 | - uses: eskatos/gradle-command-action@v1
25 | with:
26 | arguments: clean build -x test
27 |
28 | - name: Get branch name
29 | uses: nelonoel/branch-name@v1.0.1
30 |
31 | - name: Fetch tag
32 | run: |
33 | git fetch --tags --force
34 |
35 | - name: Get git tag
36 | uses: little-core-labs/get-git-tag@v3.0.1
37 | id: tag_data
38 | with:
39 | tagRegex: (.*) # Optional. Returns specified group text as tag name. Full tag string is returned if regex is not defined.
40 | tagRegexGroup: 1 # Optional. Default is 1.
41 |
42 | - name: Set docker tag from tag
43 | id: set_docker_tag
44 | run: |
45 | [[ ${{github.ref}} == */tags/* ]] && DOCKER_TAG="${GIT_TAG_NAME}" || DOCKER_TAG="${BRANCH_NAME}"
46 | DOCKER_TAG="${{ secrets.DOCKER_WEBASEPRO_ORG }}/${DOCKER_REPOSITORY}:${DOCKER_TAG}"
47 |
48 |
49 | echo "New docker tag is ${DOCKER_TAG}"
50 | echo "::set-output name=docker_tag::$(echo ${DOCKER_TAG})"
51 |
52 | - name: Set up QEMU
53 | uses: docker/setup-qemu-action@v1
54 |
55 | - name: Set up Docker Buildx
56 | uses: docker/setup-buildx-action@v1
57 |
58 | - name: Login to DockerHub
59 | uses: docker/login-action@v1
60 | with:
61 | username: ${{ secrets.DOCKER_WEBASEPRO_USERNAME }}
62 | password: ${{ secrets.DOCKER_WEBASEPRO_TOKEN }}
63 |
64 | # - name: Copy nginx config file
65 | # id: copy-nginx-file
66 | # run: |
67 | # cp ./docker/weoracle-web.conf dist/
68 |
69 | - name: Build and push
70 | id: docker_build
71 | uses: docker/build-push-action@v2
72 | with:
73 | context: ./dist
74 | push: true
75 | file: ./docker/build/Dockerfile
76 | platforms: linux/amd64
77 | tags: ${{ steps.set_docker_tag.outputs.docker_tag }}
78 |
79 | - name: Image digest
80 | run: echo ${{ steps.docker_build.outputs.digest }}
81 |
82 | #
83 | # - name: send custom message with args
84 | # uses: appleboy/telegram-action@master
85 | # with:
86 | # to: ${{ secrets.TELEGRAM_TO }}
87 | # token: ${{ secrets.TELEGRAM_TOKEN }}
88 | # args: ${{ steps.set_docker_tag.outputs.docker_tag }} of ${{github.repository }} build success.
89 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Created by .ignore support plugin (hsz.mobi)
2 | ### Java template
3 | *.class
4 |
5 |
6 | # Package Files #
7 | *.war
8 | *.ear
9 |
10 | ### Gradle template
11 | .gradle
12 | /build
13 | gradle.properties
14 |
15 |
16 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
17 | !gradle-wrapper.jar
18 |
19 | # Cache of project
20 | .gradletasknamecache
21 |
22 | # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
23 | # gradle/wrapper/gradle-wrapper.properties
24 |
25 | .idea
26 | *.iml
27 | .settings
28 |
29 | # OS X
30 | .DS_Store
31 |
32 | /target
33 | /out
34 | /log
35 | /dist
36 |
37 | application-test.yml
38 |
39 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | WeBASE-Sign
4 |
5 |
6 |
7 | org.eclipse.jdt.core.javanature
8 | org.eclipse.buildship.core.gradleprojectnature
9 |
10 |
11 |
12 | org.eclipse.jdt.core.javabuilder
13 |
14 |
15 |
16 | org.eclipse.buildship.core.gradleprojectbuilder
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.buildship.core.prefs:
--------------------------------------------------------------------------------
1 | #Tue Jul 09 14:12:44 CST 2019
2 | connection.project.dir=
3 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | #
2 | #Tue Jul 09 14:13:09 CST 2019
3 | org.eclipse.jdt.core.compiler.debug.localVariable=generate
4 | org.eclipse.jdt.core.compiler.compliance=1.8
5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
6 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate
7 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
8 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
9 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate
10 | eclipse.preferences.version=1
11 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
12 | org.eclipse.jdt.core.compiler.source=1.8
13 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
14 |
--------------------------------------------------------------------------------
/Changelog.md:
--------------------------------------------------------------------------------
1 | ### v1.5.5(2023-04-17)
2 |
3 | **Fix**
4 | - 升级依赖包
5 |
6 | **兼容性**
7 | - WeBASE-Front v1.5.0+
8 | - WeBASE-Transaction v1.3.0+
9 |
10 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
11 |
12 |
13 | ### v1.5.3(2021-09-27)
14 |
15 | **Add**
16 | - 新增私钥托管与签名服务Docker镜像,`webasepro/webase-sign:v1.5.3`
17 |
18 | **兼容性**
19 | - WeBASE-Front v1.5.0+
20 | - WeBASE-Transaction v1.3.0+
21 |
22 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
23 |
24 | ### v1.5.0(2021-03-31)
25 |
26 | **Add**
27 | - 增加配置项`supportPrivateKeyTransfer: true`,接口支持私钥传输(aes加密后的私钥),配置项为`false`时不支持
28 |
29 | **Fix**
30 | - jar包升级:mysql-connector-java:8.0.22、bcprov-jdk15on:1.67
31 | - 修复ECDSA签名结果序列化bug
32 |
33 | **兼容性**
34 | - WeBASE-Front v1.5.0+
35 | - WeBASE-Transaction v1.3.0+
36 |
37 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
38 |
39 | ### v1.4.3(2021-01-27)
40 |
41 | **Add**
42 | - 增加数据签名接口
43 |
44 | **Fix**
45 | - 数据库密码支持特殊字符
46 |
47 | **兼容性**
48 | - WeBASE-Front v1.4.0+
49 | - WeBASE-Transaction v1.3.0+
50 |
51 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
52 |
53 |
54 | ### v1.4.2(2020-11-19)
55 |
56 | **Add**
57 | - 适配FISCO BCOS java-sdk
58 |
59 | **兼容性**
60 | - WeBASE-Front v1.4.0+
61 | - WeBASE-Transaction v1.3.0+
62 |
63 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
64 |
65 | ### v1.4.1(2020-09-29)
66 |
67 |
68 | **Fix**
69 | - 更新gradlew版本
70 | - 修复用户KeyStatus状态判断问题
71 | - 修复用户分页的用户总数问题
72 |
73 |
74 | **兼容性**
75 | - WeBASE-Front v1.4.0+
76 | - WeBASE-Transaction v1.3.0+
77 |
78 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
79 |
80 |
81 | ### v1.4.0(2020-08-06)
82 |
83 | **Add**
84 | - 增加返回 Version 版本接口;
85 |
86 | **Fix**
87 | - 默认Aes加密模式由ECB改为更安全的CBC,同时支持在配置选择CBC与ECB
88 |
89 |
90 | **兼容性**
91 | - WeBASE-Front v1.4.0+
92 | - WeBASE-Transaction v1.3.0+
93 |
94 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
95 |
96 |
97 |
98 | ### v1.3.2(2020-06-17)
99 |
100 | **Fix**
101 | - 移除Fastjson,替换为Jackson 2.11.0; web3sdk升级为2.4.1
102 | - 升级依赖包:spring: 4.3.27; log4j: 2.13.3; slf4j: 1.7.30; netty-all: 4.1.44+; guava: 29.0;
103 |
104 | **兼容性**
105 | - WeBASE-Front v1.3.0+
106 | - WeBASE-Transaction v1.3.0+
107 |
108 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
109 |
110 |
111 | ### v1.3.1
112 |
113 | (2020-06-01)
114 |
115 | **Add**
116 | - 新增导入私钥接口
117 |
118 | **Fix**
119 | - 增加私钥签名Credential缓存机制,优化签名性能
120 |
121 | **兼容性**
122 | - WeBASE-Front v1.3.0+
123 | - WeBASE-Transaction v1.3.0+
124 |
125 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
126 |
127 |
128 | ### v1.3.0
129 |
130 | (2020-04-29)
131 |
132 | **Add**
133 | - 同时支持ECDSA与国密私钥与签名与私钥创建(移除yaml配置文件中的`encryptType`),可通过`encryptType`字段指定
134 | - 修改用户entity的`int userId`为`String signUserId`,新增`String appId`
135 | - 调用`/user/newUser`创建私钥时,需要传入`signUserId&appId`作为业务流水号;所有私钥与签名接口通过`signUserId`进行调用
136 | - 新增停用私钥用户接口`DELETE /user/{signUseriId}`
137 | - 新增根据appId获取用户分页列表接口`/user/list/{appId}/{pageNumber}/{pageSize}`
138 |
139 | **Fix**
140 | - 优化签名服务的性能
141 | - 升级fastjson, jackson, log4j
142 |
143 | **兼容性**
144 | - WeBASE-Front v1.3.0+
145 | - WeBASE-Transaction v1.3.0+
146 |
147 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
148 |
149 | ### v1.2.2
150 |
151 | (2020-01-02)
152 |
153 | **Add**
154 |
155 | - 支持国密
156 | - 新增`/encrypt`接口判断是否国密
157 |
158 | **Fix**
159 |
160 | - bugfix:CommonUtils的`SignatureData`序列化支持国密
161 | - bugifx: 修复start.sh启动时间过长的问题
162 | - 优化:web3sdk升级至v2.2.0
163 |
164 | **兼容性**
165 |
166 | - WeBASE-Front v1.2.2
167 | - WeBASE-Transaction v1.2.2
168 |
169 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
170 |
171 |
172 | ### v1.1.0
173 |
174 | (2019-09-12)
175 |
176 | **Add**
177 |
178 | - 查询用户列表
179 |
180 | **Fix**
181 |
182 | - bugfix:签名用户地址不一致
183 | - 优化:通过用户编号查询公私钥信息
184 | - 优化:启停脚本通过程序名和端口校验进程
185 |
186 | **兼容性**
187 |
188 | - WeBASE-Front v1.1.0
189 | - WeBASE-Transaction v1.1.0
190 |
191 | 详细了解,请阅读[**技术文档**](https://webasedoc.readthedocs.io/zh_CN/latest/)。
192 |
193 |
194 |
195 | ### v1.0.0
196 |
197 | (2019-06-27)
198 |
199 | WeBASE-Sign(微众区块链中间件平台-签名子系统),主要提供公私钥管理及数据签名功能。
200 |
201 | **Add**
202 |
203 | - 适配FISCO-BCOS 2.0.0版本
204 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "[]"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright [yyyy] [name of copyright owner]
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # 签名服务
2 | [](https://webasedoc.readthedocs.io/zh_CN/latest/docs/WeBASE/CONTRIBUTING.html)
3 | [](https://www.codefactor.io/repository/github/webankblockchain/webase-sign)
4 | [](https://github.com/WeBankBlockchain/WeBASE-Sign)
5 | [](http://www.apache.org/licenses/)
6 | [](https://github.com/WeBankBlockchain/WeBASE-Sign/releases)
7 |
8 | ## 简介
9 | 本工程为签名服务子系统。功能:管理公私钥、对数据进行签名。 详细介绍请查看[WeBASE-Sign在线文档](https://webasedoc.readthedocs.io/zh_CN/latest/docs/WeBASE-Sign/index.html)
10 |
11 | ## 贡献说明
12 | 请阅读我们的贡献文档,了解如何贡献代码,并提交你的贡献。
13 |
14 | 希望在您的参与下,WeBASE会越来越好!
15 |
16 | ## 社区
17 | 联系我们:webase@webank.com
18 |
--------------------------------------------------------------------------------
/bin/.gitignore:
--------------------------------------------------------------------------------
1 | /main/
2 |
--------------------------------------------------------------------------------
/build.gradle:
--------------------------------------------------------------------------------
1 | version '1.0'
2 |
3 | println "======Gradle version:" + gradle.gradleVersion
4 | if (gradle.gradleVersion.startsWith("7")) {
5 | println "Gradle 7.x not support yet!\n ====== please use Gradle version from 4.6.x to 6.9.x "
6 | } else if (gradle.gradleVersion.startsWith("6")
7 | || gradle.gradleVersion.startsWith("5")
8 | || gradle.gradleVersion.startsWith("4.10")
9 | || gradle.gradleVersion.startsWith("4.9")
10 | || gradle.gradleVersion.startsWith("4.8")
11 | || gradle.gradleVersion.startsWith("4.7")
12 | ) {
13 | println "Gradle with version >= 4.6 detected"
14 | } else {
15 | println "Gradle with version < 4.6 detected"
16 | }
17 |
18 |
19 | apply plugin: 'maven'
20 | apply plugin: 'java'
21 | apply plugin: 'idea'
22 | apply plugin: 'eclipse'
23 |
24 | sourceCompatibility = 1.8
25 | targetCompatibility = 1.8
26 |
27 | [compileJava, compileTestJava, javadoc]*.options*.encoding = 'UTF-8'
28 |
29 | // In this section you declare where to find the dependencies of your project
30 | repositories {
31 | maven { url "http://maven.aliyun.com/nexus/content/groups/public/"}
32 | maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
33 |
34 | maven { url 'https://dl.bintray.com/ethereum/maven/'}
35 | mavenLocal()
36 | mavenCentral()
37 | }
38 |
39 | def spring_boot_version="2.7.10"
40 | List springboot =[
41 | "org.springframework.boot:spring-boot-starter-web:$spring_boot_version",
42 | "org.springframework.boot:spring-boot-autoconfigure:$spring_boot_version",
43 | "org.springframework.boot:spring-boot-configuration-processor:$spring_boot_version",
44 | "org.springframework.boot:spring-boot-starter-aop:$spring_boot_version",
45 | "org.springframework.boot:spring-boot-starter-cache:$spring_boot_version",
46 | "org.springframework.boot:spring-boot-starter-validation:$spring_boot_version"
47 | ]
48 |
49 | List swagger = [
50 | 'io.springfox:springfox-swagger2:2.8.0',
51 | 'io.springfox:springfox-swagger-ui:2.8.0'
52 | ]
53 |
54 | List mysql = [
55 | 'mysql:mysql-connector-java:8.0.22',
56 | 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
57 | ]
58 |
59 | def log4j_version="2.18.0"
60 | List log4j = [
61 | "org.apache.logging.log4j:log4j-api:$log4j_version",
62 | "org.apache.logging.log4j:log4j-core:$log4j_version",
63 | "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version",
64 | "org.apache.logging.log4j:log4j-web:$log4j_version"
65 | ]
66 |
67 | List jaxb = [
68 | "javax.xml.bind:jaxb-api:2.3.0",
69 | "com.sun.xml.bind:jaxb-impl:2.3.0",
70 | "com.sun.xml.bind:jaxb-core:2.3.0",
71 | "javax.activation:activation:1.1.1"
72 | ]
73 |
74 | def jackson_version = "2.14.2"
75 | List jackson = [
76 | "com.fasterxml.jackson.core:jackson-databind:$jackson_version",
77 | "com.fasterxml.jackson.core:jackson-annotations:$jackson_version",
78 | "com.fasterxml.jackson.core:jackson-core:$jackson_version",
79 | "com.fasterxml.jackson.module:jackson-module-parameter-names:$jackson_version",
80 | "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:$jackson_version",
81 | "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:$jackson_version",
82 | ]
83 |
84 | dependencies {
85 | compile springboot,swagger,mysql,log4j,jaxb,jackson
86 | compile ('org.fisco-bcos.java-sdk:fisco-bcos-java-sdk:2.9.2') {
87 | // 不需要连接节点,因此去除
88 | exclude group: "org.fisco-bcos", module: 'netty-sm-ssl-context'
89 | }
90 | compile 'org.slf4j:jcl-over-slf4j:1.7.30'
91 | compile 'org.apache.commons:commons-lang3:3.6'
92 | compile "org.bouncycastle:bcprov-jdk15on:1.69"
93 | compile 'org.yaml:snakeyaml:2.0'
94 |
95 | compile 'org.projectlombok:lombok:1.18.6'
96 | annotationProcessor 'org.projectlombok:lombok:1.18.6'
97 | }
98 |
99 | configurations {
100 | all*.exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
101 | all*.exclude group: 'org.slf4j', module: 'slf4j-log4j12'
102 | all*.exclude group: 'log4j', module: 'log4j'
103 | all*.exclude group: 'com.mchange', module: '*'
104 | }
105 |
106 | sourceSets {
107 | main {
108 | java {
109 | srcDir 'src/main/java'
110 | }
111 | resources {
112 | srcDir 'src/main/resources'
113 | }
114 | }
115 | }
116 |
117 | clean {
118 | delete 'dist'
119 | delete 'build'
120 | delete 'log'
121 | }
122 |
123 | jar {
124 | destinationDir file('dist/apps')
125 | archiveName project.name + '.jar'
126 | exclude '**/*.xml'
127 | exclude '**/*.properties'
128 |
129 | doLast {
130 | copy {
131 | from file('src/main/resources/')
132 | into 'dist/conf_template'
133 | }
134 | copy {
135 | from configurations.runtime
136 | into 'dist/lib'
137 | }
138 | copy {
139 | from file('.').listFiles().findAll{File f -> (f.name.endsWith('.sh') || f.name.endsWith('.env'))}
140 | into 'dist'
141 | }
142 | copy {
143 | from file('release_note.txt')
144 | into 'dist'
145 | }
146 | }
147 | }
148 |
--------------------------------------------------------------------------------
/docker/build/Dockerfile:
--------------------------------------------------------------------------------
1 | #FROM openjdk:8-jdk-alpine as prod
2 | FROM ubuntu:18.04 as prod
3 |
4 | #RUN apk --no-cache add bash curl wget
5 | RUN apt-get update \
6 | && apt-get -y install openjdk-8-jre \
7 | && apt-get -y install mysql-client \
8 | && rm -rf /var/lib/apt/lists/*
9 |
10 | COPY lib /dist/lib
11 | COPY conf_template /dist/conf
12 | COPY apps /dist/apps
13 |
14 | WORKDIR /dist
15 | EXPOSE 5004
16 |
17 | ENV CLASSPATH "/dist/conf/:/dist/apps/*:/dist/lib/*"
18 |
19 | ENV JAVA_OPTS " -server -Dfile.encoding=UTF-8 -Xmx512m -Xms512m -Xmn256m -Xss512k -XX:MetaspaceSize=256m -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/log/heap_error.log -XX:+UseG1GC -XX:MaxGCPauseMillis=200 "
20 | ENV APP_MAIN "com.webank.webase.sign.Application"
21 |
22 | # start commond
23 | ENTRYPOINT java ${JAVA_OPTS} -Djdk.tls.namedGroups="secp256k1", -Duser.timezone="Asia/Shanghai" -Djava.security.egd=file:/dev/./urandom, -Djava.library.path=/dist/conf -cp ${CLASSPATH} ${APP_MAIN}
24 |
--------------------------------------------------------------------------------
/docker/build/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 |
3 | LOG_WARN() {
4 | local content=${1}
5 | echo -e "\033[31m[WARN] ${content}\033[0m"
6 | }
7 |
8 | LOG_INFO() {
9 | local content=${1}
10 | echo -e "\033[32m[INFO] ${content}\033[0m"
11 | }
12 |
13 | # 命令返回非 0 时,就退出
14 | set -o errexit
15 | # 管道命令中任何一个失败,就退出
16 | set -o pipefail
17 | # 遇到不存在的变量就会报错,并停止执行
18 | set -o nounset
19 | # 在执行每一个命令之前把经过变量展开之后的命令打印出来,调试时很有用
20 | #set -o xtrace
21 |
22 | # 退出时,执行的命令,做一些收尾工作
23 | trap 'echo -e "Aborted, error $? in command: $BASH_COMMAND"; trap ERR; exit 1' ERR
24 |
25 | # Set magic variables for current file & dir
26 | # 脚本所在的目录
27 | __dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
28 | # 脚本的全路径,包含脚本文件名
29 | __file="${__dir}/$(basename "${BASH_SOURCE[0]}")"
30 | # 脚本的名称,不包含扩展名
31 | __base="$(basename ${__file} .sh)"
32 | # 脚本所在的目录的父目录,一般脚本都会在父项目中的子目录,
33 | # 比如: bin, script 等,需要根据场景修改
34 | __root="$(cd "$(dirname "${__dir}")" && pwd)"/../ # <-- change this as it depends on your app
35 | __root=$(realpath -s "${__root}")
36 |
37 |
38 | ########################### properties config ##########################
39 | image_organization=webasepro
40 | image_name="webase-sign"
41 | docker_push="no"
42 | latest_tag=latest
43 | new_tag=
44 |
45 |
46 | ########################### parse param ##########################
47 | __cmd="$(basename $0)"
48 | # 解析参数
49 | # usage help doc.
50 | usage() {
51 | cat << USAGE >&2
52 | Usage:
53 | ${__cmd} [-h] [-t new_tag] [-p] [-i fiscoorg]
54 | -t New tag for image, required.
55 |
56 | -p Push image to docker hub, default no.
57 | -i Default organization, default webasepro.
58 | -h Show help info.
59 | USAGE
60 | exit 1
61 | }
62 | while getopts t:i:ph OPT;do
63 | case $OPT in
64 | t)
65 | new_tag=$OPTARG
66 | ;;
67 | p)
68 | docker_push=yes
69 | ;;
70 | i)
71 | image_organization=${OPTARG}
72 | ;;
73 | h)
74 | usage
75 | exit 3
76 | ;;
77 | \?)
78 | usage
79 | exit 4
80 | ;;
81 | esac
82 | done
83 |
84 |
85 | # 必须设置新镜像的版本
86 | if [[ "${new_tag}"x == "x" ]] ; then
87 | LOG_WARN "Need a new_tag for new docker image!! "
88 | usage
89 | exit 1
90 | fi
91 |
92 | ########################### build docker image ##########################
93 | image_repository="${image_organization}/${image_name}"
94 |
95 | ## compile project
96 | cd "${__root}" && chmod +x ./gradlew && ./gradlew clean build -x test
97 |
98 | ## docker build
99 | cd "${__root}"/dist
100 |
101 | docker build -t ${image_repository}:${new_tag} -f "${__root}"/docker/build/Dockerfile .
102 | docker tag "${image_repository}:${new_tag}" "${image_repository}:${latest_tag}"
103 |
104 |
105 | ########################### push docker image ##########################
106 | if [[ "${docker_push}"x == "yesx" ]] ; then
107 | docker push "${image_repository}:${new_tag}"
108 | docker push "${image_repository}:${latest_tag}"
109 | fi
110 |
111 |
112 |
113 |
114 |
115 |
116 |
117 |
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/WeBankBlockchain/WeBASE-Sign/e98ab0cced21391fc2951e97e19fb84a701a7f98/gradle/wrapper/gradle-wrapper.jar
--------------------------------------------------------------------------------
/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 |
--------------------------------------------------------------------------------
/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | #
4 | # Copyright 2015 the original author or authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 |
19 | ##############################################################################
20 | ##
21 | ## Gradle start up script for UN*X
22 | ##
23 | ##############################################################################
24 |
25 | # Attempt to set APP_HOME
26 | # Resolve links: $0 may be a link
27 | PRG="$0"
28 | # Need this for relative symlinks.
29 | while [ -h "$PRG" ] ; do
30 | ls=`ls -ld "$PRG"`
31 | link=`expr "$ls" : '.*-> \(.*\)$'`
32 | if expr "$link" : '/.*' > /dev/null; then
33 | PRG="$link"
34 | else
35 | PRG=`dirname "$PRG"`"/$link"
36 | fi
37 | done
38 | SAVED="`pwd`"
39 | cd "`dirname \"$PRG\"`/" >/dev/null
40 | APP_HOME="`pwd -P`"
41 | cd "$SAVED" >/dev/null
42 |
43 | APP_NAME="Gradle"
44 | APP_BASE_NAME=`basename "$0"`
45 |
46 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
47 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
48 |
49 | # Use the maximum available, or set MAX_FD != -1 to use that value.
50 | MAX_FD="maximum"
51 |
52 | warn () {
53 | echo "$*"
54 | }
55 |
56 | die () {
57 | echo
58 | echo "$*"
59 | echo
60 | exit 1
61 | }
62 |
63 | # OS specific support (must be 'true' or 'false').
64 | cygwin=false
65 | msys=false
66 | darwin=false
67 | nonstop=false
68 | case "`uname`" in
69 | CYGWIN* )
70 | cygwin=true
71 | ;;
72 | Darwin* )
73 | darwin=true
74 | ;;
75 | MINGW* )
76 | msys=true
77 | ;;
78 | NONSTOP* )
79 | nonstop=true
80 | ;;
81 | esac
82 |
83 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
84 |
85 |
86 | # Determine the Java command to use to start the JVM.
87 | if [ -n "$JAVA_HOME" ] ; then
88 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
89 | # IBM's JDK on AIX uses strange locations for the executables
90 | JAVACMD="$JAVA_HOME/jre/sh/java"
91 | else
92 | JAVACMD="$JAVA_HOME/bin/java"
93 | fi
94 | if [ ! -x "$JAVACMD" ] ; then
95 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
96 |
97 | Please set the JAVA_HOME variable in your environment to match the
98 | location of your Java installation."
99 | fi
100 | else
101 | JAVACMD="java"
102 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
103 |
104 | Please set the JAVA_HOME variable in your environment to match the
105 | location of your Java installation."
106 | fi
107 |
108 | # Increase the maximum file descriptors if we can.
109 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
110 | MAX_FD_LIMIT=`ulimit -H -n`
111 | if [ $? -eq 0 ] ; then
112 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
113 | MAX_FD="$MAX_FD_LIMIT"
114 | fi
115 | ulimit -n $MAX_FD
116 | if [ $? -ne 0 ] ; then
117 | warn "Could not set maximum file descriptor limit: $MAX_FD"
118 | fi
119 | else
120 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
121 | fi
122 | fi
123 |
124 | # For Darwin, add options to specify how the application appears in the dock
125 | if $darwin; then
126 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
127 | fi
128 |
129 | # For Cygwin or MSYS, switch paths to Windows format before running java
130 | if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
131 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
132 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
133 |
134 | JAVACMD=`cygpath --unix "$JAVACMD"`
135 |
136 | # We build the pattern for arguments to be converted via cygpath
137 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
138 | SEP=""
139 | for dir in $ROOTDIRSRAW ; do
140 | ROOTDIRS="$ROOTDIRS$SEP$dir"
141 | SEP="|"
142 | done
143 | OURCYGPATTERN="(^($ROOTDIRS))"
144 | # Add a user-defined pattern to the cygpath arguments
145 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
146 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
147 | fi
148 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
149 | i=0
150 | for arg in "$@" ; do
151 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
152 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
153 |
154 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
155 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
156 | else
157 | eval `echo args$i`="\"$arg\""
158 | fi
159 | i=`expr $i + 1`
160 | done
161 | case $i in
162 | 0) set -- ;;
163 | 1) set -- "$args0" ;;
164 | 2) set -- "$args0" "$args1" ;;
165 | 3) set -- "$args0" "$args1" "$args2" ;;
166 | 4) set -- "$args0" "$args1" "$args2" "$args3" ;;
167 | 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
168 | 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
169 | 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
170 | 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
171 | 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
172 | esac
173 | fi
174 |
175 | # Escape application args
176 | save () {
177 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
178 | echo " "
179 | }
180 | APP_ARGS=`save "$@"`
181 |
182 | # Collect all arguments for the java command, following the shell quoting and substitution rules
183 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
184 |
185 | exec "$JAVACMD" "$@"
186 |
--------------------------------------------------------------------------------
/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 |
17 | @if "%DEBUG%" == "" @echo off
18 | @rem ##########################################################################
19 | @rem
20 | @rem Gradle startup script for Windows
21 | @rem
22 | @rem ##########################################################################
23 |
24 | @rem Set local scope for the variables with windows NT shell
25 | if "%OS%"=="Windows_NT" setlocal
26 |
27 | set DIRNAME=%~dp0
28 | if "%DIRNAME%" == "" set DIRNAME=.
29 | set APP_BASE_NAME=%~n0
30 | set APP_HOME=%DIRNAME%
31 |
32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
34 |
35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
37 |
38 | @rem Find java.exe
39 | if defined JAVA_HOME goto findJavaFromJavaHome
40 |
41 | set JAVA_EXE=java.exe
42 | %JAVA_EXE% -version >NUL 2>&1
43 | if "%ERRORLEVEL%" == "0" goto execute
44 |
45 | echo.
46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
47 | echo.
48 | echo Please set the JAVA_HOME variable in your environment to match the
49 | echo location of your Java installation.
50 |
51 | goto fail
52 |
53 | :findJavaFromJavaHome
54 | set JAVA_HOME=%JAVA_HOME:"=%
55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
56 |
57 | if exist "%JAVA_EXE%" goto execute
58 |
59 | echo.
60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
61 | echo.
62 | echo Please set the JAVA_HOME variable in your environment to match the
63 | echo location of your Java installation.
64 |
65 | goto fail
66 |
67 | :execute
68 | @rem Setup the command line
69 |
70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
71 |
72 |
73 | @rem Execute Gradle
74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
75 |
76 | :end
77 | @rem End local scope for the variables with windows NT shell
78 | if "%ERRORLEVEL%"=="0" goto mainEnd
79 |
80 | :fail
81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
82 | rem the _cmd.exe /c_ return code!
83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84 | exit /b 1
85 |
86 | :mainEnd
87 | if "%OS%"=="Windows_NT" endlocal
88 |
89 | :omega
90 |
--------------------------------------------------------------------------------
/release_note.txt:
--------------------------------------------------------------------------------
1 | v1.5.5
2 |
--------------------------------------------------------------------------------
/sider.yml:
--------------------------------------------------------------------------------
1 | linter:
2 | pmd_java:
3 | dir: src
4 | encoding: Shift_JIS
5 | min_priority: 2
6 | checkstyle:
7 | dir: src
8 | ignore:
9 | - warning
10 | - info
11 |
--------------------------------------------------------------------------------
/src/main/java/com/webank/webase/sign/Application.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2021 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.webank.webase.sign;
17 |
18 | import lombok.extern.slf4j.Slf4j;
19 | import org.mybatis.spring.annotation.MapperScan;
20 | import org.springframework.boot.SpringApplication;
21 | import org.springframework.boot.autoconfigure.SpringBootApplication;
22 | import org.springframework.cache.annotation.EnableCaching;
23 | import org.springframework.scheduling.annotation.EnableScheduling;
24 | import springfox.documentation.swagger2.annotations.EnableSwagger2;
25 |
26 | /**
27 | * Startup class.
28 | */
29 | @Slf4j
30 | @EnableSwagger2
31 | @EnableCaching
32 | @EnableScheduling
33 | @SpringBootApplication
34 | @MapperScan("com.webank.webase.sign")
35 | public class Application {
36 |
37 | public static void main(String[] args) {
38 | SpringApplication.run(Application.class, args);
39 | log.info("main run success...");
40 | }
41 | }
--------------------------------------------------------------------------------
/src/main/java/com/webank/webase/sign/api/controller/SignController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Copyright 2014-2021 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License");
5 | * you may not use this file except in compliance with the License.
6 | * You may obtain a copy of the License at
7 | *
8 | * http://www.apache.org/licenses/LICENSE-2.0
9 | *
10 | * Unless required by applicable law or agreed to in writing, software
11 | * distributed under the License is distributed on an "AS IS" BASIS,
12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | * See the License for the specific language governing permissions and
14 | * limitations under the License.
15 | */
16 | package com.webank.webase.sign.api.controller;
17 |
18 | import com.webank.webase.sign.api.service.SignService;
19 | import com.webank.webase.sign.api.service.UserService;
20 | import com.webank.webase.sign.exception.BaseException;
21 | import com.webank.webase.sign.pojo.vo.BaseRspVo;
22 | import com.webank.webase.sign.pojo.vo.ReqEncodeInfoVo;
23 | import com.webank.webase.sign.pojo.vo.ReqSignMessageHashVo;
24 | import com.webank.webase.sign.pojo.vo.RspSignVo;
25 | import com.webank.webase.sign.util.CommonUtils;
26 | import io.swagger.annotations.Api;
27 | import io.swagger.annotations.ApiImplicitParam;
28 | import io.swagger.annotations.ApiOperation;
29 | import org.springframework.beans.factory.annotation.Autowired;
30 | import org.springframework.validation.BindingResult;
31 | import org.springframework.web.bind.annotation.PostMapping;
32 | import org.springframework.web.bind.annotation.RequestBody;
33 | import org.springframework.web.bind.annotation.RequestMapping;
34 | import org.springframework.web.bind.annotation.RestController;
35 |
36 | import javax.validation.Valid;
37 |
38 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_SIGN_USER_ID_IS_INVALID;
39 |
40 |
41 | /**
42 | * Controller.
43 | */
44 | @Api(value = "sign", tags = "sign interface")
45 | @RestController
46 | @RequestMapping("sign")
47 | public class SignController {
48 |
49 | @Autowired
50 | SignService signService;
51 | @Autowired
52 | UserService userService;
53 |
54 | /**
55 | * add sign by ecdsa or guomi encryption
56 | *
57 | * @param req parameter
58 | * @param result checkResult
59 | */
60 | @ApiOperation(value = "add sign by ecdsa(default) or guomi",
61 | notes = "获取ECDSA或国密SM2签名数据,默认ECDSA")
62 | @ApiImplicitParam(name = "req", value = "encode info", required = true,
63 | dataType = "ReqEncodeInfoVo")
64 | @PostMapping("")
65 | public BaseRspVo signStandard(@Valid @RequestBody ReqEncodeInfoVo req, BindingResult result)
66 | throws BaseException {
67 | CommonUtils.checkParamBindResult(result);
68 | String signUserId = req.getSignUserId();
69 | if (!CommonUtils.checkLengthWithin_64(signUserId)) {
70 | throw new BaseException(PARAM_SIGN_USER_ID_IS_INVALID);
71 | }
72 | String signResult = signService.sign(req);
73 | // return
74 | RspSignVo rspSignVo = new RspSignVo();
75 | rspSignVo.setSignDataStr(signResult);
76 | return CommonUtils.buildSuccessRspVo(rspSignVo);
77 | }
78 | }
79 |
--------------------------------------------------------------------------------
/src/main/java/com/webank/webase/sign/api/controller/UserController.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014-2021 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *
7 | * http://www.apache.org/licenses/LICENSE-2.0
8 | *
9 | * Unless required by applicable law or agreed to in writing, software distributed under the License
10 | * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
11 | * or implied. See the License for the specific language governing permissions and limitations under
12 | * the License.
13 | */
14 | package com.webank.webase.sign.api.controller;
15 |
16 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_APP_ID_IS_BLANK;
17 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_APP_ID_IS_INVALID;
18 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_ENCRYPT_TYPE_IS_INVALID;
19 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_SIGN_USER_ID_IS_BLANK;
20 | import static com.webank.webase.sign.enums.CodeMessageEnums.PARAM_SIGN_USER_ID_IS_INVALID;
21 | import static com.webank.webase.sign.enums.CodeMessageEnums.PRIVATEKEY_NOT_SUPPORT_TRANSFER;
22 | import com.webank.webase.sign.api.service.UserService;
23 | import com.webank.webase.sign.constant.ConstantProperties;
24 | import com.webank.webase.sign.enums.EncryptTypes;
25 | import com.webank.webase.sign.exception.BaseException;
26 | import com.webank.webase.sign.pojo.bo.UserParam;
27 | import com.webank.webase.sign.pojo.po.UserInfoPo;
28 | import com.webank.webase.sign.pojo.vo.BaseRspVo;
29 | import com.webank.webase.sign.pojo.vo.ReqNewUserVo;
30 | import com.webank.webase.sign.pojo.vo.ReqUserInfoVo;
31 | import com.webank.webase.sign.pojo.vo.RspUserInfoVo;
32 | import com.webank.webase.sign.util.AesUtils;
33 | import com.webank.webase.sign.util.CommonUtils;
34 | import io.swagger.annotations.Api;
35 | import io.swagger.annotations.ApiImplicitParam;
36 | import io.swagger.annotations.ApiImplicitParams;
37 | import io.swagger.annotations.ApiOperation;
38 | import java.util.ArrayList;
39 | import java.util.List;
40 | import java.util.Optional;
41 | import javax.validation.Valid;
42 | import lombok.extern.slf4j.Slf4j;
43 | import org.apache.commons.lang3.StringUtils;
44 | import org.springframework.beans.BeanUtils;
45 | import org.springframework.beans.factory.annotation.Autowired;
46 | import org.springframework.validation.BindingResult;
47 | import org.springframework.web.bind.annotation.DeleteMapping;
48 | import org.springframework.web.bind.annotation.GetMapping;
49 | import org.springframework.web.bind.annotation.PathVariable;
50 | import org.springframework.web.bind.annotation.PostMapping;
51 | import org.springframework.web.bind.annotation.RequestBody;
52 | import org.springframework.web.bind.annotation.RequestMapping;
53 | import org.springframework.web.bind.annotation.RequestParam;
54 | import org.springframework.web.bind.annotation.RestController;
55 |
56 | /**
57 | * Controller.
58 | */
59 | @Slf4j
60 | @Api(value = "user", tags = "user interface")
61 | @RestController
62 | @RequestMapping("user")
63 | public class UserController {
64 |
65 | @Autowired
66 | private UserService userService;
67 | @Autowired
68 | private AesUtils aesUtils;
69 | @Autowired
70 | ConstantProperties properties;
71 |
72 | /**
73 | * new user from ecdsa or guomi
74 | */
75 | @ApiOperation(value = "new user from ecdsa/guomi, default ecdsa",
76 | notes = "新建公私钥用户(ecdsa或国密),默认ecdas")
77 | @GetMapping("/newUser")
78 | public BaseRspVo newUser(@RequestParam String signUserId, @RequestParam String appId,
79 | @RequestParam(required = false, defaultValue = "0") Integer encryptType,
80 | @RequestParam(required = false, defaultValue = "false") boolean returnPrivateKey)
81 | throws BaseException {
82 | // validate signUserId
83 | if (StringUtils.isBlank(signUserId)) {
84 | throw new BaseException(PARAM_SIGN_USER_ID_IS_BLANK);
85 | }
86 | if (!CommonUtils.isLetterDigit(signUserId)
87 | || !CommonUtils.checkLengthWithin_64(signUserId)) {
88 | throw new BaseException(PARAM_SIGN_USER_ID_IS_INVALID);
89 | }
90 | if (StringUtils.isBlank(appId)) {
91 | throw new BaseException(PARAM_APP_ID_IS_BLANK);
92 | }
93 | if (!CommonUtils.isLetterDigit(appId) || !CommonUtils.checkLengthWithin_64(appId)) {
94 | throw new BaseException(PARAM_APP_ID_IS_INVALID);
95 | }
96 | if (encryptType != EncryptTypes.STANDARD.getValue()
97 | && encryptType != EncryptTypes.GUOMI.getValue()) {
98 | throw new BaseException(PARAM_ENCRYPT_TYPE_IS_INVALID);
99 | }
100 | if (returnPrivateKey == true && !properties.isSupportPrivateKeyTransfer()) {
101 | throw new BaseException(PRIVATEKEY_NOT_SUPPORT_TRANSFER);
102 | }
103 | // new user
104 | RspUserInfoVo userInfo = userService.newUser(signUserId, appId, encryptType, null);
105 | if (returnPrivateKey == false) {
106 | userInfo.setPrivateKey("");
107 | }
108 | return CommonUtils.buildSuccessRspVo(userInfo);
109 | }
110 |
111 | @ApiOperation(value = "import new user by private key", notes = "导入私钥用户(ecdsa或国密),默认ecdas")
112 | @ApiImplicitParam(name = "reqNewUser", value = "private key info", required = true,
113 | dataType = "ReqNewUserVo")
114 | @PostMapping("/newUser")
115 | public BaseRspVo newUserByImportPrivateKey(@Valid @RequestBody ReqNewUserVo reqNewUser,
116 | BindingResult result) throws BaseException {
117 | CommonUtils.checkParamBindResult(result);
118 | // validate signUserId
119 | String signUserId = reqNewUser.getSignUserId();
120 | String appId = reqNewUser.getAppId();
121 | Integer encryptType = reqNewUser.getEncryptType();
122 | String privateKeyEncoded = reqNewUser.getPrivateKey();
123 | if (StringUtils.isBlank(signUserId)) {
124 | throw new BaseException(PARAM_SIGN_USER_ID_IS_BLANK);
125 | }
126 | if (!CommonUtils.isLetterDigit(signUserId)
127 | || !CommonUtils.checkLengthWithin_64(signUserId)) {
128 | throw new BaseException(PARAM_SIGN_USER_ID_IS_INVALID);
129 | }
130 | if (StringUtils.isBlank(appId)) {
131 | throw new BaseException(PARAM_APP_ID_IS_BLANK);
132 | }
133 | if (!CommonUtils.isLetterDigit(appId) || !CommonUtils.checkLengthWithin_64(appId)) {
134 | throw new BaseException(PARAM_APP_ID_IS_INVALID);
135 | }
136 | if (encryptType != EncryptTypes.STANDARD.getValue()
137 | && encryptType != EncryptTypes.GUOMI.getValue()) {
138 | throw new BaseException(PARAM_ENCRYPT_TYPE_IS_INVALID);
139 | }
140 | // new user
141 | RspUserInfoVo userInfo =
142 | userService.newUser(signUserId, appId, encryptType, privateKeyEncoded);
143 | userInfo.setPrivateKey("");
144 | return CommonUtils.buildSuccessRspVo(userInfo);
145 | }
146 |
147 | /**
148 | * get user.
149 | */
150 | @ApiOperation(value = "check user info exist", notes = "check user info exist")
151 | @ApiImplicitParams({@ApiImplicitParam(name = "signUserId",
152 | value = "business id of user in system", required = true, dataType = "String"),})
153 | @GetMapping("/{signUserId}/userInfo")
154 | public BaseRspVo getUserInfo(@PathVariable("signUserId") String signUserId,
155 | @RequestParam(required = false, defaultValue = "false") boolean returnPrivateKey)
156 | throws BaseException {
157 | if (!CommonUtils.checkLengthWithin_64(signUserId)) {
158 | throw new BaseException(PARAM_SIGN_USER_ID_IS_INVALID);
159 | }
160 | if (returnPrivateKey == true && !properties.isSupportPrivateKeyTransfer()) {
161 | throw new BaseException(PRIVATEKEY_NOT_SUPPORT_TRANSFER);
162 | }
163 | // find user
164 | UserInfoPo userInfo = userService.findBySignUserId(signUserId);
165 | RspUserInfoVo rspUserInfoVo = new RspUserInfoVo();
166 | Optional.ofNullable(userInfo).ifPresent(u -> BeanUtils.copyProperties(u, rspUserInfoVo));
167 | if (returnPrivateKey == false) {
168 | rspUserInfoVo.setPrivateKey("");
169 | } else {
170 | rspUserInfoVo.setPrivateKey(aesUtils.aesEncrypt(userInfo.getPrivateKey()));
171 | }
172 | return CommonUtils.buildSuccessRspVo(rspUserInfoVo);
173 | }
174 |
175 | /**
176 | * get user list by app id
177 | */
178 | @ApiOperation(value = "get user list by app id", notes = "根据appId获取user列表")
179 | @ApiImplicitParams({@ApiImplicitParam(name = "appId", value = "app id that users belong to",
180 | required = true, dataType = "String"),})
181 | @GetMapping("/list/{appId}/{pageNumber}/{pageSize}")
182 | public BaseRspVo getUserListByAppId(@PathVariable("appId") String appId,
183 | @PathVariable("pageNumber") Integer pageNumber,
184 | @PathVariable("pageSize") Integer pageSize,
185 | @RequestParam(required = false, defaultValue = "false") boolean returnPrivateKey)
186 | throws BaseException {
187 | if (!CommonUtils.checkLengthWithin_64(appId)) {
188 | throw new BaseException(PARAM_APP_ID_IS_INVALID);
189 | }
190 | if (returnPrivateKey == true && !properties.isSupportPrivateKeyTransfer()) {
191 | throw new BaseException(PRIVATEKEY_NOT_SUPPORT_TRANSFER);
192 | }
193 | UserParam param = new UserParam();
194 | param.setAppId(appId);
195 | int count = userService.countOfUser(param);
196 | List userList = new ArrayList<>();
197 | if (count > 0) {
198 | Integer start =
199 | Optional.ofNullable(pageNumber).map(page -> (page - 1) * pageSize).orElse(null);
200 | param.setStart(start);
201 | param.setPageSize(pageSize);
202 | // find user
203 | userList = userService.findUserListByAppId(param);
204 | if (!userList.isEmpty() && returnPrivateKey == false) {
205 | userList.forEach(user -> user.setPrivateKey(""));
206 | }
207 | }
208 | return CommonUtils.buildSuccessPageRspVo(userList, count);
209 | }
210 |
211 | @ApiOperation(value = "delete user by address", notes = "通过地址删除私钥")
212 | @DeleteMapping("")
213 | public BaseRspVo deleteUser(@RequestBody ReqUserInfoVo req) throws BaseException {
214 | String signUserId = req.getSignUserId();
215 | if (!CommonUtils.checkLengthWithin_64(signUserId)) {
216 | throw new BaseException(PARAM_SIGN_USER_ID_IS_INVALID);
217 | }
218 | // set as 0: SUSPENDED
219 | userService.deleteBySignUserId(signUserId);
220 | return CommonUtils.buildSuccessRspVo(null);
221 | }
222 |
223 |
224 | @ApiOperation(value = "delete all user cache", notes = "删除所有用户缓存信息")
225 | @DeleteMapping("/all")
226 | public BaseRspVo deleteAllUserCache() {
227 |
228 | userService.deleteAllUserCache();
229 | return CommonUtils.buildSuccessRspVo(null);
230 | }
231 |
232 | @ApiOperation(value = "delete all Credential cache", notes = "删除所有私钥缓存信息")
233 | @DeleteMapping("/all-credential")
234 | public BaseRspVo deleteCredentialCache() {
235 |
236 | userService.deleteAllCredentialCache();
237 | return CommonUtils.buildSuccessRspVo(null);
238 | }
239 |
240 | }
241 |
--------------------------------------------------------------------------------
/src/main/java/com/webank/webase/sign/api/controller/VersionController.java:
--------------------------------------------------------------------------------
1 | /**
2 | * Copyright 2014-2021 the original author or authors.
3 | *
4 | * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
5 | * in compliance with the License. You may obtain a copy of the License at
6 | *