summaryrefslogtreecommitdiff
path: root/backend
Unidiff
Diffstat (limited to 'backend') (more/less context) (ignore whitespace changes)
-rw-r--r--backend/python/src/clipperz.py19
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
27import os 24import os
28import cgi 25import cgi
29import wsgiref.handlers 26import wsgiref.handlers
30 27
31import datetime 28import datetime
32import uuid 29import uuid
33import random 30import random
34import hashlib 31import hashlib
35 32
36import logging 33import logging
37 34
38from google.appengine.api import users 35from google.appengine.api import users
39from google.appengine.ext import webapp 36from google.appengine.ext import webapp
40from google.appengine.ext import db 37from google.appengine.ext import db
41from google.appengine.ext.webapp import template 38from google.appengine.ext.webapp import template
42 39
43from django.utils import simplejson 40from django.utils import simplejson
44 41
45#============================================================================== 42#==============================================================================
46 43
47sessionTimeout = datetime.timedelta(minutes=-2) 44sessionTimeout = datetime.timedelta(minutes=-2)
48 45
49def randomSeed(): 46def randomSeed():
50 return hex(random.getrandbits(32*8))[2:-1] 47 return hex(random.getrandbits(32*8))[2:-1]
51 48
52def clipperzHash(aString): 49def 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
65class User(db.Model): 62class 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()