aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-15 18:30:10 -0800
committerfriendica <info@friendica.com>2013-12-15 18:30:10 -0800
commit817d1461236acf9067ab7ff79d116832f18c282b (patch)
tree19f9415753c24d9f2f27c66c5797c440620d2746 /include/crypto.php
parenta6987134e5ca957a3ea923cf678a3c4b6df69e41 (diff)
downloadvolse-hubzilla-817d1461236acf9067ab7ff79d116832f18c282b.tar.gz
volse-hubzilla-817d1461236acf9067ab7ff79d116832f18c282b.tar.bz2
volse-hubzilla-817d1461236acf9067ab7ff79d116832f18c282b.zip
bloody hell... php version incompatibility with openssl - openssl no longer accepts a string as an algorithm. Earlier versions didn't recognise sha256. So we'll look to see if the algorithm constant for sha256 is defined and if so we'll use that instead of the string.
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 e9372fbb4..339d5fe17 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -4,6 +4,8 @@ function rsa_sign($data,$key,$alg = 'sha256') {
if(! $key)
return 'no key';
$sig = '';
+ if(defined(OPENSSL_ALGO_SHA256) && $alg === 'sha256')
+ $alg = OPENSSL_ALGO_SHA256;
openssl_sign($data,$sig,$key,$alg);
return $sig;
}
@@ -13,6 +15,8 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
if(! $key)
return false;
+ if(defined(OPENSSL_ALGO_SHA256) && $alg === 'sha256')
+ $alg = OPENSSL_ALGO_SHA256;
$verify = openssl_verify($data,$sig,$key,$alg);
return $verify;
}