diff options
Diffstat (limited to 'include/crypto.php')
-rw-r--r-- | include/crypto.php | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/crypto.php b/include/crypto.php index d8d79eaea..3c68f4ddd 100644 --- a/include/crypto.php +++ b/include/crypto.php @@ -127,19 +127,24 @@ function new_keypair($bits) { } -function pkcs1to8($oldkey) { +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 = 'MIICIjANBgkqhkiG9w0BAQEFAAOCAg8A' . str_replace("\n", '', $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) { +function pkcs8to1($oldkey,$len) { if(strstr($oldkey,'BEGIN RSA')) return $oldkey; |