diff options
author | James Walker <walkah@walkah.net> | 2010-03-12 20:02:00 -0500 |
---|---|---|
committer | James Walker <walkah@walkah.net> | 2010-03-12 20:02:00 -0500 |
commit | 4e44cf906bb4fc884f645388c2c90ca1bad9a88f (patch) | |
tree | f8271b1afb11a4b66db5112982c0c1e81506c79c /plugins | |
parent | 520faaf67d7bd7bb0a87322d3f2e244c22d0c994 (diff) |
converting key generation to new crypt library
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/OStatus/classes/Magicsig.php | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/plugins/OStatus/classes/Magicsig.php b/plugins/OStatus/classes/Magicsig.php index d1d6a6d45..82b6017de 100644 --- a/plugins/OStatus/classes/Magicsig.php +++ b/plugins/OStatus/classes/Magicsig.php @@ -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()); } |