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

159
Vistas
cms Enveloped Data binary encoding problem in pkijs

I'm trying trying to implement exchange of CMS encrypted content using the pkijs library. Basically I've just copied the example from here: https://pkijs.org/examples/CMSEnvelopedExample.html

here the excerpt for encryption

cmsEnveloped.addRecipientByCertificate(certSimpl, {  oaepHashAlgorithm: oaepHashAlg });

return cmsEnveloped.encrypt(encAlg, valueBuffer).then(() => {
  var cmsContentSimpl = new ContentInfo();
  cmsContentSimpl.contentType = "1.2.840.113549.1.7.3";
  cmsContentSimpl.content = cmsEnveloped.toSchema();
  cmsEnvelopedBuffer = cmsContentSimpl.toSchema().toBER(false);

The problematic part is the binary encoding of the asn.1 schema with .toBER(false). If the valueBuffer is not extremely small it is very slow ~13sek for 1 Mb. My question are: why is this so slow? and could I just encode it differently e.g. toJSON()and then stringToArrayBuffer? Are there any security concerns?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

There was some unoptimized code in the implementation of toBER in asn1js. You should upgrade the dependency to asn1js@2.4.0 if you encounter the same problem. This is the issue on github: https://github.com/PeculiarVentures/PKI.js/issues/347

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