Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

204
Views
How to use digital signature in jsrsasign.js with Chinese Character?

I need to interface with third-party organizations. They need to add a digital signature to the data and put it in the request header.

I found that jsrsasign.js could be helpful so I am using that to do the digital signature, but always with the wrong result.

enter image description here

my code:

import { RSAKey, KEYUTIL, KJUR, hex2b64 } from 'jsrsasign'
export function signature (url) {
  // 创建RSAKey对象
  var rsa = new RSAKey()
  let k = '-----BEGIN PRIVATE KEY-----x-----END PRIVATE KEY-----'
  // 将密钥转码
  rsa = KEYUTIL.getKey(k)
  // 创建Signature对象,设置签名编码算法
  var sig = new KJUR.crypto.Signature({'alg': 'SHA256withRSA'})
  // 初始化
  sig.init(rsa)
  console.log('***url***', url)
  // 传入待加密字符串
  sig.updateString(url)
  // 生成密文
  var sign = hex2b64(sig.sign())
  console.log('**sign**', sign)
  return sign
}
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm a jsrsasign maintainer. It shall be work if your code or page is in UTF-8 even though Chinese, Cyrillic or Japanese characters.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!