[Sugar-devel] [PATCH 1/2 sugar-toolkit] Accept RSA key as owner key

Sascha Silbe silbe at activitycentral.com
Tue Nov 15 07:35:58 EST 2011


Sugar currently uses the owner key as an opaque string, not as an actual key.
This means the key type doesn't matter, we can just as easily use an RSA key.

Signed-off-by: Sascha Silbe <silbe at activitycentral.com>
---
 src/sugar/profile.py |   10 ++++++----
 1 files changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/sugar/profile.py b/src/sugar/profile.py
index c1dffd7..a38b908 100644
--- a/src/sugar/profile.py
+++ b/src/sugar/profile.py
@@ -91,12 +91,12 @@ class Profile(object):
             logging.exception('Error reading public key')
             return None
 
-        magic = 'ssh-dss '
+        magic = ('ssh-dss ', 'ssh-rsa ')
         for l in lines:
             l = l.strip()
             if not l.startswith(magic):
                 continue
-            return l[len(magic):]
+            return l[len(magic[0]):]
         else:
             logging.error('Error parsing public key.')
             return None
@@ -120,10 +120,12 @@ class Profile(object):
         end_found = False
         for l in lines:
             l = l.strip()
-            if l.startswith('-----BEGIN DSA PRIVATE KEY-----'):
+            if l.startswith(('-----BEGIN DSA PRIVATE KEY-----',
+                             '-----BEGIN RSA PRIVATE KEY-----')):
                 begin_found = True
                 continue
-            if l.startswith('-----END DSA PRIVATE KEY-----'):
+            if l.startswith(('-----END DSA PRIVATE KEY-----',
+                             '-----END RSA PRIVATE KEY-----')):
                 end_found = True
                 continue
             key += l
-- 
1.7.7.1



More information about the Sugar-devel mailing list