aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorredmatrix <git@macgirvin.com>2016-03-22 19:58:59 -0700
committerredmatrix <git@macgirvin.com>2016-03-22 19:58:59 -0700
commit6f2ba0c6193a229b3f371de2cae7b314927d4cbb (patch)
treed3f0580d276174b8de9279ac067023f0bcf9d366 /include/crypto.php
parent51a840f46a71800c5ce8111dacc2c4e1bbbe0b1a (diff)
downloadvolse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.tar.gz
volse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.tar.bz2
volse-hubzilla-6f2ba0c6193a229b3f371de2cae7b314927d4cbb.zip
rewrite the webfinger discovery logic
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'));
}
+