zot: specify crypto method

This commit is contained in:
zotlabs 2016-11-20 21:18:38 -08:00
parent dda2ea8fed
commit f926915e56
4 changed files with 12 additions and 7 deletions

View File

@ -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;
*/

View File

@ -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));
}
}

View File

@ -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) {

View File

@ -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 */