How to use the pkcs7 function from node-forge
Find comprehensive JavaScript node-forge.pkcs7 code examples handpicked from public code repositorys.
GitHub: desertkun/hiera-editor
215 216 217 218 219 220 221 222 223 224
} public encrypt(value: string, publicKey: string): any { const cert = forge.pki.certificateFromPem(publicKey); const p7 = forge.pkcs7.createEnvelopedData(); p7.addRecipient(cert); p7.content = forge.util.createBuffer(); p7.content.putString(value); p7.encrypt();
0
56
7
154 155 156 157 158 159 160 161 162 163
pem.clientprivate = forge.pki.privateKeyToPem(clientkeys.privateKey); pem.clientpublic = forge.pki.publicKeyToPem(clientkeys.publicKey); pem.clientcert = forge.pki.certificateToPem(clientcert); if (options.pkcs7) { var clientp7 = forge.pkcs7.createSignedData(); clientp7.addCertificate(clientcert); pem.clientpkcs7 = forge.pkcs7.messageToPem(clientp7); } }
0
1
1
+ 7 other calls in file
GitHub: cavrau/assinador-tcc
202 203 204 205 206 207 208 209 210 211
})[forge.pki.oids.pkcs8ShroudedKeyBag]; // pega chave privada do certificado const privateKey = keyBags[0].key; // Cria pkcs7. const p7 = forge.pkcs7.createSignedData(); // coloca o conteúdo como sendo os bytes do pdf. p7.content = forge.util.createBuffer(pdf.toString('binary')); // Adiciona certificados e chaves públicas ao pkcs7
0
0
1
+ 14 other calls in file
GitHub: cavrau/assinador-tcc
68 69 70 71 72 73 74 75 76 77
"Access-Control-Allow-Origin": "*" }, } ) // Lê PKCS7 const pkcs7 = forge.pkcs7.messageFromPem(res.data) // exporta a chave privada gerada no começo para pkcs8 e bota ela num arquivo const exported = await window.crypto.subtle.exportKey("pkcs8", keys.privateKey) const exportedAsString = ab2str(exported); const exportedAsBase64 = window.btoa(exportedAsString);
0
0
1
+ 81 other calls in file
node-forge.pki is the most popular function in node-forge (10287 examples)