pairing qr
This commit is contained in:
@@ -12,13 +12,28 @@ const certPath = path.join(certsDir, 'cert.pem');
|
||||
|
||||
fs.mkdirSync(certsDir, { recursive: true });
|
||||
|
||||
// ECDSA P-256 keeps pairing QR codes much smaller than RSA-2048
|
||||
const subject = '/CN=localhost/O=JTL POS Sync/C=DE';
|
||||
const san = 'subjectAltName=DNS:localhost,IP:127.0.0.1,IP:0.0.0.0';
|
||||
|
||||
execSync(
|
||||
`openssl req -x509 -newkey rsa:2048 -nodes -keyout "${keyPath}" -out "${certPath}" -days 3650 -subj "${subject}" -addext "${san}"`,
|
||||
`openssl req -x509 -newkey ec -pkeyopt ec_paramgen_curve:P-256 -nodes -keyout "${keyPath}" -out "${certPath}" -days 3650 -subj "${subject}" -addext "${san}"`,
|
||||
{ stdio: 'inherit' }
|
||||
);
|
||||
|
||||
const sha1 = execSync(`openssl x509 -in "${certPath}" -noout -fingerprint -sha1`, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
.trim()
|
||||
.split('=')[1];
|
||||
const serial = execSync(`openssl x509 -in "${certPath}" -noout -serial`, {
|
||||
encoding: 'utf8',
|
||||
})
|
||||
.trim()
|
||||
.split('=')[1];
|
||||
|
||||
logger.success(`Wrote ${keyPath}`);
|
||||
logger.success(`Wrote ${certPath}`);
|
||||
logger.info(`CERTIFICATE_FINGERPRINT=${sha1.replace(/:/g, '')}`);
|
||||
logger.info(`CERTIFICATE_SERIAL_NUMBER=${serial}`);
|
||||
logger.info(`SERVER_FINGERPRINT=${sha1.replace(/:/g, '-')}`);
|
||||
|
||||
Reference in New Issue
Block a user