aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/crypto.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/include/crypto.php b/include/crypto.php
index dc3580f88..1a62d60af 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -18,6 +18,21 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
}
+
+function pkcs5_pad ($text, $blocksize)
+{
+ $pad = $blocksize - (strlen($text) % $blocksize);
+ return $text . str_repeat(chr($pad), $pad);
+}
+
+function pkcs5_unpad($text)
+{
+ $pad = ord($text{strlen($text)-1});
+ if ($pad > strlen($text)) return false;
+ if (strspn($text, chr($pad), strlen($text) - $pad) != $pad) return false;
+ return substr($text, 0, -1 * $pad);
+}
+
function AES256CBC_encrypt($data,$key,$iv) {
return mcrypt_encrypt(
MCRYPT_RIJNDAEL_128,