Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

146 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CryptoDrive

密码学加密网盘,数据库和服务器不储存明文文件。

本项目链接地址CryptoDrive

功能清单

  • 基于网页的用户注册与登录系统(60分)

    • 使用https绑定证书到域名而非IP地址 【 PKI X.509

    • 允许用户注册到系统

      • 用户名的合法字符集范围:中文、英文字母、数字
        • 类似:-、_、.等合法字符集范围之外的字符不允许使用
      • 用户口令长度限制在36个字符之内
      • 对用户输入的口令进行强度校验,禁止使用弱口令
        • 显示用户输入的口令的强度等级
    • 使用合法用户名和口令登录系统

    • 禁止使用明文存储用户口令 【PBKDF2 散列算法 慢速散列 针对散列算法(如MD5、SHA1等)的攻击方法】

      • 存储的口令即使被公开,也无法还原/解码出原始明文口令
    • (可选)安全的忘记口令 / 找回密码功能

  • 基于网页的文件上传加密与数字签名系统(20分)

    • 已完成《基于网页的用户注册与登录系统》所有要求
    • 限制文件大小:小于 10MB
    • 限制文件类型:office文档、常见图片类型
    • 匿名用户禁止上传文件
    • 对文件进行对称加密存储到文件系统,禁止明文存储文件 【 对称加密 密钥管理(如何安全存储对称加密密钥) 对称加密密文的PADDING问题
    • 系统对加密后文件进行数字签名 【 数字签名(多种签名工作模式差异)
    • (可选)文件秒传:服务器上已有的文件,客户端可以不必再重复上传了
  • 基于网页的加密文件下载与解密(20分)

    • 已完成《基于网页的文件上传加密与数字签名系统》所有要求
    • 提供匿名用户加密后文件和关联的数字签名文件的下载
      • 客户端对下载后的文件进行数字签名验证 【 非对称(公钥)加密 数字签名
      • 客户端对下载后的文件可以解密还原到原始文件 【 对称解密 密钥管理
    • 提供已登录用户解密后文件下载
    • 下载URL设置有效期(限制时间或限制下载次数),过期后禁止访问 【 数字签名 消息认证码 Hash Extension Length Attack Hash算法与HMAC算法的区别与联系
    • 提供静态文件的散列值下载,供下载文件完成后本地校验文件完整性 【 散列算法

本项目用到的关键技术

  • xchacha20poly1305:加密文件

  • argon2:密钥派生

  • ed25519:公私钥签名

  • HMAC(JWT):数字签名生成分享链接

FileEncryptionProcess

LinkSharing

快速安装与使用方法说明

  • 在WSL2中安装MongoDB

    # 1. Open your WSL terminal (ie. Ubuntu) and go to your home directory: 
    cd ~
    # 2. Update your Ubuntu packages: 
    sudo apt update
    #3.  Import the public key used by the MongoDB package management system: 
    wget -qO - https://www.mongodb.org/static/pgp/server-5.0.asc | sudo apt-key add -
    #4.  Create a list file for MongoDB: 
    echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu focal/mongodb-org/5.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-5.0.list
    #5.  Reload local package database: 
    sudo apt-get update
    #6.  Install MongoDB packages: 
    sudo apt-get install -y mongodb-org
    #7.  Confirm installation and get the version number: 
    mongod --version
    #8.  Make a directory to store data: 
    mkdir -p ~/data/db
    #9.  Run a Mongo instance: 
    sudo mongod --dbpath ~/data/db
    #10.  Check to see that your MongoDB instance is running with: 
    ps -e | grep 'mongod'
    #11.  To exit the MongoDB Shell, use the shortcut keys: Ctrl + C
  • 在WSL2中开启MongoDB服务

    #1.  Download the init.d script for MongoDB: 
    curl https://raw.githubusercontent.com/mongodb/mongo/master/debian/init.d | sudo tee /etc/init.d/mongodb >/dev/null
    #2.  Assign that script executable permissions: 
    sudo chmod +x /etc/init.d/mongodb
    #3.  Now you can use MongoDB service commands:
      sudo service mongodb status 
      #for checking the status of your database. You should see a [Fail] response if no database is running.
      sudo service mongodb start 
      #to start running your database. You should see a [Ok] response.
      sudo service mongodb stop 
      #to stop running your database.
  • 安装nodejs

    sudo apt-get install curl
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
    nvm install --lts
    node --version
    npm --version
    nvm use --lts
  • 构建前端(默认在3000端口打开服务)

    cd frontend
    npm install 
    npm run build
  • 运行后端

    • 修改config.env参数

      NODE_ENV=development
      
      
      PORT=3001
      
      DATABASE_LOCAL=mongodb://localhost:27017/yourdatabasename
      
      JWT_SECRET=my-ultra-secure-and-ultra-long-secret
      
      JWT_EXPIRES_IN=90d
      
      JWT_COOKIE_EXPIRES_IN=90
      

      ## 运行后端
      cd backend
      npm install
      
      openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout cert.key -out cert.crt -config req.cnf -sha256
      
      npm start # production
      npm run dev # development
  • 在成功配置前后端后,访问https://localhost:3001即可体验所有功能。

视频讲解地址

欢迎移步 BiliBili 观看演示视频

参考资料

文档类

课程类

杂项

About

No description, website, or topics provided.

Resources

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages