File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 402402 pem , signature = server_cert :pem (), server_cert :getsignaturename ()
403403 end
404404 signature = signature :lower ()
405- local _ , with_sig
406- _ , _ , with_sig = signature :find (" %-with%-(.*)" )
407- if with_sig then
408- signature = with_sig
409- end
410405 if signature :match (" ^md5" ) or signature :match (" ^sha1" ) or signature :match (" sha1$" ) then
411406 signature = " sha256"
407+ else
408+ local objects = require (" resty.openssl.objects" )
409+ local sigid = assert (objects .txt2nid (signature ))
410+ local digest_nid = assert (objects .find_sigid_algs (sigid ))
411+ signature = assert (objects .nid2table (digest_nid ).sn )
412412 end
413413 cbind_data = assert (x509_digest (pem , signature ))
414414 end
Original file line number Diff line number Diff line change @@ -406,14 +406,14 @@ class Postgres
406406
407407 signature = signature\ lower!
408408
409- -- Handle the case when the signature is e.g. ECDSA-with-SHA384
410- _, _, with_sig = signature\ find( " %-with%-(.*)" )
411- if with_sig
412- signature = with_sig
413-
414409 -- upgrade the signature if necessary (also handle the case of s/RSA-SHA1/sha256)
415410 if signature\ match( " ^md5" ) or signature\ match( " ^sha1" ) or signature\ match( " sha1$" )
416411 signature = " sha256"
412+ else
413+ objects = require " resty.openssl.objects"
414+ sigid = assert objects. txt2nid( signature)
415+ digest_nid = assert objects. find_sigid_algs( sigid)
416+ signature = assert objects. nid2table( digest_nid) . sn
417417
418418 assert x509_digest( pem, signature)
419419
You can’t perform that action at this time.
0 commit comments