Skip to content

Commit a0d9549

Browse files
authored
Tsapp v1 (#8)
支持TLCP客户端
1 parent ff316aa commit a0d9549

15 files changed

+558
-16
lines changed

README.md

+20
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
11
# tsapp
22
基于铜锁密码库开发的商用密码工具箱桌面应用程序
3+
4+
# 功能与特性
5+
6+
> 多数功能都支持用户自输入密钥
7+
8+
- 随机数生成
9+
- SM2密钥对生成
10+
- SM2加解密
11+
- SM2签名与验签
12+
- SM3摘要
13+
- SM4加解密
14+
- 签发SM2证书
15+
- TLCP客户端
16+
17+
# 配置与安装
18+
19+
可以直接安装使用该应用程序,或使用源码在本地使用QT启动。
20+
21+
22+

TongsuoToolbox_v01.pro

+12-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
QT += core gui
22

3+
QT += network
4+
35
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
46

57
CONFIG += c++17
@@ -19,6 +21,7 @@ SOURCES += \
1921
sm2signverify.cpp \
2022
sm3hash.cpp \
2123
sm4encrypt.cpp \
24+
tlcpclient.cpp \
2225
tserror.cpp
2326

2427
HEADERS += \
@@ -31,6 +34,7 @@ HEADERS += \
3134
sm2signverify.h \
3235
sm3hash.h \
3336
sm4encrypt.h \
37+
tlcpclient.h \
3438
tserror.h
3539

3640
# Default rules for deployment.
@@ -40,6 +44,9 @@ target.path = $$(PREFIX)
4044
win32: LIBS += -ladvapi32 -lcrypt32 -lgdi32 -luser32 -lws2_32 -L$$(TONGSUO_HOME)/lib -llibcrypto
4145
else:unix: LIBS += -L$$(TONGSUO_HOME)/lib64 -lcrypto
4246

47+
win32: LIBS += -ladvapi32 -lcrypt32 -lgdi32 -luser32 -lws2_32 -L$$(TONGSUO_HOME)/lib -llibssl
48+
else:unix: LIBS += -L$$(TONGSUO_HOME)/lib64 -lssl
49+
4350
INCLUDEPATH += $$(TONGSUO_HOME)/include
4451
DEPENDPATH += $$(TONGSUO_HOME)/include
4552

@@ -55,7 +62,11 @@ FORMS += \
5562
sm2key.ui \
5663
sm2signverify.ui \
5764
sm3hash.ui \
58-
sm4encrypt.ui
65+
sm4encrypt.ui \
66+
tlcpclient.ui
5967

6068
RESOURCES += \
69+
certs.qrc \
6170
images.qrc
71+
72+
DISTFILES +=

mainwindow.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ MainWindow::MainWindow(QWidget *parent)
3333
sm4Encry = new Sm4encrypt();
3434
/* SM2签发证书实例化 */
3535
sm2Cer = new Sm2Cert();
36+
/* TLCP客户端实例化 */
37+
tlcpClient = new TLCPclient();
3638
/* 左侧功能导航 */
3739
QList<QString> strListWidgetList;
3840
strListWidgetList << "首页"
@@ -42,8 +44,9 @@ MainWindow::MainWindow(QWidget *parent)
4244
<< "SM3哈希"
4345
<< "SM2签名验签"
4446
<< "SM4加解密"
45-
<< "SM2签发证书";
46-
for (int i = 0; i < 8; i++) {
47+
<< "SM2签发证书"
48+
<< "TLCP客户端";
49+
for (int i = 0; i < 9; i++) {
4750
/* listWidget 插入项 */
4851
listWidget->insertItem(i, strListWidgetList[i]);
4952
}
@@ -56,6 +59,7 @@ MainWindow::MainWindow(QWidget *parent)
5659
stackedWidget->addWidget(sm2SignVerify);
5760
stackedWidget->addWidget(sm4Encry);
5861
stackedWidget->addWidget(sm2Cer);
62+
stackedWidget->addWidget(tlcpClient);
5963
/* 设置列表的最大宽度 */
6064
listWidget->setMaximumWidth(200);
6165
/* 添加到水平布局 */

mainwindow.h

+3
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include "sm2signverify.h"
1010
#include "sm3hash.h"
1111
#include "sm4encrypt.h"
12+
#include "tlcpclient.h"
1213
#include <QHBoxLayout>
1314
#include <QListWidget>
1415
#include <QMainWindow>
@@ -47,5 +48,7 @@ class MainWindow : public QMainWindow
4748
Sm4encrypt *sm4Encry;
4849
/* sm2签发证书 */
4950
Sm2Cert *sm2Cer;
51+
/* TLCP客户端界面 */
52+
TLCPclient *tlcpClient;
5053
};
5154
#endif // MAINWINDOW_H

randnum.ui

+15
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,11 @@
3737
<verstretch>0</verstretch>
3838
</sizepolicy>
3939
</property>
40+
<property name="font">
41+
<font>
42+
<pointsize>12</pointsize>
43+
</font>
44+
</property>
4045
</widget>
4146
</item>
4247
<item row="0" column="3">
@@ -81,13 +86,23 @@
8186
</item>
8287
<item row="2" column="2">
8388
<widget class="QPushButton" name="pushButtonGen">
89+
<property name="font">
90+
<font>
91+
<pointsize>12</pointsize>
92+
</font>
93+
</property>
8494
<property name="text">
8595
<string>生成</string>
8696
</property>
8797
</widget>
8898
</item>
8999
<item row="2" column="1">
90100
<widget class="QLineEdit" name="lineEditInput">
101+
<property name="font">
102+
<font>
103+
<pointsize>12</pointsize>
104+
</font>
105+
</property>
91106
<property name="text">
92107
<string>1</string>
93108
</property>

sm2cert.ui

+78-4
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,23 @@
1616
<layout class="QGridLayout" name="gridLayout">
1717
<item row="4" column="0">
1818
<widget class="QLabel" name="label_4">
19+
<property name="font">
20+
<font>
21+
<pointsize>12</pointsize>
22+
</font>
23+
</property>
1924
<property name="text">
2025
<string>签名证书&amp;密钥:</string>
2126
</property>
2227
</widget>
2328
</item>
2429
<item row="3" column="2">
2530
<widget class="QLineEdit" name="lineEditDays">
31+
<property name="font">
32+
<font>
33+
<pointsize>12</pointsize>
34+
</font>
35+
</property>
2636
<property name="text">
2737
<string>365</string>
2838
</property>
@@ -46,6 +56,11 @@
4656
</item>
4757
<item row="2" column="2">
4858
<widget class="QLineEdit" name="lineEditCN">
59+
<property name="font">
60+
<font>
61+
<pointsize>12</pointsize>
62+
</font>
63+
</property>
4964
<property name="inputMask">
5065
<string/>
5166
</property>
@@ -58,17 +73,33 @@
5873
</widget>
5974
</item>
6075
<item row="4" column="2">
61-
<widget class="QTextBrowser" name="textBrowserSignOutput"/>
76+
<widget class="QTextBrowser" name="textBrowserSignOutput">
77+
<property name="font">
78+
<font>
79+
<pointsize>10</pointsize>
80+
</font>
81+
</property>
82+
</widget>
6283
</item>
6384
<item row="3" column="3">
6485
<widget class="QPushButton" name="pushButtonGen">
86+
<property name="font">
87+
<font>
88+
<pointsize>12</pointsize>
89+
</font>
90+
</property>
6591
<property name="text">
6692
<string>生成证书</string>
6793
</property>
6894
</widget>
6995
</item>
7096
<item row="2" column="0">
7197
<widget class="QLabel" name="label_2">
98+
<property name="font">
99+
<font>
100+
<pointsize>12</pointsize>
101+
</font>
102+
</property>
72103
<property name="text">
73104
<string>通用名称:</string>
74105
</property>
@@ -89,13 +120,23 @@
89120
</item>
90121
<item row="1" column="0">
91122
<widget class="QLabel" name="label">
123+
<property name="font">
124+
<font>
125+
<pointsize>12</pointsize>
126+
</font>
127+
</property>
92128
<property name="text">
93129
<string>私钥/请求:</string>
94130
</property>
95131
</widget>
96132
</item>
97133
<item row="3" column="0">
98134
<widget class="QLabel" name="label_3">
135+
<property name="font">
136+
<font>
137+
<pointsize>12</pointsize>
138+
</font>
139+
</property>
99140
<property name="text">
100141
<string>有效天数:</string>
101142
</property>
@@ -108,13 +149,23 @@
108149
</property>
109150
<item>
110151
<widget class="QPushButton" name="pushButton_2">
152+
<property name="font">
153+
<font>
154+
<pointsize>12</pointsize>
155+
</font>
156+
</property>
111157
<property name="text">
112158
<string>自动生成</string>
113159
</property>
114160
</widget>
115161
</item>
116162
<item>
117163
<widget class="QPushButton" name="pushButton">
164+
<property name="font">
165+
<font>
166+
<pointsize>12</pointsize>
167+
</font>
168+
</property>
118169
<property name="text">
119170
<string>手动生成</string>
120171
</property>
@@ -136,20 +187,43 @@
136187
</layout>
137188
</item>
138189
<item row="5" column="2">
139-
<widget class="QTextBrowser" name="textBrowserEncryptOutput"/>
190+
<widget class="QTextBrowser" name="textBrowserEncryptOutput">
191+
<property name="font">
192+
<font>
193+
<pointsize>10</pointsize>
194+
</font>
195+
</property>
196+
</widget>
140197
</item>
141198
<item row="5" column="0">
142199
<widget class="QLabel" name="label_5">
200+
<property name="font">
201+
<font>
202+
<pointsize>12</pointsize>
203+
</font>
204+
</property>
143205
<property name="text">
144206
<string>加密证书&amp;密钥:</string>
145207
</property>
146208
</widget>
147209
</item>
148210
<item row="4" column="3">
149-
<widget class="QTextBrowser" name="textBrowserSignKey"/>
211+
<widget class="QTextBrowser" name="textBrowserSignKey">
212+
<property name="font">
213+
<font>
214+
<pointsize>10</pointsize>
215+
</font>
216+
</property>
217+
</widget>
150218
</item>
151219
<item row="5" column="3">
152-
<widget class="QTextBrowser" name="textBrowserEncryKey"/>
220+
<widget class="QTextBrowser" name="textBrowserEncryKey">
221+
<property name="font">
222+
<font>
223+
<pointsize>10</pointsize>
224+
</font>
225+
</property>
226+
</widget>
153227
</item>
154228
</layout>
155229
</widget>

sm2encrypt.ui

+20
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,23 @@
4242
</item>
4343
<item row="1" column="1">
4444
<widget class="QLineEdit" name="lineEditPub">
45+
<property name="font">
46+
<font>
47+
<pointsize>12</pointsize>
48+
</font>
49+
</property>
4550
<property name="text">
4651
<string>04C370A09551DCC0321F0927A44B1A4D6ED5C39C06B336AA8FDE3389AAE830CC518C54BE3D1EAAAF45E8A34F41BCEA429EAD6B3271189B967CD248FF566F9F5161</string>
4752
</property>
4853
</widget>
4954
</item>
5055
<item row="2" column="1">
5156
<widget class="QLineEdit" name="lineEditPri">
57+
<property name="font">
58+
<font>
59+
<pointsize>12</pointsize>
60+
</font>
61+
</property>
5262
<property name="text">
5363
<string>54519B9E1FD670D429B4D8EDE7A9A0322C5A6D3C3E9446903EFA5FE2C6B49EC2</string>
5464
</property>
@@ -110,13 +120,23 @@
110120
</item>
111121
<item row="0" column="2" rowspan="2">
112122
<widget class="QPlainTextEdit" name="plainTextEditOutput">
123+
<property name="font">
124+
<font>
125+
<pointsize>12</pointsize>
126+
</font>
127+
</property>
113128
<property name="lineWrapMode">
114129
<enum>QPlainTextEdit::WidgetWidth</enum>
115130
</property>
116131
</widget>
117132
</item>
118133
<item row="0" column="0" rowspan="2">
119134
<widget class="QPlainTextEdit" name="plainTextEditInput">
135+
<property name="font">
136+
<font>
137+
<pointsize>12</pointsize>
138+
</font>
139+
</property>
120140
<property name="plainText">
121141
<string>hello Tongsuo</string>
122142
</property>

sm2key.ui

+2-2
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@
122122
</property>
123123
<property name="font">
124124
<font>
125-
<pointsize>10</pointsize>
125+
<pointsize>12</pointsize>
126126
</font>
127127
</property>
128128
</widget>
@@ -179,7 +179,7 @@
179179
</property>
180180
<property name="font">
181181
<font>
182-
<pointsize>10</pointsize>
182+
<pointsize>12</pointsize>
183183
</font>
184184
</property>
185185
</widget>

0 commit comments

Comments
 (0)