Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F98178276
PassphraseSSHKey.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jan 10, 18:07
Size
1 KB
Mime Type
text/x-php
Expires
Sun, Jan 12, 18:07 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
23528455
Attached To
rPH Phabricator
PassphraseSSHKey.php
View Options
<?php
final
class
PassphraseSSHKey
extends
PassphraseAbstractKey
{
private
$keyFile
;
public
static
function
loadFromPHID
(
$phid
,
PhabricatorUser
$viewer
)
{
$key
=
new
PassphraseSSHKey
();
return
$key
->
loadAndValidateFromPHID
(
$phid
,
$viewer
,
PassphraseCredentialTypeSSHPrivateKey
::
PROVIDES_TYPE
);
}
public
function
getKeyfileEnvelope
()
{
$credential
=
$this
->
requireCredential
();
$text_type
=
PassphraseCredentialTypeSSHPrivateKeyText
::
CREDENTIAL_TYPE
;
if
(
$credential
->
getCredentialType
()
==
$text_type
)
{
// If the credential stores key text, write it out to a temporary file
// so we can pass it to `ssh`.
if
(!
$this
->
keyFile
)
{
$temporary_file
=
new
TempFile
(
'passphrase-ssh-key'
);
Filesystem
::
changePermissions
(
$temporary_file
,
0600
);
Filesystem
::
writeFile
(
$temporary_file
,
$credential
->
getSecret
()->
openEnvelope
());
$this
->
keyFile
=
$temporary_file
;
}
return
new
PhutilOpaqueEnvelope
((
string
)
$this
->
keyFile
);
}
return
$credential
->
getSecret
();
}
}
Event Timeline
Log In to Comment