Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha Silbe <sascha-pgp@silbe.org>2010-03-09 23:34:59 (GMT)
committer Sascha Silbe <sascha-pgp@silbe.org>2010-03-09 23:34:59 (GMT)
commitbb323a4efa266ca3285970ad0256e731688ee56c (patch)
tree9ba1d16bfa1f7e2e52e60876bc77ff81ab4b94af
parentd38d865c7c0cb0a909f5549d109ec21afbab064c (diff)
check syntax of private key (#1568)
Check that header and footer of the private key are present in order to detect corrupted key files. Signed-off-by: Sascha Silbe <sascha-pgp@silbe.org>
-rw-r--r--src/sugar/profile.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/sugar/profile.py b/src/sugar/profile.py
index 3ea1e67..3f93bba 100644
--- a/src/sugar/profile.py
+++ b/src/sugar/profile.py
@@ -105,14 +105,18 @@ class Profile(object):
return None
key = ""
+ begin_found = False
+ end_found = False
for l in lines:
l = l.strip()
if l.startswith("-----BEGIN DSA PRIVATE KEY-----"):
+ begin_found = True
continue
if l.startswith("-----END DSA PRIVATE KEY-----"):
+ end_found = True
continue
key += l
- if not len(key):
+ if not (len(key) and begin_found and end_found):
logging.error("Error parsing public key.")
return None