diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2017-06-05 15:42:25 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2017-06-29 09:32:24 +0200 |
commit | 25e08bc8a0037a3332d016f0491fff4da7b04b2c (patch) | |
tree | 7da26ac0e4c806eeb8ab2c273cee9bcf38f665f3 /apps/files_external/lib/Lib/Auth/PublicKey | |
parent | 928b6a376eb6486f772e1f0304f9ac1166bbf4bb (diff) | |
download | nextcloud-server-25e08bc8a0037a3332d016f0491fff4da7b04b2c.tar.gz nextcloud-server-25e08bc8a0037a3332d016f0491fff4da7b04b2c.zip |
Allow 2048 and 4096 bit SFTP keys
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps/files_external/lib/Lib/Auth/PublicKey')
-rw-r--r-- | apps/files_external/lib/Lib/Auth/PublicKey/RSA.php | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php index cb387b22012..6e7ab0e6fde 100644 --- a/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php +++ b/apps/files_external/lib/Lib/Auth/PublicKey/RSA.php @@ -69,14 +69,19 @@ class RSA extends AuthMechanism { /** * Generate a keypair * + * @param int $keyLenth * @return array ['privatekey' => $privateKey, 'publickey' => $publicKey] */ - public function createKey() { + public function createKey($keyLength) { $rsa = new RSACrypt(); $rsa->setPublicKeyFormat(RSACrypt::PUBLIC_FORMAT_OPENSSH); $rsa->setPassword($this->config->getSystemValue('secret', '')); - return $rsa->createKey(self::CREATE_KEY_BITS); + if ($keyLength !== 1024 && $keyLength !== 2048 && $keyLength !== 4096) { + $keyLength = 1024; + } + + return $rsa->createKey($keyLength); } } |