Skip to content

Commit

Permalink
crypto change subject alternate warnings to warning
Browse files Browse the repository at this point in the history
  • Loading branch information
schroeder- committed Jan 4, 2024
1 parent b9e2af4 commit 5d05e3b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions asyncua/crypto/uacrypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,14 +341,14 @@ def check_certificate(cert: x509.Certificate, application_uri: str, hostname: Op
san = cert.extensions.get_extension_for_class(x509.SubjectAlternativeName)
san_uri = san.value.get_values_for_type(x509.UniformResourceIdentifier)
if application_uri not in san_uri:
_logger.error(f'certificate does not contain the application uri ({application_uri}). Most applications will reject a connection without it.')
_logger.warning(f'certificate does not contain the application uri ({application_uri}). Most applications will reject a connection without it.')
err = True
if hostname is not None:
san_dns_names = san.value.get_values_for_type(x509.DNSName)
if hostname not in san_dns_names:
_logger.error(f'certificate does not contain the hostname in DNSNames {hostname}. Some applications will check this.')
_logger.warning(f'certificate does not contain the hostname in DNSNames {hostname}. Some applications will check this.')
err = True
except x509.ExtensionNotFound:
_logger.error('certificate has no SubjectAlternativeName this is need for application verification!')
_logger.warning('certificate has no SubjectAlternativeName this is need for application verification!')
err = True
return err

0 comments on commit 5d05e3b

Please sign in to comment.