D0n9X1n / hexo-blog-encrypt

Yet, just another hexo plugin for security.
https://www.npmjs.com/package/hexo-blog-encrypt
MIT License
971 stars 101 forks source link

加密 API 出现问题 #195

Closed Chongsaid closed 1 year ago

Chongsaid commented 1 year ago

image

定义

const cryptoObj = window.crypto || window.msCrypto;

浏览器变量查看:

image

可参考文献:

https://w3c.github.io/webcrypto/#dom-windoworworkerglobalscope-crypto

Chongsaid commented 1 year ago

浏览器版本

尝试三款浏览器均无法进行解密:

  1. Chrome 版本 106.0.5249.119(正式版本) (64 位)
  2. Microsoft Edge 版本 107.0.1418.26 (正式版本) (64 位)
  3. Firefox 版本: 106.0.3 (64 位)

复现方式

点击文章,输入密码后回车,控制台出现错误。

image

Chongsaid commented 1 year ago

刚刚尝试在其它网站上使用 window.crypto 对象,但是是可以正常使用的。 所以不是API的问题,不知道是哪里配置问题还是某处代码将此对象方法干掉了,我贴一下我的配置(是按照说明进行的)

_config.yml 配置

# Security
encrypt: # hexo-blog-encrypt
  abstract: 此文章设置加密,请输入密码后查看。
  message: 请在这里输入密码以继续。
  tags:
  - {name: security, password: test123}
  theme: xray
  wrong_pass_message: 抱歉,此密码不正确,因此无法查看内容。
  wrong_hash_message: 抱歉, 这个文章不能被校验,但你可以查看解密后的内容。

文章配置:

---
title: 软件配置
date: 2022-11-3 14:20:25
author: Chongsaid
top: True
tags: 配置
password: test
---

依赖

{
  "name": "hexo-site",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "build": "hexo generate",
    "clean": "hexo clean",
    "deploy": "hexo deploy",
    "server": "hexo server"
  },
  "hexo": {
    "version": "6.3.0"
  },
  "dependencies": {
    "hexo": "^6.3.0",
    "hexo-blog-encrypt": "^3.1.6",
    "hexo-generator-archive": "^2.0.0",
    "hexo-generator-category": "^2.0.0",
    "hexo-generator-feed": "^3.0.0",
    "hexo-generator-index-pin-top": "^0.2.2",
    "hexo-generator-searchdb": "^1.4.1",
    "hexo-generator-tag": "^2.0.0",
    "hexo-renderer-ejs": "^2.0.0",
    "hexo-renderer-marked": "^6.0.0",
    "hexo-renderer-stylus": "^2.1.0",
    "hexo-server": "^3.0.0",
    "hexo-theme-ayer": "^1.9.7-0",
    "hexo-theme-landscape": "^0.0.3"
  }
}

Node & Npm Version

NodeJs : v18.10.0 npm :v8.19.2

如果那边无法复现,可以关闭此 issue,可能是我的环境有问题,麻烦了!

D0n9X1n commented 1 year ago

See #129

D0n9X1n commented 1 year ago

插件仅支持 https 访问。需要更换成 https 协议。