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

665
Vistas
Convert certificate in p12 file to base64

I have a p12 certificate which I need to use to create digital signatures to be sent in the headers of a HTTP request. I'm using the node-forge package to get the privateKey and certificate bags from the p12.

const p12Asn1 = forge.asn1.fromDer(keyFile)
const p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, passwordHash)
const certificateBags = p12.getBags({ bagType: forge.pki.oids.certBag })
const certificate = certificateBags[forge.pki.oids.certBag][0].cert

I have instructions from the API vendor on creating the digital signature. One step is:

keyId - Get X509 certificate that accompanies the private key as a byte array and Base64 encode. This field is required.

How can I Base64 encode the certificate extracted from the bags above? I have tried various forge utility methods, forge.util, but the certificate is an object at this point so I'm not sure what bit needs encoding.

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