aboutsummaryrefslogtreecommitdiffstats
path: root/include/crypto.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-08-15 06:05:52 -0700
committerfriendica <info@friendica.com>2014-08-15 06:05:52 -0700
commit41aa9e13cf21b83654cfb2993cea7d8385563692 (patch)
tree29fe268cd0fc2aba6a4d648f950043d1c589b693 /include/crypto.php
parent257332f434740d974d6189d19c147722ad105a16 (diff)
downloadvolse-hubzilla-41aa9e13cf21b83654cfb2993cea7d8385563692.tar.gz
volse-hubzilla-41aa9e13cf21b83654cfb2993cea7d8385563692.tar.bz2
volse-hubzilla-41aa9e13cf21b83654cfb2993cea7d8385563692.zip
doc update
Diffstat (limited to 'include/crypto.php')
-rw-r--r--include/crypto.php11
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;