Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2892683
PhabricatorSSHKeyGenerator.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Award Token
Flag For Later
Advanced/Developer...
View Handle
View Hovercard
Size
753 B
Referenced Files
None
Subscribers
None
PhabricatorSSHKeyGenerator.php
View Options
<?php
final
class
PhabricatorSSHKeyGenerator
extends
Phobject
{
public
static
function
assertCanGenerateKeypair
(
)
{
$binary
=
'ssh-keygen'
;
if
(
!
Filesystem
::
resolveBinary
(
$binary
)
)
{
throw
new
Exception
(
pht
(
'Can not generate keys: unable to find "%s" in PATH!'
,
$binary
)
)
;
}
}
public
static
function
generateKeypair
(
)
{
self
::
assertCanGenerateKeypair
(
)
;
$tempfile
=
new
TempFile
(
)
;
$keyfile
=
dirname
(
$tempfile
)
.
DIRECTORY_SEPARATOR
.
'keytext'
;
execx
(
'ssh-keygen -t rsa -N %s -f %s'
,
''
,
$keyfile
)
;
$public_key
=
Filesystem
::
readFile
(
$keyfile
.
'.pub'
)
;
$private_key
=
Filesystem
::
readFile
(
$keyfile
)
;
return
array
(
$public_key
,
$private_key
)
;
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Jan 19, 17:11 (1 w, 5 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1110499
Default Alt Text
PhabricatorSSHKeyGenerator.php (753 B)
Attached To
Mode
rP Phorge
Attached
Detach File
Event Timeline
Log In to Comment