aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorAndrew Manning <andrew@reticu.li>2016-03-23 21:17:23 -0400
committerAndrew Manning <andrew@reticu.li>2016-03-23 21:17:23 -0400
commit59827b6dfdcab85b65853f3ee75365bda057a993 (patch)
treedc1871d3cba25d9064192d206bf24b16780621ab /include/crypto.php
parent61bef7d4b083c9c794469137798176b62c2f21cb (diff)
parentf200dd4395e1d0e2a6200844ec4827a943bf09ea (diff)
downloadvolse-hubzilla-59827b6dfdcab85b65853f3ee75365bda057a993.tar.gz
volse-hubzilla-59827b6dfdcab85b65853f3ee75365bda057a993.tar.bz2
volse-hubzilla-59827b6dfdcab85b65853f3ee75365bda057a993.zip
Merge branch 'master' of https://github.com/redmatrix/hubzilla into contextual-help
Diffstat (limited to 'include/crypto.php')
-rw-r--r--include/crypto.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php
index 3cddc7581..d82ee5114 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -308,11 +308,33 @@ function metorsa($m,$e) {
return $key;
}
+
+
function salmon_key($pubkey) {
pemtome($pubkey,$m,$e);
return 'RSA' . '.' . base64url_encode($m,true) . '.' . base64url_encode($e,true) ;
}
+
+function convert_salmon_key($key) {
+
+ if(strstr($key,','))
+ $rawkey = substr($key,strpos($key,',')+1);
+ else
+ $rawkey = substr($key,5);
+
+ $key_info = explode('.',$rawkey);
+
+ $m = base64url_decode($key_info[1]);
+ $e = base64url_decode($key_info[2]);
+
+ logger('key details: ' . print_r($key_info,true), LOGGER_DATA);
+ $salmon_key = metopem($m,$e);
+ return $salmon_key;
+
+}
+
+
function z_obscure($s) {
return json_encode(crypto_encapsulate($s,get_config('system','pubkey')));
}
@@ -322,3 +344,4 @@ function z_unobscure($s) {
return $s;
return crypto_unencapsulate(json_decode($s,true),get_config('system','prvkey'));
}
+