实验三 电子公文传输系统安全-进展2
- 上周任务完成情况(代码链接,所写文档等) - 本周计划
1.实现了服务器从Windows转移到centos7上。

2.实现了安装国密证书

部分代码:
|
tar zxfm httpd-2.4.46.tar.gz vi build/config_vars.mk 找到ab_LIBS = -L/usr/local/gmssl/lib -lssl -lcrypto -lrt -lcrypt -lpthread -ldl make install
配置/usr/local/httpd/conf/httpd.conf SSLCipherSuite ECC-SM4-CBC-SM3:ECDHE-SM4-GCM-SM3
|
3.实现了使用sha256加盐,提高了破解难度

代码
|
<?php error_reporting(E_ALL & ~E_NOTICE); // 添加屏蔽Notice语句
//创建连接 $conn = new mysqli('127.0.0.1','root','liu12345','csv_db'); //检测连接 if($conn->connect_error){ die('连接失败:'.$conn->connect_error); } mysqli_set_charset($conn, "utf8"); // 添加强制使用UTF-8编码语句
$username = $_POST["username"]; $password = $_POST["password"]; $query = "SELECT salt, password, realname, role FROM `t_user` WHERE username = '$username'"; $result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); $salt = $row["salt"]; $hash_password = $password.$salt; $hashed_password_1=hash('sha256', $hash_password); $hashed_password= strtoupper($hashed_password_1);
// 检查哈希值是否匹配 if ($row["password"] == $hashed_password) { // 密码匹配 $realname = $row["realname"]; $role = $row["role"]; echo $row["password"]; // 将真实姓名和角色存储到 $_SESSION 变量中 session_start(); $_SESSION['realname'] = $realname; $_SESSION['role'] = $role;
// 跳转到欢迎页面 header('Location: welcome.php'); exit (1); } else { // 密码不匹配 echo "密码错误"; } } else { // 用户不存在 echo "该用户不存在,请联系管理员注册"; }
mysqli_close($conn);
?> |
本周计划
1.实现公文的删除功能。
2.实现防止SQL注入。
3.实现文件在服务器端加密(较难实现)。
1
.实现了服务器从Windows转移到centos7上。
代码:无
2.实现了安装国密证书
部分代码:
|
tar zxfm httpd-2.4.46.tar.gz vi build/config_vars.mk 找到ab_LIBS = -L/usr/local/gmssl/lib -lssl -lcrypto -lrt -lcrypt -lpthread -ldl make install
配置/usr/local/httpd/conf/httpd.conf SSLCipherSuite ECC-SM4-CBC-SM3:ECDHE-SM4-GCM-SM3
|
3.实现了使用sha256加盐,提高了破解难度
代码
|
<?php error_reporting(E_ALL & ~E_NOTICE); // 添加屏蔽Notice语句
//创建连接 $conn = new mysqli('127.0.0.1','root','liu12345','csv_db'); //检测连接 if($conn->connect_error){ die('连接失败:'.$conn->connect_error); } mysqli_set_charset($conn, "utf8"); // 添加强制使用UTF-8编码语句
$username = $_POST["username"]; $password = $_POST["password"]; $query = "SELECT salt, password, realname, role FROM `t_user` WHERE username = '$username'"; $result = mysqli_query($conn, $query);
if (mysqli_num_rows($result) > 0) { $row = mysqli_fetch_assoc($result); $salt = $row["salt"]; $hash_password = $password.$salt; $hashed_password_1=hash('sha256', $hash_password); $hashed_password= strtoupper($hashed_password_1);
// 检查哈希值是否匹配 if ($row["password"] == $hashed_password) { // 密码匹配 $realname = $row["realname"]; $role = $row["role"]; echo $row["password"]; // 将真实姓名和角色存储到 $_SESSION 变量中 session_start(); $_SESSION['realname'] = $realname; $_SESSION['role'] = $role;
// 跳转到欢迎页面 header('Location: welcome.php'); exit (1); } else { // 密码不匹配 echo "密码错误"; } } else { // 用户不存在 echo "该用户不存在,请联系管理员注册"; }
mysqli_close($conn);
?> |
本周计划
1.实现公文的删除功能。
2.实现防止SQL注入。
3.实现文件在服务器端加密(较难实现)。

浙公网安备 33010602011771号