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

207
Vistas
firmando un CSR con pkijs

Estoy tratando de firmar una CSR con un certificado local utilizando la biblioteca pkijs, pero CA siempre devuelve un error: No se pudo analizar la solicitud de PKIOperation.

También creo que el método de firma en pkijs solo devuelve la firma y no los datos envueltos con ella, ya que el tamaño de mis datos envueltos es bastante mayor que el tamaño de los datos firmados.

Aquí está el código que estoy usando para firmar los datos:

 public signScepCsr(csr: ArrayBuffer, signingCert: Certificate, privateKey: any) { let sequence = Promise.resolve(); //region Create a message digest const crypto = getCrypto(); sequence.then(() => { let certSigned = new SignedData({ version: 1, encapContentInfo: new EncapsulatedContentInfo({ eContentType: this.envelopedDataOid }), signerInfos: [new SignerInfo({ version: 1, sid: new IssuerAndSerialNumber({ issuer: signingCert.issuer, serialNumber: signingCert.serialNumber }), messageType: 19, transactionID: Guid.create().toString(), })], certificaes: [signingCert] }); // Sign the CSR buffer with local certificate private key. return certSigned.sign(privateKey, 0, this.hashAlg, csr); }); let result = ''; return sequence.then((result) => { let r2 = result as SignedData; let certSignedSchema = r2.toSchema(true); let signedContent = new ContentInfo({ contentType: this.signedDataOid, content: certSignedSchema }); let finalSignedSchema = signedContent.toSchema(); //region Make length of some elements in "indefinite form" finalSignedSchema.lenBlock.isIndefiniteForm = true; var block1 = finalSignedSchema.valueBlock.value[1]; block1.lenBlock.isIndefiniteForm = true; var block2 = block1.valueBlock.value[0]; block2.lenBlock.isIndefiniteForm = true; let signedContentBuffer = finalSignedSchema.toBER(false); let resultStr = window.btoa(String.fromCharCode.apply(null, new Uint8Array(signedContentBuffer))); return resultStr; }, () => Promise.reject('Failed to successfully sign the CSR.')); }

¿Hay alguna sugerencia?

about 4 years ago · Juan Pablo Isaza
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