diff options
author | fabrixxm <fabrix.xm@gmail.com> | 2011-02-03 07:24:58 +0100 |
---|---|---|
committer | fabrixxm <fabrix.xm@gmail.com> | 2011-02-03 07:24:58 +0100 |
commit | 97bb80c00f4106d63d730f6bcaebf9e4aa247c01 (patch) | |
tree | 43bfb9aa3f85c3b7c2ec19ad72fece95f745ce4d /mod/dfrn_notify.php | |
parent | a3fd84661f74b0759f9edad1f068b32820b03c5d (diff) | |
parent | 0a32370e32b068073010d1d6b33241867c3be4d7 (diff) | |
download | volse-hubzilla-97bb80c00f4106d63d730f6bcaebf9e4aa247c01.tar.gz volse-hubzilla-97bb80c00f4106d63d730f6bcaebf9e4aa247c01.tar.bz2 volse-hubzilla-97bb80c00f4106d63d730f6bcaebf9e4aa247c01.zip |
Merge branch 'friendika-master'
Diffstat (limited to 'mod/dfrn_notify.php')
-rw-r--r-- | mod/dfrn_notify.php | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/mod/dfrn_notify.php b/mod/dfrn_notify.php index f904b06bc..cad7f9563 100644 --- a/mod/dfrn_notify.php +++ b/mod/dfrn_notify.php @@ -52,8 +52,6 @@ function dfrn_notify_post(&$a) { } - - $r = q("SELECT `contact`.*, `contact`.`uid` AS `importer_uid`, `contact`.`pubkey` AS `cpubkey`, `contact`.`prvkey` AS `cprvkey`, `user`.* FROM `contact` LEFT JOIN `user` ON `contact`.`uid` = `user`.`uid` @@ -93,11 +91,21 @@ function dfrn_notify_post(&$a) { logger('rino: md5 raw key: ' . md5($rawkey)); $final_key = ''; - if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) { - openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']); + if($dfrn_version >= 2.1) { + if((($importer['duplex']) && strlen($importer['cprvkey'])) || (! strlen($importer['cpubkey']))) { + openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); + } + else { + openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']); + } } else { - openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); + if((($importer['duplex']) && strlen($importer['cpubkey'])) || (! strlen($importer['cprvkey']))) { + openssl_public_decrypt($rawkey,$final_key,$importer['cpubkey']); + } + else { + openssl_private_decrypt($rawkey,$final_key,$importer['cprvkey']); + } } logger('rino: received key : ' . $final_key); @@ -498,14 +506,14 @@ function dfrn_notify_content(&$a) { $encrypted_id = ''; $id_str = $my_id . '.' . mt_rand(1000,9999); - if((($r[0]['duplex']) && strlen($r[0]['pubkey'])) || (! strlen($r[0]['prvkey']))) { - openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']); - openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']); - } - else { + if((($r[0]['duplex']) && strlen($r[0]['prvkey'])) || (! strlen($r[0]['pubkey']))) { openssl_private_encrypt($hash,$challenge,$r[0]['prvkey']); openssl_private_encrypt($id_str,$encrypted_id,$r[0]['prvkey']); } + else { + openssl_public_encrypt($hash,$challenge,$r[0]['pubkey']); + openssl_public_encrypt($id_str,$encrypted_id,$r[0]['pubkey']); + } $challenge = bin2hex($challenge); $encrypted_id = bin2hex($encrypted_id); |