]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
converting key generation to new crypt library
authorJames Walker <walkah@walkah.net>
Sat, 13 Mar 2010 01:02:00 +0000 (20:02 -0500)
committerJames Walker <walkah@walkah.net>
Sat, 13 Mar 2010 01:02:00 +0000 (20:02 -0500)
plugins/OStatus/classes/Magicsig.php

index d1d6a6d4529d81de5229f1d3cfe13df4f12ea3e4..82b6017ded04a5e0cc7fb8f0d477a25e5a8bc842 100644 (file)
@@ -102,7 +102,17 @@ class Magicsig extends Memcached_DataObject
 
     public function generate($user_id, $key_length = 512)
     {
-        // @fixme new key generation
+        $rsa = new Crypt_RSA();
+
+        extract($rsa->createKey());
+
+        $rsa->loadKey($privatekey);
+
+        $this->privateKey = $rsa;
+
+        $this->publicKey = new Crypt_RSA();
+        $this->publicKey->loadKey($publickey);
+        
         $this->user_id = $user_id;
         $this->insert();
     }
@@ -113,7 +123,7 @@ class Magicsig extends Memcached_DataObject
         $mod = base64_url_encode($this->publicKey->modulus->toBytes());
         $exp = base64_url_encode($this->publicKey->exponent->toBytes());
         $private_exp = '';
-        if ($full_pair && $private_key->getExponent()) {
+        if ($full_pair && $this->privateKey->exponent->toBytes()) {
             $private_exp = '.' . base64_url_encode($this->privateKey->exponent->toBytes());
         }