[ Index ] |
PHP Cross Reference of Phabricator |
[Summary view] [Print] [Text view]
1 <?php 2 3 final class PhabricatorSSHKeyGenerator extends Phobject { 4 5 public static function assertCanGenerateKeypair() { 6 $binary = 'ssh-keygen'; 7 if (!Filesystem::resolveBinary($binary)) { 8 throw new Exception( 9 pht( 10 'Can not generate keys: unable to find "%s" in PATH!', 11 $binary)); 12 } 13 } 14 15 public static function generateKeypair() { 16 self::assertCanGenerateKeypair(); 17 18 $tempfile = new TempFile(); 19 $keyfile = dirname($tempfile).DIRECTORY_SEPARATOR.'keytext'; 20 21 execx( 22 'ssh-keygen -t rsa -N %s -f %s', 23 '', 24 $keyfile); 25 26 $public_key = Filesystem::readFile($keyfile.'.pub'); 27 $private_key = Filesystem::readFile($keyfile); 28 29 return array($public_key, $private_key); 30 } 31 32 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Sun Nov 30 09:20:46 2014 | Cross-referenced by PHPXref 0.7.1 |