Skip to content

Commit

Permalink
Tsapp v1 (#8)
Browse files Browse the repository at this point in the history
支持TLCP客户端
  • Loading branch information
VAzureV authored Apr 13, 2024
1 parent ff316aa commit a0d9549
Show file tree
Hide file tree
Showing 15 changed files with 558 additions and 16 deletions.
20 changes: 20 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,22 @@
# tsapp
基于铜锁密码库开发的商用密码工具箱桌面应用程序

# 功能与特性

> 多数功能都支持用户自输入密钥
- 随机数生成
- SM2密钥对生成
- SM2加解密
- SM2签名与验签
- SM3摘要
- SM4加解密
- 签发SM2证书
- TLCP客户端

# 配置与安装

可以直接安装使用该应用程序,或使用源码在本地使用QT启动。



13 changes: 12 additions & 1 deletion TongsuoToolbox_v01.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
QT += core gui

QT += network

greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

CONFIG += c++17
Expand All @@ -19,6 +21,7 @@ SOURCES += \
sm2signverify.cpp \
sm3hash.cpp \
sm4encrypt.cpp \
tlcpclient.cpp \
tserror.cpp

HEADERS += \
Expand All @@ -31,6 +34,7 @@ HEADERS += \
sm2signverify.h \
sm3hash.h \
sm4encrypt.h \
tlcpclient.h \
tserror.h

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

win32: LIBS += -ladvapi32 -lcrypt32 -lgdi32 -luser32 -lws2_32 -L$$(TONGSUO_HOME)/lib -llibssl
else:unix: LIBS += -L$$(TONGSUO_HOME)/lib64 -lssl

INCLUDEPATH += $$(TONGSUO_HOME)/include
DEPENDPATH += $$(TONGSUO_HOME)/include

Expand All @@ -55,7 +62,11 @@ FORMS += \
sm2key.ui \
sm2signverify.ui \
sm3hash.ui \
sm4encrypt.ui
sm4encrypt.ui \
tlcpclient.ui

RESOURCES += \
certs.qrc \
images.qrc

DISTFILES +=
8 changes: 6 additions & 2 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ MainWindow::MainWindow(QWidget *parent)
sm4Encry = new Sm4encrypt();
/* SM2签发证书实例化 */
sm2Cer = new Sm2Cert();
/* TLCP客户端实例化 */
tlcpClient = new TLCPclient();
/* 左侧功能导航 */
QList<QString> strListWidgetList;
strListWidgetList << "首页"
Expand All @@ -42,8 +44,9 @@ MainWindow::MainWindow(QWidget *parent)
<< "SM3哈希"
<< "SM2签名验签"
<< "SM4加解密"
<< "SM2签发证书";
for (int i = 0; i < 8; i++) {
<< "SM2签发证书"
<< "TLCP客户端";
for (int i = 0; i < 9; i++) {
/* listWidget 插入项 */
listWidget->insertItem(i, strListWidgetList[i]);
}
Expand All @@ -56,6 +59,7 @@ MainWindow::MainWindow(QWidget *parent)
stackedWidget->addWidget(sm2SignVerify);
stackedWidget->addWidget(sm4Encry);
stackedWidget->addWidget(sm2Cer);
stackedWidget->addWidget(tlcpClient);
/* 设置列表的最大宽度 */
listWidget->setMaximumWidth(200);
/* 添加到水平布局 */
Expand Down
3 changes: 3 additions & 0 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "sm2signverify.h"
#include "sm3hash.h"
#include "sm4encrypt.h"
#include "tlcpclient.h"
#include <QHBoxLayout>
#include <QListWidget>
#include <QMainWindow>
Expand Down Expand Up @@ -47,5 +48,7 @@ class MainWindow : public QMainWindow
Sm4encrypt *sm4Encry;
/* sm2签发证书 */
Sm2Cert *sm2Cer;
/* TLCP客户端界面 */
TLCPclient *tlcpClient;
};
#endif // MAINWINDOW_H
15 changes: 15 additions & 0 deletions randnum.ui
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
</widget>
</item>
<item row="0" column="3">
Expand Down Expand Up @@ -81,13 +86,23 @@
</item>
<item row="2" column="2">
<widget class="QPushButton" name="pushButtonGen">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>生成</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditInput">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>1</string>
</property>
Expand Down
82 changes: 78 additions & 4 deletions sm2cert.ui
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,23 @@
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="0">
<widget class="QLabel" name="label_4">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>签名证书&amp;密钥:</string>
</property>
</widget>
</item>
<item row="3" column="2">
<widget class="QLineEdit" name="lineEditDays">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>365</string>
</property>
Expand All @@ -46,6 +56,11 @@
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="lineEditCN">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="inputMask">
<string/>
</property>
Expand All @@ -58,17 +73,33 @@
</widget>
</item>
<item row="4" column="2">
<widget class="QTextBrowser" name="textBrowserSignOutput"/>
<widget class="QTextBrowser" name="textBrowserSignOutput">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
<item row="3" column="3">
<widget class="QPushButton" name="pushButtonGen">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>生成证书</string>
</property>
</widget>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>通用名称:</string>
</property>
Expand All @@ -89,13 +120,23 @@
</item>
<item row="1" column="0">
<widget class="QLabel" name="label">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>私钥/请求:</string>
</property>
</widget>
</item>
<item row="3" column="0">
<widget class="QLabel" name="label_3">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>有效天数:</string>
</property>
Expand All @@ -108,13 +149,23 @@
</property>
<item>
<widget class="QPushButton" name="pushButton_2">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>自动生成</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="pushButton">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>手动生成</string>
</property>
Expand All @@ -136,20 +187,43 @@
</layout>
</item>
<item row="5" column="2">
<widget class="QTextBrowser" name="textBrowserEncryptOutput"/>
<widget class="QTextBrowser" name="textBrowserEncryptOutput">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
<item row="5" column="0">
<widget class="QLabel" name="label_5">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>加密证书&amp;密钥:</string>
</property>
</widget>
</item>
<item row="4" column="3">
<widget class="QTextBrowser" name="textBrowserSignKey"/>
<widget class="QTextBrowser" name="textBrowserSignKey">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
<item row="5" column="3">
<widget class="QTextBrowser" name="textBrowserEncryKey"/>
<widget class="QTextBrowser" name="textBrowserEncryKey">
<property name="font">
<font>
<pointsize>10</pointsize>
</font>
</property>
</widget>
</item>
</layout>
</widget>
Expand Down
20 changes: 20 additions & 0 deletions sm2encrypt.ui
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,23 @@
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="lineEditPub">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>04C370A09551DCC0321F0927A44B1A4D6ED5C39C06B336AA8FDE3389AAE830CC518C54BE3D1EAAAF45E8A34F41BCEA429EAD6B3271189B967CD248FF566F9F5161</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="lineEditPri">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="text">
<string>54519B9E1FD670D429B4D8EDE7A9A0322C5A6D3C3E9446903EFA5FE2C6B49EC2</string>
</property>
Expand Down Expand Up @@ -110,13 +120,23 @@
</item>
<item row="0" column="2" rowspan="2">
<widget class="QPlainTextEdit" name="plainTextEditOutput">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="lineWrapMode">
<enum>QPlainTextEdit::WidgetWidth</enum>
</property>
</widget>
</item>
<item row="0" column="0" rowspan="2">
<widget class="QPlainTextEdit" name="plainTextEditInput">
<property name="font">
<font>
<pointsize>12</pointsize>
</font>
</property>
<property name="plainText">
<string>hello Tongsuo</string>
</property>
Expand Down
4 changes: 2 additions & 2 deletions sm2key.ui
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>12</pointsize>
</font>
</property>
</widget>
Expand Down Expand Up @@ -179,7 +179,7 @@
</property>
<property name="font">
<font>
<pointsize>10</pointsize>
<pointsize>12</pointsize>
</font>
</property>
</widget>
Expand Down
Loading

0 comments on commit a0d9549

Please sign in to comment.