Skip to content

Commit

Permalink
promote HandshakeSettings._filter() to public
Browse files Browse the repository at this point in the history
since the _filter is used outside its class, it should be
a public method. The `filter` is a reserved word though, so
rename the method to `validate()`.
  • Loading branch information
tomato42 committed Mar 24, 2015
1 parent 02c41b8 commit 51b5bce
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 9 additions & 3 deletions tlslite/handshakesettings.py
Expand Up @@ -111,9 +111,15 @@ def __init__(self):
self.useExperimentalTackExtension = False
self.sendFallbackSCSV = False

# Validates the min/max fields, and certificateTypes
# Filters out unsupported cipherNames and cipherImplementations
def _filter(self):
def validate(self):
"""
Validate the settings, filter out unsupported ciphersuites and return
a copy of object. Does not modify the original object.
@rtype: HandshakeSettings
@return: a self-consistent copy of settings
@raise ValueError: when settings are invalid, insecure or unsupported.
"""
other = HandshakeSettings()
other.minKeySize = self.minKeySize
other.maxKeySize = self.maxKeySize
Expand Down
4 changes: 2 additions & 2 deletions tlslite/tlsconnection.py
Expand Up @@ -370,7 +370,7 @@ def _handshakeClientAsyncHelper(self, srpParams, certParams, anonParams,
# or crypto libraries that were requested
if not settings:
settings = HandshakeSettings()
settings = settings._filter()
settings = settings.validate()

if clientCertChain:
if not isinstance(clientCertChain, X509CertChain):
Expand Down Expand Up @@ -1116,7 +1116,7 @@ def _handshakeServerAsyncHelper(self, verifierDB,

if not settings:
settings = HandshakeSettings()
settings = settings._filter()
settings = settings.validate()

# OK Start exchanging messages
# ******************************
Expand Down

0 comments on commit 51b5bce

Please sign in to comment.