From 3ef68bd912dcf74c9424b2e451e0572032950ac6 Mon Sep 17 00:00:00 2001 From: terrafrost Date: Tue, 28 Sep 2021 08:57:41 -0500 Subject: [PATCH] RSA: ssh-keygen -yf private.key fails if \r is present --- phpseclib/Crypt/RSA.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/phpseclib/Crypt/RSA.php b/phpseclib/Crypt/RSA.php index ce0ab64c..6ed0e97b 100644 --- a/phpseclib/Crypt/RSA.php +++ b/phpseclib/Crypt/RSA.php @@ -936,9 +936,9 @@ class Crypt_RSA ); $key = "openssh-key-v1\0$key"; - return "-----BEGIN OPENSSH PRIVATE KEY-----\r\n" . - chunk_split(base64_encode($key), 70) . - "-----END OPENSSH PRIVATE KEY-----"; + return "-----BEGIN OPENSSH PRIVATE KEY-----\n" . + chunk_split(base64_encode($key), 70, "\n") . + "-----END OPENSSH PRIVATE KEY-----\n"; default: // eg. CRYPT_RSA_PRIVATE_FORMAT_PKCS1 $components = array(); foreach ($raw as $name => $value) {