aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-02-01 22:45:46 -0800
committerFriendika <info@friendika.com>2011-02-01 22:45:46 -0800
commitfce9988f73ee8ad3624586e6866a68a2ae952ef8 (patch)
tree7cb90bfaefdbc5e4edb1affc09954e0f012cdfa0 /include
parenta347d040f0307650a01c71c06b5f490179421ba1 (diff)
downloadvolse-hubzilla-fce9988f73ee8ad3624586e6866a68a2ae952ef8.tar.gz
volse-hubzilla-fce9988f73ee8ad3624586e6866a68a2ae952ef8.tar.bz2
volse-hubzilla-fce9988f73ee8ad3624586e6866a68a2ae952ef8.zip
backward compatibility
Diffstat (limited to 'include')
-rw-r--r--include/items.php41
1 files changed, 19 insertions, 22 deletions
diff --git a/include/items.php b/include/items.php
index f909fde6a..0c9d54a33 100644
--- a/include/items.php
+++ b/include/items.php
@@ -813,28 +813,16 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$final_dfrn_id = '';
- if($dfrn_version > 2.1) {
- if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
- openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
- openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
- }
- else {
- openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
- openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
- }
+
+ if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+ openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
+ openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
}
else {
- if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
- openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
- openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
- }
- else {
- openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
- openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
- }
+ openssl_private_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['prvkey']);
+ openssl_private_decrypt($challenge,$postvars['challenge'],$contact['prvkey']);
}
-
$final_dfrn_id = substr($final_dfrn_id, 0, strpos($final_dfrn_id, '.'));
if(strpos($final_dfrn_id,':') == 1)
@@ -868,12 +856,21 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
logger('rino: sent key = ' . $key);
-
- if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
- openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+ if($dfrn_version >= 2.1) {
+ if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+ openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+ }
+ else {
+ openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+ }
}
else {
- openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+ if(($contact['duplex'] && strlen($contact['prvkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
+ openssl_private_encrypt($key,$postvars['key'],$contact['prvkey']);
+ }
+ else {
+ openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
+ }
}
logger('md5 rawkey ' . md5($postvars['key']));