From b6bc1ad234aa6e6472e81c422d51b914c5f7b2f5 Mon Sep 17 00:00:00 2001 From: Yang Yang Date: Fri, 26 Jun 2020 19:58:21 +0800 Subject: [PATCH] feat: generate 2048-bit tls certs --- lib/grpc/GrpcServer.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/grpc/GrpcServer.ts b/lib/grpc/GrpcServer.ts index 5d4034b3a..fde808315 100644 --- a/lib/grpc/GrpcServer.ts +++ b/lib/grpc/GrpcServer.ts @@ -104,11 +104,11 @@ class GrpcServer { * @returns the cerificate and its private key */ private generateCertificate = async (tlsCertPath: string, tlsKeyPath: string): Promise<{ tlsCert: string, tlsKey: string }> => { - const keys = pki.rsa.generateKeyPair(1024); + const keys = pki.rsa.generateKeyPair(2048); const cert = pki.createCertificate(); cert.publicKey = keys.publicKey; - cert.serialNumber = String(Math.floor(Math.random() * 1024) + 1); + cert.serialNumber = `2048-${String(Math.floor(Math.random() * 100000000))}`; // TODO: handle expired certificates const date = new Date();