$pub_key = trim($importer['cpubkey']);
$dplx = intval($importer['duplex']);
- if (!empty($prv_key) && empty($pub_key)) {
+ if (($dplx && strlen($prv_key)) || (strlen($prv_key) && !strlen($pub_key))) {
openssl_private_encrypt($hash, $challenge, $prv_key);
openssl_private_encrypt($id_str, $encrypted_id, $prv_key);
} elseif (strlen($pub_key)) {
}
}
- if (empty($contact['prvkey']) && !empty($contact['pubkey'])) {
+ if (($contact['duplex'] && strlen($contact['pubkey']))
+ || ($owner['page-flags'] == Contact::PAGE_COMMUNITY && strlen($contact['pubkey']))
+ || ($contact['rel'] == Contact::SHARING && strlen($contact['pubkey']))
+ ) {
openssl_public_decrypt($sent_dfrn_id, $final_dfrn_id, $contact['pubkey']);
openssl_public_decrypt($challenge, $postvars['challenge'], $contact['pubkey']);
} else {