Exemple #1
0
 /**
  * Imports a public or private key into the keyring.
  *
  * @param string $data the key data to be imported.
  *
  * @return KeyImport|bool
  */
 public function importKey($data)
 {
     try {
         $result = $this->_importKey($data);
         $keyImport = new KeyImport();
         $keyImport->setPublicImported($result['public_imported']);
         $keyImport->setPublicUnchanged($result['public_unchanged']);
         $keyImport->setPrivateImported($result['private_imported']);
         $keyImport->setPrivateUnchanged($result['private_unchanged']);
         $keyImport->setFingerprint($result['fingerprint']);
         return $keyImport;
     } catch (\Exception $e) {
         return false;
     }
 }
Exemple #2
0
 public function importKey($data)
 {
     $data = $this->getResource()->import($data);
     if ($data === false) {
         return false;
     }
     $result = new KeyImport();
     $result->setPublicImported($data['imported']);
     $result->setPublicUnchanged($data['unchanged']);
     $result->setPrivateImported($data['secretimported']);
     $result->setPrivateUnchanged($data['secretunchanged']);
     $result->setFingerprint($data['fingerprint']);
     return $result;
 }