How to Append root and intermediate Certs
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 25/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- cryptography, security
Hướng nghiên cứu
Start by reproducing the reported behavior with node-forge 1.3.1 using the provided certificate URLs and the call to pkcs12.toPkcs12Asn1. Inspect how the certificate array is encoded and verify the resulting output.pfx contains the server, intermediate, and root certificates.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hello, can someone please verify if I am doing something wrong.
I would like to append root CA and intermediate cert from Let's Encrypt that certificate would like this - see the screen.
This is the code:
const path = require('path');
const privateKeyFilePath = path.join(__dirname, 'private.key');
const certFilePath = path.join(__dirname, 'serverCert.pem');
const cert = fs.readFileSync(certFilePath, 'utf8');
const key = fs.readFileSync(privateKeyFilePath, 'utf8');
// Load your server certificate
const privateKey = forge.pki.privateKeyFromPem(key.toString());
const serverCertificate = forge.pki.certificateFromPem(cert.toString());
const intermediateCertUrl = 'https://letsencrypt.org/certs/lets-encrypt-x3-cross-signed.pem';
const rootCertUrl = 'https://letsencrypt.org/certs/isrgrootx1.pem';
const intermediateCertResponse = await fetch(intermediateCertUrl);
const rootCertResponse = await fetch(rootCertUrl);
const intermediateCertPem = await intermediateCertResponse.text();
const rootCertPem = await rootCertResponse.text();
const intermediateCert = forge.pki.certificateFromPem(intermediateCertPem);
const rootCert = forge.pki.certificateFromPem(rootCertPem);
// Create the certificate chain
serverCertificate.setIssuer(intermediateCert.subject.attributes);
intermediateCert.setIssuer(rootCert.subject.attributes);
// Generate the PKCS#12 certificate
const pkcs12 = forge.pkcs12.toPkcs12Asn1(privateKey, [serverCertificate, intermediateCert, rootCert], '');
// Define the file path where you want to save the PKCS#12 certificate (PFX format)
const pfxFilePath = path.join(__dirname, 'output.pfx');
// Convert the PKCS#12 certificate to binary format
const pfxDer = forge.asn1.toDer(pkcs12).getBytes();
// Write the PKCS#12 certificate to a file (PFX format)
fs.writeFileSync(pfxFilePath, pfxDer, { encoding: 'binary' });
console.log(`PKCS#12 certificate saved to ${pfxFilePath}`);
output.pfx looks like this only server certificate is present:
using latest node-forge 1.3.1
- Ngôn ngữ chính
- JavaScript
- Star
- 5.4k
- Fork
- 875
- Merge trung bình
- 3 phút
- Pull request đã merge (30 ngày)
- 6
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của digitalbazaar/forge
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
digitalbazaar/forge#1170 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 52/100
digitalbazaar/forge#1147 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
digitalbazaar/forge#1146 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 58/100
digitalbazaar/forge#1145 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 48/100
digitalbazaar/forge#1144 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của digitalbazaar/forge
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
githubnext/gh-aw-workshop#5522 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Dayset/ps2-elite-kd#119 ·
-
Add: Hindi Hits LogoĐang mởcheck:passed logos:add
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
area:models enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
scout
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
oskarrough/agent-ide#43 ·