hasPassphrase() public static method

see http://superuser.com/questions/201003/checking-ssh-keys-have-passphrases
public static hasPassphrase ( string $keyFile ) : boolean
$keyFile string SSH key file data
return boolean
Example #1
0
 public function testHasPassphrase()
 {
     $ret = SSHKey::hasPassphrase(file_get_contents(__DIR__ . "/../../keys/id_rsa_nopass"));
     $this->assertEquals(false, $ret);
     $ret = SSHKey::hasPassphrase(file_get_contents(__DIR__ . "/../../keys/id_rsa_pass"));
     $this->assertEquals(true, $ret);
 }
Example #2
0
 public function isUsedWithPassphrase()
 {
     return SSHKey::hasPassphrase($this->getKeyContents());
 }