Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

202
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda