Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
三雷科技
QT博客案例
提交
8a1defaa
Q
QT博客案例
项目概览
三雷科技
/
QT博客案例
通知
1542
Star
47
Fork
34
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
QT博客案例
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
8a1defaa
编写于
11月 20, 2023
作者:
A
arv000
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 更新SM2WithSM3签名校验测试代码
更新SM2WithSM3签名校验测试代码 Log: 更新SM2WithSM3签名校验测试代码
上级
11ec7a54
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
207 addition
and
0 deletion
+207
-0
Openssl/sign/sm2withsm3/CMakeLists.txt
Openssl/sign/sm2withsm3/CMakeLists.txt
+18
-0
Openssl/sign/sm2withsm3/main.cc
Openssl/sign/sm2withsm3/main.cc
+70
-0
Openssl/sign/sm2withsm3/signature_value_bytes.der
Openssl/sign/sm2withsm3/signature_value_bytes.der
+2
-0
Openssl/sign/sm2withsm3/signed_data.der
Openssl/sign/sm2withsm3/signed_data.der
+0
-0
Openssl/sign/sm2withsm3/国密SM2服务器根证书V3_client.pem
Openssl/sign/sm2withsm3/国密SM2服务器根证书V3_client.pem
+4
-0
qt_easy/QWebChannel/QWebChannelJS/QWebChannelJS.pro
qt_easy/QWebChannel/QWebChannelJS/QWebChannelJS.pro
+37
-0
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.cpp
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.cpp
+6
-0
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.h
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.h
+17
-0
qt_easy/QWebChannel/QWebChannelJS/main.cpp
qt_easy/QWebChannel/QWebChannelJS/main.cpp
+11
-0
qt_easy/QWebChannel/QWebChannelJS/mainwindow.cpp
qt_easy/QWebChannel/QWebChannelJS/mainwindow.cpp
+11
-0
qt_easy/QWebChannel/QWebChannelJS/mainwindow.h
qt_easy/QWebChannel/QWebChannelJS/mainwindow.h
+15
-0
qt_easy/QWebChannel/QWebChannelJS/resources.qrc
qt_easy/QWebChannel/QWebChannelJS/resources.qrc
+2
-0
qt_easy/QWebChannel/QWebChannelJS/web/css/index.css
qt_easy/QWebChannel/QWebChannelJS/web/css/index.css
+3
-0
qt_easy/QWebChannel/QWebChannelJS/web/index.html
qt_easy/QWebChannel/QWebChannelJS/web/index.html
+8
-0
qt_easy/QWebChannel/QWebChannelJS/web/js/index.js
qt_easy/QWebChannel/QWebChannelJS/web/js/index.js
+3
-0
未找到文件。
Openssl/sign/sm2withsm3/CMakeLists.txt
0 → 100644
浏览文件 @
8a1defaa
cmake_minimum_required
(
VERSION 3.5 FATAL_ERROR
)
project
(
Test
)
# 一般当前目录设置为直接包含目录
set
(
CMAKE_INCLUDE_CURRENT_DIR ON
)
# 添加外部库的头文件目录
include_directories
(
/home/arv000/openssl/include
)
link_directories
(
/home/arv000/openssl/lib64
)
# 生成可执行程序
add_executable
(
Test main.cc
)
# 链接QT使用的库文件
target_link_libraries
(
Test libcrypto.a libssl.a pthread dl
)
Openssl/sign/sm2withsm3/main.cc
0 → 100644
浏览文件 @
8a1defaa
#include <openssl/evp.h>
#include <openssl/objects.h>
#include <openssl/err.h>
#include <string.h>
#include <stdio.h>
#include <openssl/pem.h>
#include <fstream>
#include <openssl/sm3.h>
int
main
(
void
)
{
EVP_MD_CTX
*
cmd_ctx
=
EVP_MD_CTX_new
();
EVP_PKEY_CTX
*
pctx
=
nullptr
;
// Owned by |ctx|.
const
char
*
filePath
=
"/media/arv000/c19ee280-30c9-43bc-a890-05e8c96984bc/00-work/01-bug/证书验证问题/国密SM2服务器根证书V3_client.pem"
;
const
char
*
signature_value_bytes_filePath
=
"/home/arv000/signature_value_bytes.der"
;
const
char
*
signed_data_filePath
=
"/home/arv000/signed_data.der"
;
const
EVP_MD
*
digest
=
EVP_sm3
();
// 读取公钥
FILE
*
file
=
fopen
(
filePath
,
"rb"
);
if
(
nullptr
==
file
){
printf
(
"public_key opens is failed ;
\r\n
"
);
}
EVP_PKEY
*
public_key
=
PEM_read_PUBKEY
(
file
,
nullptr
,
nullptr
,
nullptr
);
if
(
nullptr
==
public_key
){
printf
(
"public_key is null ;
\r\n
"
);
}
fclose
(
file
);
// 读取签名内容
FILE
*
file2
=
fopen
(
signature_value_bytes_filePath
,
"rb"
);
// 获取文件大小
fseek
(
file2
,
0
,
SEEK_END
);
long
signature_value_bytes_length
=
ftell
(
file2
);
fseek
(
file2
,
0
,
SEEK_SET
);
char
*
signature_value_bytes
=
(
char
*
)
malloc
(
signature_value_bytes_length
);
memset
(
signature_value_bytes
,
0
,
signature_value_bytes_length
);
fread
(
signature_value_bytes
,
1
,
signature_value_bytes_length
,
file2
);
fclose
(
file2
);
// 读取签名值内容
FILE
*
file3
=
fopen
(
signed_data_filePath
,
"rb"
);
// 获取文件大小
fseek
(
file3
,
0
,
SEEK_END
);
long
signed_data_length
=
ftell
(
file3
);
fseek
(
file3
,
0
,
SEEK_SET
);
char
*
signed_data
=
(
char
*
)
malloc
(
signed_data_length
);
memset
(
signed_data
,
0
,
signed_data_length
);
fread
(
signed_data
,
1
,
signed_data_length
,
file3
);
fclose
(
file3
);
if
(
!
EVP_DigestVerifyInit
(
cmd_ctx
,
&
pctx
,
digest
,
nullptr
,
public_key
))
{
printf
(
"EVP_DigestVerifyInit failed ;
\r\n
"
);
return
false
;
}
if
(
!
EVP_DigestVerifyUpdate
(
cmd_ctx
,
signed_data
,
signed_data_length
))
{
printf
(
"EVP_DigestVerifyUpdate failed ;
\r\n
"
);
return
false
;
}
bool
ret
=
1
==
EVP_DigestVerifyFinal
(
cmd_ctx
,
reinterpret_cast
<
const
unsigned
char
*>
(
signature_value_bytes
),
signature_value_bytes_length
);
printf
(
"ret = %d ;
\r\n
"
,
ret
);
return
0
;
}
\ No newline at end of file
Openssl/sign/sm2withsm3/signature_value_bytes.der
0 → 100644
浏览文件 @
8a1defaa
0D hjwFlҵDY
[0/#UtȜ ^mmT|'#ohv{$GVl
\ No newline at end of file
Openssl/sign/sm2withsm3/signed_data.der
0 → 100644
浏览文件 @
8a1defaa
文件已添加
Openssl/sign/sm2withsm3/国密SM2服务器根证书V3_client.pem
0 → 100644
浏览文件 @
8a1defaa
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE76S2wS2wnzVaso2EhpAp9ALrJWkB
scBkpunMEBvwJAwWnWG9SwaefXqnjj1EBiZySYnUl4ZHRsWxXCgcLwdLnw==
-----END PUBLIC KEY-----
qt_easy/QWebChannel/QWebChannelJS/QWebChannelJS.pro
0 → 100644
浏览文件 @
8a1defaa
#-------------------------------------------------
#
#
Project
created
by
QtCreator
2023
-
11
-
13
T20
:
49
:
15
#
#-------------------------------------------------
QT
+=
core
gui
greaterThan
(
QT_MAJOR_VERSION
,
4
)
:
QT
+=
widgets
TARGET
=
QWebChannelJS
TEMPLATE
=
app
#
The
following
define
makes
your
compiler
emit
warnings
if
you
use
#
any
feature
of
Qt
which
has
been
marked
as
deprecated
(
the
exact
warnings
#
depend
on
your
compiler
).
Please
consult
the
documentation
of
the
#
deprecated
API
in
order
to
know
how
to
port
your
code
away
from
it
.
DEFINES
+=
QT_DEPRECATED_WARNINGS
#
You
can
also
make
your
code
fail
to
compile
if
you
use
deprecated
APIs
.
#
In
order
to
do
so
,
uncomment
the
following
line
.
#
You
can
also
select
to
disable
deprecated
APIs
only
up
to
a
certain
version
of
Qt
.
#
DEFINES
+=
QT_DISABLE_DEPRECATED_BEFORE
=
0
x060000
#
disables
all
the
APIs
deprecated
before
Qt
6.0
.
0
CONFIG
+=
c
++
11
SOURCES
+=
\
main
.
cpp
\
mainwindow
.
cpp
HEADERS
+=
\
mainwindow
.
h
#
Default
rules
for
deployment
.
qnx
:
target
.
path
=
/
tmp
/
$$
{
TARGET
}
/
bin
else
:
unix
:
!
android
:
target
.
path
=
/
opt
/
$$
{
TARGET
}
/
bin
!
isEmpty
(
target
.
path
)
:
INSTALLS
+=
target
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.cpp
0 → 100644
浏览文件 @
8a1defaa
#include "jsapiproxy.h"
JSApiProxy
::
JSApiProxy
(
QObject
*
parent
)
:
QObject
(
parent
)
{
}
qt_easy/QWebChannel/QWebChannelJS/jsapiproxy.h
0 → 100644
浏览文件 @
8a1defaa
#ifndef JSAPIPROXY_H
#define JSAPIPROXY_H
#include <QObject>
class
JSApiProxy
:
public
QObject
{
Q_OBJECT
public:
explicit
JSApiProxy
(
QObject
*
parent
=
nullptr
);
signals:
public
slots
:
};
#endif // JSAPIPROXY_H
\ No newline at end of file
qt_easy/QWebChannel/QWebChannelJS/main.cpp
0 → 100644
浏览文件 @
8a1defaa
#include "mainwindow.h"
#include <QApplication>
int
main
(
int
argc
,
char
*
argv
[])
{
QApplication
a
(
argc
,
argv
);
MainWindow
w
;
w
.
show
();
return
a
.
exec
();
}
qt_easy/QWebChannel/QWebChannelJS/mainwindow.cpp
0 → 100644
浏览文件 @
8a1defaa
#include "mainwindow.h"
MainWindow
::
MainWindow
(
QWidget
*
parent
)
:
QMainWindow
(
parent
)
{
}
MainWindow
::~
MainWindow
()
{
}
qt_easy/QWebChannel/QWebChannelJS/mainwindow.h
0 → 100644
浏览文件 @
8a1defaa
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
class
MainWindow
:
public
QMainWindow
{
Q_OBJECT
public:
MainWindow
(
QWidget
*
parent
=
0
);
~
MainWindow
();
};
#endif // MAINWINDOW_H
qt_easy/QWebChannel/QWebChannelJS/resources.qrc
0 → 100644
浏览文件 @
8a1defaa
<!DOCTYPE RCC>
<RCC
version=
"1.0"
/>
qt_easy/QWebChannel/QWebChannelJS/web/css/index.css
0 → 100644
浏览文件 @
8a1defaa
.btn
{
background
:
red
;
}
\ No newline at end of file
qt_easy/QWebChannel/QWebChannelJS/web/index.html
0 → 100644
浏览文件 @
8a1defaa
<html>
<head>
<meta
http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
<script
src=
"js/index.js"
></script>
<link
rel=
"stylesheet"
type=
"text/css"
href=
"css/index.css"
>
</head>
<button
class=
"btn"
onclick=
"cl();"
>
按钮
</button>
</html>
qt_easy/QWebChannel/QWebChannelJS/web/js/index.js
0 → 100644
浏览文件 @
8a1defaa
function
cl
(){
alert
(
"
asdf
"
);
}
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录