diff options
author | friendica <info@friendica.com> | 2013-07-23 20:51:37 -0700 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-07-23 20:51:37 -0700 |
commit | 727ab78f9aacb50dff76b3a9cfea80ef781af371 (patch) | |
tree | c49852f014f2378eb8c440fef6a4dc6ac936dc5b | |
parent | 2c9e6bb10f8b3e08698e03d63d57186adc64098a (diff) | |
download | volse-hubzilla-727ab78f9aacb50dff76b3a9cfea80ef781af371.tar.gz volse-hubzilla-727ab78f9aacb50dff76b3a9cfea80ef781af371.tar.bz2 volse-hubzilla-727ab78f9aacb50dff76b3a9cfea80ef781af371.zip |
crypto logging
-rw-r--r-- | include/crypto.php | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/include/crypto.php b/include/crypto.php index ed32356ec..9d36c24ec 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -211,11 +211,15 @@ function AES256CBC_decrypt($data,$key,$iv) { } function aes_encapsulate($data,$pubkey) { + if(! $pubkey) + logger('aes_encapsulate: no key. data: ' . $data); $key = random_string(32,RANDOM_STRING_TEXT); $iv = random_string(16,RANDOM_STRING_TEXT); $result['data'] = base64url_encode(AES256CBC_encrypt($data,$key,$iv),true); - openssl_public_encrypt($key,$k,$pubkey); - $result['key'] = base64url_encode($k,true); + if(! openssl_public_encrypt($key,$k,$pubkey)) { + logger('aes_encapsulate: RSA failed. ' . print_r(debug_backtrace(),true)); + } + $result['key'] = base64url_encode($k,true); openssl_public_encrypt($iv,$i,$pubkey); $result['iv'] = base64url_encode($i,true); return $result; |