kjur / jsrsasign

The 'jsrsasign' (RSA-Sign JavaScript Library) is an opensource free cryptography library supporting RSA/RSAPSS/ECDSA/DSA signing/validation, ASN.1, PKCS#1/5/8 private/public key, X.509 certificate, CRL, OCSP, CMS SignedData, TimeStamp, CAdES and JSON Web Signature/Token in pure JavaScript.
https://kjur.github.io/jsrsasign
Other
3.27k stars 643 forks source link

多线程使用时报错[worker] #543

Closed tech-xs closed 2 years ago

tech-xs commented 2 years ago

线程库

yarn add vue-worker
    generate() {
      let that = this
      this.generateBtnDisabled = true
      SimpleWebWorker.run(() => {
        let res = {}
        let key = jsrsasign.KEYUTIL.generateKeypair("RSA", 2048);
        res.privateKey = jsrsasign.KEYUTIL.getPEM(key.prvKeyObj, "PKCS8PRV");
        res.publicKey = jsrsasign.KEYUTIL.getPEM(key.pubKeyObj);
        return res
      }).then(res => {
        that.generateBtnDisabled = false
        this.publicKey = res.publicKey
        this.privateKey = res.privateKey
      })
    },

image

kjur commented 2 years ago

Sorry but jsrsasign will not be supported on workers. Thank you.