From 755f0f17a5b8a28a20bb0b1e5cbed10fec6f9197 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Sun, 10 Nov 2013 22:27:48 -0600 Subject: [PATCH] RSA: putty keys weren't being formatted correctly --- phpseclib/Crypt/RSA.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index 2f2c9f99..92ebfdf7 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -760,7 +760,7 @@ class Crypt_RSA { strlen($this->comment), $this->comment, strlen($public), $public ); $public = base64_encode($public); - $key.= "Public-Lines: " . ((strlen($public) + 32) >> 6) . "\r\n"; + $key.= "Public-Lines: " . ((strlen($public) + 63) >> 6) . "\r\n"; $key.= chunk_split($public, 64); $private = pack('Na*Na*Na*Na*', strlen($raw['privateExponent']), $raw['privateExponent'], strlen($raw['prime1']), $raw['prime1'], @@ -791,7 +791,7 @@ class Crypt_RSA { } $private = base64_encode($private); - $key.= 'Private-Lines: ' . ((strlen($private) + 32) >> 6) . "\r\n"; + $key.= 'Private-Lines: ' . ((strlen($private) + 63) >> 6) . "\r\n"; $key.= chunk_split($private, 64); if (!class_exists('Crypt_Hash')) { require_once('Crypt/Hash.php');