Changeset View
Changeset View
Standalone View
Standalone View
src/applications/auth/sshkey/PhabricatorAuthSSHPublicKey.php
Context not available. | |||||
public static function newFromRawKey($entire_key) { | public static function newFromRawKey($entire_key) { | ||||
$entire_key = trim($entire_key); | $entire_key = trim($entire_key); | ||||
if (!strlen($entire_key)) { | if (!@strlen($entire_key)) { | ||||
throw new Exception(pht('No public key was provided.')); | throw new Exception(pht('No public key was provided.')); | ||||
} | } | ||||
Context not available. | |||||
// into a maximum of three parts. | // into a maximum of three parts. | ||||
$parts = preg_split('/\s+/', $parts, 3); | $parts = preg_split('/\s+/', $parts, 3); | ||||
if (preg_match('/private\s*key/i', $entire_key)) { | if (@preg_match('/private\s*key/i', $entire_key)) { | ||||
// Try to give the user a better error message if it looks like | // Try to give the user a better error message if it looks like | ||||
// they uploaded a private key. | // they uploaded a private key. | ||||
throw new Exception(pht('Provide a public key, not a private key!')); | throw new Exception(pht('Provide a public key, not a private key!')); | ||||
Context not available. | |||||
public function getEntireKey() { | public function getEntireKey() { | ||||
$key = $this->type.' '.$this->body; | $key = $this->type.' '.$this->body; | ||||
if (strlen($this->comment)) { | if (@strlen($this->comment)) { | ||||
$key = $key.' '.$this->comment; | $key = $key.' '.$this->comment; | ||||
} | } | ||||
return $key; | return $key; | ||||
Context not available. |
Content licensed under Creative Commons Attribution-ShareAlike 4.0 (CC-BY-SA) unless otherwise noted; code licensed under Apache 2.0 or other open source licenses. · CC BY-SA 4.0 · Apache 2.0