ssdd
This commit is contained in:
@@ -7,6 +7,15 @@ class Rsa {
|
||||
constructor() {
|
||||
this.private_key = this.readFiles(this.getFilePath(config.rsa.private_key))
|
||||
this.public_key = this.readFiles(this.getFilePath(config.rsa.public_key))
|
||||
|
||||
this.pri_rsa = new NodeRsa(this.private_key,'pkcs8-private-pem')
|
||||
this.pri_rsa.setOptions({ encryptionScheme: 'pkcs1' })
|
||||
this.pri_rsa.setOptions({ environment: "browser" });
|
||||
|
||||
this.pub_rsa = new NodeRsa(this.public_key,'pkcs8-public-pem')
|
||||
this.pub_rsa.setOptions({ encryptionScheme: 'pkcs1' })
|
||||
this.pub_rsa.setOptions({ environment: "browser" });
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +37,7 @@ class Rsa {
|
||||
|
||||
// 私钥解密
|
||||
PrivateKeyDecryption(text) {
|
||||
return JSON.parse((new NodeRsa(this.private_key)).decrypt(text, 'utf8'))
|
||||
return JSON.parse(this.pri_rsa.decrypt(text, 'utf8'))
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user