diff options
author | James Walker <walkah@walkah.net> | 2010-03-12 21:44:18 -0500 |
---|---|---|
committer | James Walker <walkah@walkah.net> | 2010-03-12 21:44:18 -0500 |
commit | 135c0c8a7fa56a6d4008f73314bb6f18551e869a (patch) | |
tree | 58be1795cd96eabb2084fceadca6ef5ec38c82b1 /plugins/OStatus/classes | |
parent | 4e44cf906bb4fc884f645388c2c90ca1bad9a88f (diff) |
cleaning up key generation
Diffstat (limited to 'plugins/OStatus/classes')
-rw-r--r-- | plugins/OStatus/classes/Magicsig.php | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index 82b6017de..73690965f 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -40,8 +40,8 @@ class Magicsig extends Memcached_DataObject public $keypair; public $alg; - private $publicKey; - private $privateKey; + public $publicKey; + public $privateKey; public function __construct($alg = 'RSA-SHA256') { @@ -100,18 +100,19 @@ class Magicsig extends Memcached_DataObject return parent::insert(); } - public function generate($user_id, $key_length = 512) + public function generate($user_id) { $rsa = new Crypt_RSA(); + + $keypair = $rsa->createKey(); - extract($rsa->createKey()); - - $rsa->loadKey($privatekey); + $rsa->loadKey($keypair['privatekey']); - $this->privateKey = $rsa; + $this->privateKey = new Crypt_RSA(); + $this->privateKey->loadKey($keypair['privatekey']); $this->publicKey = new Crypt_RSA(); - $this->publicKey->loadKey($publickey); + $this->publicKey->loadKey($keypair['publickey']); $this->user_id = $user_id; $this->insert(); @@ -186,7 +187,7 @@ class Magicsig extends Memcached_DataObject switch ($this->alg) { case 'RSA-SHA256': - return 'magicsig_sha256'; + return 'sha256'; } } |