Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(235)

Unified Diff: third_party/tlslite/tlslite/sharedkeydb.py

Issue 210323002: Update tlslite to 0.4.6. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Executable bit and --similarity=80 Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/tlslite/tlslite/sessioncache.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/tlslite/tlslite/sharedkeydb.py
diff --git a/third_party/tlslite/tlslite/sharedkeydb.py b/third_party/tlslite/tlslite/sharedkeydb.py
deleted file mode 100644
index 97b31a505e82f654fc0d8b150e68450641322f5c..0000000000000000000000000000000000000000
--- a/third_party/tlslite/tlslite/sharedkeydb.py
+++ /dev/null
@@ -1,58 +0,0 @@
-"""Class for storing shared keys."""
-
-from utils.cryptomath import *
-from utils.compat import *
-from mathtls import *
-from session import Session
-from basedb import BaseDB
-
-class SharedKeyDB(BaseDB):
- """This class represent an in-memory or on-disk database of shared
- keys.
-
- A SharedKeyDB can be passed to a server handshake function to
- authenticate a client based on one of the shared keys.
-
- This class is thread-safe.
- """
-
- def __init__(self, filename=None):
- """Create a new SharedKeyDB.
-
- @type filename: str
- @param filename: Filename for an on-disk database, or None for
- an in-memory database. If the filename already exists, follow
- this with a call to open(). To create a new on-disk database,
- follow this with a call to create().
- """
- BaseDB.__init__(self, filename, "shared key")
-
- def _getItem(self, username, valueStr):
- session = Session()
- session._createSharedKey(username, valueStr)
- return session
-
- def __setitem__(self, username, sharedKey):
- """Add a shared key to the database.
-
- @type username: str
- @param username: The username to associate the shared key with.
- Must be less than or equal to 16 characters in length, and must
- not already be in the database.
-
- @type sharedKey: str
- @param sharedKey: The shared key to add. Must be less than 48
- characters in length.
- """
- BaseDB.__setitem__(self, username, sharedKey)
-
- def _setItem(self, username, value):
- if len(username)>16:
- raise ValueError("username too long")
- if len(value)>=48:
- raise ValueError("shared key too long")
- return value
-
- def _checkItem(self, value, username, param):
- newSession = self._getItem(username, param)
- return value.masterSecret == newSession.masterSecret
« no previous file with comments | « third_party/tlslite/tlslite/sessioncache.py ('k') | third_party/tlslite/tlslite/tlsconnection.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698