Skip to content

Commit

Permalink
Update _generate_signature method to use HMAC-SHA256
Browse files Browse the repository at this point in the history
  • Loading branch information
zgary committed Feb 15, 2023
1 parent f19865d commit 95b4929
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/auth/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
abort, current_app, flash, redirect, request, session, url_for
)
from flask_login import current_user, login_user, logout_user
from hashlib import sha1
from hashlib import sha256
from ldap3 import Connection, Server, Tls
from requests.exceptions import SSLError

Expand Down Expand Up @@ -684,10 +684,10 @@ def _generate_signature(password, string):
"""
signature = None
try:
hmac_sha1 = hmac.new(key=password.encode(),
msg=string.encode(),
digestmod=sha1)
signature = hmac_sha1.hexdigest()
hmac_sha256 = hmac.new(key=password.encode(),
msg=string.encode(),
digestmod=sha256)
signature = hmac_sha256.hexdigest()
except Exception as e:
sentry.captureException()
current_app.logger.error("Failed to generate NYC ID.Web Services "
Expand Down

0 comments on commit 95b4929

Please sign in to comment.