aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-10-05 23:01:42 -0700
committerzotlabs <mike@macgirvin.com>2017-10-05 23:01:42 -0700
commita6835f4e714b0648717672767aa32625b72dfc47 (patch)
treede27a408047ba7c8b6054c3a2bcea4f89f87d41d /include/crypto.php
parent052ed1f88b11e60ce770a2743192d3bdd78642fc (diff)
downloadvolse-hubzilla-a6835f4e714b0648717672767aa32625b72dfc47.tar.gz
volse-hubzilla-a6835f4e714b0648717672767aa32625b72dfc47.tar.bz2
volse-hubzilla-a6835f4e714b0648717672767aa32625b72dfc47.zip
changes to encryption encapsulation for zot6 (backward compatible)
Diffstat (limited to 'include/crypto.php')
-rw-r--r--include/crypto.php4
1 files changed, 4 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php
index 6ac3fd732..622add4dc 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -148,6 +148,7 @@ function other_encapsulate($data,$pubkey,$alg) {
// compromised by state actors and evidence is mounting that this has
// already happened.
+ $result = [ 'encrypted' => true ];
$key = openssl_random_pseudo_bytes(256);
$iv = openssl_random_pseudo_bytes(256);
$result['data'] = base64url_encode($fn($data,$key,$iv),true);
@@ -200,6 +201,9 @@ function aes_encapsulate($data,$pubkey) {
logger('aes_encapsulate: no key. data: ' . $data);
$key = openssl_random_pseudo_bytes(32);
$iv = openssl_random_pseudo_bytes(16);
+
+ $result = [ 'encrypted' => true ];
+
$result['data'] = base64url_encode(AES256CBC_encrypt($data,$key,$iv),true);
// log the offending call so we can track it down
if(! openssl_public_encrypt($key,$k,$pubkey)) {