Skip to content

Commit

Permalink
Merge pull request #72 from oalbrigt/FIPS
Browse files Browse the repository at this point in the history
Use usedforsecurity=False for md5() calls to make suds work on FIPS enabled systems
  • Loading branch information
phillbaker authored Apr 3, 2022
2 parents 92e7135 + 9bdefda commit 9008e3d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion suds/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,12 @@ def mangle(self, name, x):
@rtype: str
"""
h = md5(name.encode()).hexdigest()
try:
# FIPS requires usedforsecurity=False and might not be
# available on all distros: https://bugs.python.org/issue9216
h = md5(name.encode(), usedforsecurity=False).hexdigest()
except (AttributeError, TypeError):
h = md5(name.encode()).hexdigest()
return '%s-%s' % (h, x)


Expand Down
7 changes: 6 additions & 1 deletion suds/wsse.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ def setnonce(self, text=None):
s.append(self.username)
s.append(self.password)
s.append(Token.sysdate())
m = md5()
try:
# FIPS requires usedforsecurity=False and might not be
# available on all distros: https://bugs.python.org/issue9216
m = md5(usedforsecurity=False)
except (AttributeError, TypeError):
m = md5()
m.update(':'.join(s).encode('utf-8'))
self.nonce = m.hexdigest()
else:
Expand Down

0 comments on commit 9008e3d

Please sign in to comment.