diff options
author | zotlabs <mike@macgirvin.com> | 2018-02-07 17:54:21 -0800 |
---|---|---|
committer | zotlabs <mike@macgirvin.com> | 2018-02-07 17:54:21 -0800 |
commit | 1d8d2c6e5517ec7cbb9aa089993918ff6492f5c3 (patch) | |
tree | b86a76ae1ccc30b47241354d86729777cf5b7a53 /include/crypto.php | |
parent | b41c5f349715abc6ca7db563e3938336bc75974e (diff) | |
parent | dc88ccdc0b8af8c9af033b3eaf325cee0c195ff8 (diff) | |
download | volse-hubzilla-1d8d2c6e5517ec7cbb9aa089993918ff6492f5c3.tar.gz volse-hubzilla-1d8d2c6e5517ec7cbb9aa089993918ff6492f5c3.tar.bz2 volse-hubzilla-1d8d2c6e5517ec7cbb9aa089993918ff6492f5c3.zip |
Merge branch 'master' into z6
Diffstat (limited to 'include/crypto.php')
-rw-r--r-- | include/crypto.php | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/include/crypto.php b/include/crypto.php index b990b18d9..105c1c54f 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -31,19 +31,6 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') { return (($verify > 0) ? true : false); } -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) { @@ -282,37 +269,6 @@ function new_keypair($bits) { } -function pkcs1to8($oldkey,$len) { - - if($len == 4096) - $c = 'g'; - if($len == 2048) - $c = 'Q'; - - if(strstr($oldkey,'BEGIN PUBLIC')) - return $oldkey; - - $oldkey = str_replace('-----BEGIN RSA PUBLIC KEY-----', '', $oldkey); - $oldkey = trim(str_replace('-----END RSA PUBLIC KEY-----', '', $oldkey)); - $key = 'MIICIjANBgkqhkiG9w0BAQEFAAOCA' . $c . '8A' . str_replace("\n", '', $oldkey); - $key = "-----BEGIN PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END PUBLIC KEY-----"; - return $key; -} - -function pkcs8to1($oldkey,$len) { - - if(strstr($oldkey,'BEGIN RSA')) - return $oldkey; - - $oldkey = str_replace('-----BEGIN PUBLIC KEY-----', '', $oldkey); - $oldkey = trim(str_replace('-----END PUBLIC KEY-----', '', $oldkey)); - $key = str_replace("\n",'',$oldkey); - $key = substr($key,32); - $key = "-----BEGIN RSA PUBLIC KEY-----\n" . wordwrap($key, 64, "\n", true) . "\n-----END RSA PUBLIC KEY-----"; - return $key; -} - - function DerToPem($Der, $Private=false) { //Encode: |