feat: 读取节点的 ca-str 和 _ca (后端文件路径) 字段, 自动计算 fingerprint

This commit is contained in:
xream
2024-06-13 20:29:23 +08:00
parent 3ad42f2c10
commit ad3d2270ac
4 changed files with 42 additions and 1 deletions

11
backend/src/utils/rs.js Normal file
View File

@@ -0,0 +1,11 @@
import rs from 'jsrsasign';
export function generateFingerprint(caStr) {
const hex = rs.pemtohex(caStr);
const fingerPrint = rs.KJUR.crypto.Util.hashHex(hex, 'sha256');
return fingerPrint.match(/.{2}/g).join(':').toUpperCase();
}
export default {
generateFingerprint,
};