aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xboot.php4
-rw-r--r--include/conversation.php2
-rw-r--r--include/crypto.php2
-rw-r--r--include/zot.php11
4 files changed, 12 insertions, 7 deletions
diff --git a/boot.php b/boot.php
index aa1da5fdc..1a07cb8d9 100755
--- a/boot.php
+++ b/boot.php
@@ -640,6 +640,10 @@ function sys_boot() {
define( 'DEFAULT_NOTIFY_ICON', '/images/hz-white-32.png' );
}
+ if(! defined('CRYPTO_ALGORITHM')) {
+ define( 'CRYPTO_ALGORITHM', 'aes256cbc' );
+ }
+
/*
* Try to open the database;
*/
diff --git a/include/conversation.php b/include/conversation.php
index c260eb4a0..deb463887 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -363,7 +363,7 @@ function localize_item(&$item){
if(intval($item['item_obscured'])
&& strlen($item['body']) && (! strpos($item['body'],'data'))) {
- $item['body'] = json_encode(crypto_encapsulate($item['body'],get_config('system','pubkey')));
+ $item['body'] = json_encode(crypto_encapsulate($item['body'],get_config('system','pubkey'), CRYPTO_ALGORITHM));
}
}
diff --git a/include/crypto.php b/include/crypto.php
index bc798d919..c67c4a1ef 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -315,7 +315,7 @@ function convert_salmon_key($key) {
function z_obscure($s) {
- return json_encode(crypto_encapsulate($s,get_config('system','pubkey')));
+ return json_encode(crypto_encapsulate($s,get_config('system','pubkey'),CRYPTO_ALGORITHM));
}
function z_unobscure($s) {
diff --git a/include/zot.php b/include/zot.php
index 5c9fb4e82..792d4b688 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -147,7 +147,7 @@ function zot_build_packet($channel, $type = 'notify', $recipients = null, $remot
// Hush-hush ultra top-secret mode
if ($remote_key) {
- $data = crypto_encapsulate(json_encode($data),$remote_key);
+ $data = crypto_encapsulate(json_encode($data),$remote_key, CRYPTO_ALGORITHM);
}
return json_encode($data);
@@ -399,7 +399,8 @@ function zot_refresh($them, $channel = null, $force = false) {
'data' => $j['permissions']['data'],
'key' => $j['permissions']['key'],
'iv' => $j['permissions']['iv']),
- $channel['channel_prvkey']);
+ $channel['channel_prvkey'],
+ CRYPTO_ALGORITHM );
if($permissions)
$permissions = json_decode($permissions,true);
logger('decrypted permissions: ' . print_r($permissions,true), LOGGER_DATA, LOG_DEBUG);
@@ -1091,7 +1092,7 @@ function zot_fetch($arr) {
'secret_sig' => base64url_encode(rsa_sign($arr['secret'],get_config('system','prvkey')))
);
- $datatosend = json_encode(crypto_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey']));
+ $datatosend = json_encode(crypto_encapsulate(json_encode($data),$ret_hub['hubloc_sitekey'], CRYPTO_ALGORITHM));
$fetch = zot_zot($url,$datatosend);
@@ -3913,7 +3914,7 @@ function zotinfo($arr) {
$permissions['connected'] = true;
}
- $ret['permissions'] = (($ztarget && $zkey) ? crypto_encapsulate(json_encode($permissions),$zkey) : $permissions);
+ $ret['permissions'] = (($ztarget && $zkey) ? crypto_encapsulate(json_encode($permissions),$zkey, CRYPTO_ALGORITHM) : $permissions);
if($permissions['view_profile'])
$ret['profile'] = $profile;
@@ -4317,7 +4318,7 @@ function zot_reply_pickup($data) {
}
}
- $encrypted = crypto_encapsulate(json_encode($ret),$sitekey);
+ $encrypted = crypto_encapsulate(json_encode($ret),$sitekey, CRYPTO_ALGORITHM);
json_return_and_die($encrypted);
/* pickup: end */