From da452decf695ceac249642ec9d12fb724fa547f7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Nov 2018 15:12:01 -0800 Subject: more z6 debugging --- include/crypto.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'include/crypto.php') diff --git a/include/crypto.php b/include/crypto.php index 1040ac29b..fc1029e55 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -225,9 +225,14 @@ function crypto_unencapsulate($data,$prvkey) { if(! $data) return; - $alg = ((array_key_exists('alg',$data)) ? $data['alg'] : 'aes256cbc'); - if($alg === 'aes256cbc') + $alg = ((is_array($data) && array_key_exists('encrypted',$data)) ? $data['alg'] : ''); + if(! $alg) { + return $data; + } + + if($alg === 'aes256cbc') { return aes_unencapsulate($data,$prvkey); + } return other_unencapsulate($data,$prvkey,$alg); -- cgit v1.2.3