Extending and exporting pkcs12 at runtime not possible?

Aperta
#1,052 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
javascript
Ambito
cryptography

Direzione di ricerca

Start with forge.pkcs12.pkcs12FromAsn1, forge.pkcs12.toPkcs12Asn1, and forge.asn1.toDer to understand the existing parse and export boundaries. Define how multiple certificate entries should be added to an existing PKCS#12 object, then verify that the resulting object can be exported and opened as a valid truststore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Use-case: take existing pkcs12, extend it with a new entry and save to filesystem as p12.
Issue: PKCS#12 PFX object cannot be converted to asn1 object
Looking at the available documentation I've proceeded in the following for parsing the pkcs12:

var p12File = fs.readFileSync('truststore.p12', 'binary');
var pkcs12Asn1 = forge.asn1.fromDer(p12File);
var pkcs12 = forge.pkcs12.pkcs12FromAsn1(pkcs12Asn1, false, "password");

At this point I am unsure how I can extend the pkcs12 with an additional entry, like a certificate in case of a truststore.
Building a new one with forge.pkcs12.toPkcs12Asn1 only allows one private key and a cert chain, not multiple entries.
Furthermore, to export the pkcs12 I would use:

var p12Der = forge.asn1.toDer(pkcs12Asn1).getBytes();
fs.writeFile('writtenP12.p12', p12Der, 'binary', (err) => {})

Doing this with the PKCS#12 PFX object instead of the asn1 object results in TypeError: Cannot read properties of undefined (reading 'tbsCertificate').
Is there any way to convert the PKCS#12 PFX object back to ASN1 for exporting?

Any help would be greatly appreciated.

Lingua principale
JavaScript
Stelle
5.4k
Fork
874
Merge medio
3m
PR unite (30g)
6

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di digitalbazaar/forge

Tutte le issue di digitalbazaar/forge

Issue simili

Altre issue su JavaScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.