-rw-r--r-- | backend/python/src/clipperz.py | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/backend/python/src/clipperz.py b/backend/python/src/clipperz.py index c8d91de..bd5d030 100644 --- a/backend/python/src/clipperz.py +++ b/backend/python/src/clipperz.py | |||
@@ -1,73 +1,70 @@ | |||
1 | # | 1 | # |
2 | #Copyright 2008-2011 Clipperz Srl | 2 | #Copyright 2008-2011 Clipperz Srl |
3 | # | 3 | # |
4 | #This file is part of Clipperz's Javascript Crypto Library. | 4 | #This file is part of Clipperz Community Edition. |
5 | #Javascript Crypto Library provides web developers with an extensive | 5 | #Clipperz Community Edition is an online password manager. |
6 | #and efficient set of cryptographic functions. The library aims to | ||
7 | #obtain maximum execution speed while preserving modularity and | ||
8 | #reusability. | ||
9 | #For further information about its features and functionalities please | 6 | #For further information about its features and functionalities please |
10 | #refer to http://www.clipperz.com | 7 | #refer to http://www.clipperz.com. |
11 | # | 8 | # |
12 | #* Javascript Crypto Library is free software: you can redistribute | 9 | #* Clipperz Community Edition is free software: you can redistribute |
13 | # it and/or modify it under the terms of the GNU Affero General Public | 10 | # it and/or modify it under the terms of the GNU Affero General Public |
14 | # License as published by the Free Software Foundation, either version | 11 | # License as published by the Free Software Foundation, either version |
15 | # 3 of the License, or (at your option) any later version. | 12 | # 3 of the License, or (at your option) any later version. |
16 | # | 13 | # |
17 | #* Javascript Crypto Library is distributed in the hope that it will | 14 | #* Clipperz Community Edition is distributed in the hope that it will |
18 | # be useful, but WITHOUT ANY WARRANTY; without even the implied | 15 | # be useful, but WITHOUT ANY WARRANTY; without even the implied |
19 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | 16 | # warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
20 | # See the GNU Affero General Public License for more details. | 17 | # See the GNU Affero General Public License for more details. |
21 | # | 18 | # |
22 | #* You should have received a copy of the GNU Affero General Public | 19 | #* You should have received a copy of the GNU Affero General Public |
23 | # License along with Javascript Crypto Library. If not, see | 20 | # License along with Clipperz Community Edition. If not, see |
24 | # <http://www.gnu.org/licenses/>. | 21 | # <http://www.gnu.org/licenses/>. |
25 | # | 22 | # |
26 | 23 | ||
27 | import os | 24 | import os |
28 | import cgi | 25 | import cgi |
29 | import wsgiref.handlers | 26 | import wsgiref.handlers |
30 | 27 | ||
31 | import datetime | 28 | import datetime |
32 | import uuid | 29 | import uuid |
33 | import random | 30 | import random |
34 | import hashlib | 31 | import hashlib |
35 | 32 | ||
36 | import logging | 33 | import logging |
37 | 34 | ||
38 | from google.appengine.api import users | 35 | from google.appengine.api import users |
39 | from google.appengine.ext import webapp | 36 | from google.appengine.ext import webapp |
40 | from google.appengine.ext import db | 37 | from google.appengine.ext import db |
41 | from google.appengine.ext.webapp import template | 38 | from google.appengine.ext.webapp import template |
42 | 39 | ||
43 | from django.utils import simplejson | 40 | from django.utils import simplejson |
44 | 41 | ||
45 | #============================================================================== | 42 | #============================================================================== |
46 | 43 | ||
47 | sessionTimeout = datetime.timedelta(minutes=-2) | 44 | sessionTimeout = datetime.timedelta(minutes=-2) |
48 | 45 | ||
49 | def randomSeed(): | 46 | def randomSeed(): |
50 | return hex(random.getrandbits(32*8))[2:-1] | 47 | return hex(random.getrandbits(32*8))[2:-1] |
51 | 48 | ||
52 | def clipperzHash(aString): | 49 | def clipperzHash(aString): |
53 | #logging.info(">>> string: " + aString) | 50 | #logging.info(">>> string: " + aString) |
54 | firstRound = hashlib.sha256() | 51 | firstRound = hashlib.sha256() |
55 | firstRound.update(aString) | 52 | firstRound.update(aString) |
56 | #logging.info("firstRound: " + firstRound.hexdigest() + " - " + firstRound.digest()) | 53 | #logging.info("firstRound: " + firstRound.hexdigest() + " - " + firstRound.digest()) |
57 | result = hashlib.sha256() | 54 | result = hashlib.sha256() |
58 | result.update(firstRound.digest()) | 55 | result.update(firstRound.digest()) |
59 | #logging.info("<<< finalResul: " + result.hexdigest()) | 56 | #logging.info("<<< finalResul: " + result.hexdigest()) |
60 | 57 | ||
61 | return result.hexdigest() | 58 | return result.hexdigest() |
62 | 59 | ||
63 | #============================================================================== | 60 | #============================================================================== |
64 | 61 | ||
65 | class User(db.Model): | 62 | class User(db.Model): |
66 | username= db.StringProperty() | 63 | username= db.StringProperty() |
67 | srp_s = db.StringProperty() | 64 | srp_s = db.StringProperty() |
68 | srp_v = db.StringProperty() | 65 | srp_v = db.StringProperty() |
69 | header = db.TextProperty() | 66 | header = db.TextProperty() |
70 | statistics= db.TextProperty() | 67 | statistics= db.TextProperty() |
71 | auth_version= db.StringProperty() | 68 | auth_version= db.StringProperty() |
72 | version = db.StringProperty() | 69 | version = db.StringProperty() |
73 | lock = db.StringProperty() | 70 | lock = db.StringProperty() |