mirror of
https://git.mirrors.martin98.com/https://github.com/sub-store-org/Sub-Store.git
synced 2026-04-02 00:03:18 +08:00
feat: 读取节点的 ca-str 和 _ca (后端文件路径) 字段, 自动计算 fingerprint
This commit is contained in:
11
backend/src/utils/rs.js
Normal file
11
backend/src/utils/rs.js
Normal 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,
|
||||
};
|
||||
Reference in New Issue
Block a user