File tree 2 files changed +0
-16
lines changed
2 files changed +0
-16
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ import { Crypto } from '@peculiar/webcrypto'
13
13
import * as x509 from '@peculiar/x509'
14
14
import { KeyObject , createPublicKey } from 'crypto'
15
15
import { doPublicKeysMatch , pemToPublicKey } from './keyManagement'
16
- import { randomSerialNumber } from './utils'
17
16
18
17
const crypto = new Crypto ( )
19
18
x509 . cryptoProvider . set ( crypto )
@@ -67,10 +66,6 @@ export class CertificateManager {
67
66
return new x509 . Name ( [ [ commonNameAttr ] ] )
68
67
}
69
68
70
- // protected static toCommonName(subjectName: string): JsonName {
71
- // return [{ '2.5.4.3': [subjectName] }] // OID for commonName
72
- // }
73
-
74
69
static prettyPrintCertificate ( cert : x509 . X509Certificate ) : void {
75
70
console . log ( 'Certificate:' )
76
71
console . log ( '============' )
@@ -241,7 +236,6 @@ export class CertificateManager {
241
236
notAfter . setDate ( notBefore . getDate ( ) + validityPeriodDays )
242
237
243
238
let certificateBuilder = await x509 . X509CertificateGenerator . create ( {
244
- serialNumber : randomSerialNumber ( ) . toString ( ) ,
245
239
issuer : csr . subject ,
246
240
subject : csr . subject ,
247
241
notBefore,
Original file line number Diff line number Diff line change @@ -23,16 +23,6 @@ export function derEncodeSignatureAlgorithmOID(oid: string): Uint8Array {
23
23
return new Uint8Array ( [ ...sequenceHeader , ...new Uint8Array ( berArrayBuffer ) , ...nullParameter ] )
24
24
}
25
25
26
- export function randomSerialNumber ( ) : bigint {
27
- // Generate 20 random bytes
28
- const bytes = randomBytes ( 20 )
29
- // Convert bytes to a BigInt
30
- let serial = BigInt ( '0x' + bytes . toString ( 'hex' ) )
31
- // Shift right by 1 to ensure the number is positive
32
- serial = serial >> BigInt ( 1 )
33
- return serial
34
- }
35
-
36
26
export function addDaysToCurrentDate ( days : number ) : Date {
37
27
const currentDate = new Date ( ) // This gives you the current date and time
38
28
currentDate . setUTCDate ( currentDate . getUTCDate ( ) + days ) // Adds the specified number of days
You can’t perform that action at this time.
0 commit comments