Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

208
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda