def csr_matches_pubkey(csr, privkey):
 req = OpenSSL.crypto.load_certificate_request(OpenSSL.crypto.FILETYPE_PEM, csr)
 pkey = OpenSSL.crypto.load_privatekey(OpenSSL.crypto.FILETYPE_PEM, privkey)
 try:
  return req.verify(pkey)
 except OpenSSL.crypto.Error as error:
  logger.debug(error, exc_info=True)
  return False

def csr_matches_pubkey ( csr , privkey ) : req = OpenSSL . crypto . load_certificate_request ( OpenSSL . crypto . FILETYPE_PEM , csr ) pkey = OpenSSL . crypto . load_privatekey ( OpenSSL . crypto . FILETYPE_PEM , privkey ) try : return req . verify ( pkey ) except OpenSSL . crypto . Error as error : logger . debug ( error , exc_info = True ) return False
does private key correspond to the subject public key in the csr? .