From 1bce7a24a45b4e53b0ce22e3fe996e4c145c2013 Mon Sep 17 00:00:00 2001 From: O2Script Web Solutions <72553292+o2script@users.noreply.github.com> Date: Thu, 15 Oct 2020 18:35:40 +0530 Subject: [PATCH] Update SshKey.php Allow generating putty formated private key --- src/Codeaken/SshKey/SshKey.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Codeaken/SshKey/SshKey.php b/src/Codeaken/SshKey/SshKey.php index b8d3672..ad94797 100644 --- a/src/Codeaken/SshKey/SshKey.php +++ b/src/Codeaken/SshKey/SshKey.php @@ -10,7 +10,9 @@ abstract class SshKey const FORMAT_OPENSSH = 'openssh'; const FORMAT_PKCS1 = 'pkcs1'; const FORMAT_PKCS8 = 'pkcs8'; - + const PRIVATE_FORMAT_PUTTY = 'puttyprivatekey'; // FOR GENERATING PUTTY FORMATED PRIVATE KEY + const PUBLIC_FORMAT_OPENSSH = 'puttypublickey'; // FOR MATHCING THE PUBLIC KEY WITH PUTTY FORMATED PRIVATE KEY + public function __construct() { $this->key = new RSA(); @@ -22,6 +24,8 @@ public function getKeyData($format) self::FORMAT_OPENSSH => RSA::PUBLIC_FORMAT_OPENSSH, self::FORMAT_PKCS1 => RSA::PUBLIC_FORMAT_PKCS1, self::FORMAT_PKCS8 => RSA::PUBLIC_FORMAT_PKCS8, + self::PRIVATE_FORMAT_PUTTY => RSA::PRIVATE_FORMAT_PUTTY, + self::PUBLIC_FORMAT_OPENSSH => RSA::PUBLIC_FORMAT_OPENSSH, ]; if ( ! isset($formatToConstant[$format])) {