aboutsummaryrefslogtreecommitdiffstats
path: root/include/message.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-05-19 02:16:12 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-05-19 02:16:12 -0700
commit77e2ef45f05b8106ebe5400f8931c6e54ec6341b (patch)
treeb6f0fa5b6a176162bab0a12041c614f4b7d10aa7 /include/message.php
parentc11b1f8b0dc1a1a9788be2d0a2efc16ef13bb849 (diff)
downloadvolse-hubzilla-77e2ef45f05b8106ebe5400f8931c6e54ec6341b.tar.gz
volse-hubzilla-77e2ef45f05b8106ebe5400f8931c6e54ec6341b.tar.bz2
volse-hubzilla-77e2ef45f05b8106ebe5400f8931c6e54ec6341b.zip
mail_obscure - AES-256 is way too slow, simplify. Ideally a substitution cipher would be adequate for our requirements.
Diffstat (limited to 'include/message.php')
-rw-r--r--include/message.php22
1 files changed, 10 insertions, 12 deletions
diff --git a/include/message.php b/include/message.php
index bfc92cd6d..82c48ba85 100644
--- a/include/message.php
+++ b/include/message.php
@@ -163,11 +163,10 @@ function send_message($uid = 0, $recipient='', $body='', $subject='', $replyto='
$jattach = (($attachments) ? json_encode($attachments) : '');
- $key = get_config('system','pubkey');
if($subject)
- $subject = json_encode(crypto_encapsulate($subject,$key));
+ $subject = base64url_encode($subject);
if($body)
- $body = json_encode(crypto_encapsulate($body,$key));
+ $body = base64url_encode($body);
@@ -242,6 +241,8 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
$where = '';
$limit = '';
+ $t0 = dba_timer();
+
if($numitems)
$limit = " LIMIT " . intval($numitems) . " OFFSET " . intval($start);
@@ -284,11 +285,10 @@ function private_messages_list($uid, $mailbox = '', $start = 0, $numitems = 0) {
$r[$k]['to'] = find_xchan_in_array($rr['to_xchan'],$c);
$r[$k]['seen'] = (($rr['mail_flags'] & MAIL_SEEN) ? 1 : 0);
if($r[$k]['mail_flags'] & MAIL_OBSCURED) {
- $key = get_config('system','prvkey');
if($r[$k]['title'])
- $r[$k]['title'] = crypto_unencapsulate(json_decode_plus($r[$k]['title']),$key);
+ $r[$k]['title'] = base64url_decode($r[$k]['title']);
if($r[$k]['body'])
- $r[$k]['body'] = crypto_unencapsulate(json_decode_plus($r[$k]['body']),$key);
+ $r[$k]['body'] = base64url_decode($r[$k]['body']);
}
}
@@ -323,11 +323,10 @@ function private_messages_fetch_message($channel_id, $messageitem_id, $updatesee
$messages[$k]['from'] = find_xchan_in_array($message['from_xchan'],$c);
$messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c);
if($messages[$k]['mail_flags'] & MAIL_OBSCURED) {
- $key = get_config('system','prvkey');
if($messages[$k]['title'])
- $messages[$k]['title'] = crypto_unencapsulate(json_decode_plus($messages[$k]['title']),$key);
+ $messages[$k]['title'] = base64url_decode($messages[$k]['title']);
if($messages[$k]['body'])
- $messages[$k]['body'] = crypto_unencapsulate(json_decode_plus($messages[$k]['body']),$key);
+ $messages[$k]['body'] = base64url_decode($messages[$k]['body']);
}
}
@@ -411,11 +410,10 @@ function private_messages_fetch_conversation($channel_id, $messageitem_id, $upda
$messages[$k]['from'] = find_xchan_in_array($message['from_xchan'],$c);
$messages[$k]['to'] = find_xchan_in_array($message['to_xchan'],$c);
if($messages[$k]['mail_flags'] & MAIL_OBSCURED) {
- $key = get_config('system','prvkey');
if($messages[$k]['title'])
- $messages[$k]['title'] = crypto_unencapsulate(json_decode_plus($messages[$k]['title']),$key);
+ $messages[$k]['title'] = base64url_decode($messages[$k]['title']);
if($messages[$k]['body'])
- $messages[$k]['body'] = crypto_unencapsulate(json_decode_plus($messages[$k]['body']),$key);
+ $messages[$k]['body'] = base64url_decode($messages[$k]['body']);
}
}