@@ -901,7 +901,7 @@ export function verifySignature(options: {
901901
902902 const hashFn = ( md as unknown as HashFunctions ) [ hashOid ] . create ( )
903903 rval = options . certificate . publicKey . verify (
904- ( options . md as unknown as MD ) . digest ( ) . getBytes ( ) ,
904+ options . md . digest ( ) . getBytes ( ) ,
905905 options . signature ,
906906 { mgf, hash : hashFn , saltLength : params . saltLength || 20 } ,
907907 )
@@ -2742,11 +2742,10 @@ export function createCaStore(certs: Certificate[]): CAStore {
27422742 }
27432743 }
27442744 } ,
2745- hasCertificate ( cert ) {
2745+ hasCertificate ( cert : Certificate ) {
27462746 // convert from pem if necessary
2747- if ( typeof cert === 'string' ) {
2747+ if ( typeof cert === 'string' )
27482748 cert = pki . certificateFromPem ( cert )
2749- }
27502749
27512750 let match = getBySubject ( cert . subject )
27522751 if ( ! match )
@@ -2784,23 +2783,23 @@ export function createCaStore(certs: Certificate[]): CAStore {
27842783
27852784 return certList
27862785 } ,
2787- removeCertificate ( cert ) {
2786+ removeCertificate ( cert : Certificate ) {
27882787 let result
27892788
27902789 // convert from pem if necessary
2791- if ( typeof cert === 'string' ) {
2790+ if ( typeof cert === 'string' )
27922791 cert = certificateFromPem ( cert )
2793- }
2792+
27942793 ensureSubjectHasHash ( cert . subject )
2795- if ( ! caStore . hasCertificate ( cert ) ) {
2794+ if ( ! caStore . hasCertificate ( cert ) )
27962795 return null
2797- }
27982796
27992797 const match = getBySubject ( cert . subject )
28002798
28012799 if ( ! Array . isArray ( match ) ) {
28022800 result = caStore . certs [ cert . subject . hash ]
28032801 delete caStore . certs [ cert . subject . hash ]
2802+
28042803 return result
28052804 }
28062805
@@ -2813,16 +2812,17 @@ export function createCaStore(certs: Certificate[]): CAStore {
28132812 match . splice ( i , 1 )
28142813 }
28152814 }
2816- if ( match . length === 0 ) {
2815+
2816+ if ( match . length === 0 )
28172817 delete caStore . certs [ cert . subject . hash ]
2818- }
28192818
28202819 return result
28212820 } ,
28222821 }
28232822
28242823 function getBySubject ( subject : { hash : string | null } ) {
28252824 ensureSubjectHasHash ( subject )
2825+
28262826 return caStore . certs [ subject . hash || '' ] || null
28272827 }
28282828
@@ -2942,11 +2942,11 @@ export function verifyCertificateChain(
29422942 }
29432943 }
29442944 }
2945- catch ( ex ) {
2945+ catch ( e : any ) {
29462946 error = {
29472947 message : 'Certificate signature is invalid.' ,
29482948 error : 'pki.BadCertificate' ,
2949- details : ex . toString ( ) ,
2949+ details : e . toString ( ) ,
29502950 }
29512951 }
29522952 }
@@ -3020,15 +3020,16 @@ export function verifyCertificateChain(
30203020function _containsAll ( iattr : RDNAttribute [ ] , sattr : RDNAttribute [ ] ) : boolean {
30213021 // ensure all parent subject attributes are present in issuer
30223022 let rval = true
3023+
30233024 for ( let i = 0 ; rval && i < sattr . length ; ++ i ) {
30243025 const attr = sattr [ i ]
30253026 rval = false
30263027 for ( let j = 0 ; ! rval && j < iattr . length ; ++ j ) {
3027- if ( attr . type === iattr [ j ] . type && attr . value === iattr [ j ] . value ) {
3028+ if ( attr . type === iattr [ j ] . type && attr . value === iattr [ j ] . value )
30283029 rval = true
3029- }
30303030 }
30313031 }
3032+
30323033 return rval
30333034}
30343035
0 commit comments