Example #1
0
 /**
  * @inheritdoc
  */
 public function encrypt($unencrypted)
 {
     $encrypted = $this->gpg->sign($unencrypted);
     if (!$encrypted) {
         throw EncryptionException::notEncrypted($this->gpg->geterror());
     }
     return $encrypted;
 }
Example #2
0
 /**
  * @inheritdoc
  */
 public function decrypt($encrypted)
 {
     $decrypted = $this->gpg->decrypt($encrypted);
     if (!$decrypted) {
         throw EncryptionException::notDecrypted($this->gpg->geterror());
     }
     return $decrypted;
 }
Example #3
0
 /**
  * @inheritdoc
  */
 public function decrypt($encrypted)
 {
     $decrypted = '';
     $this->signature = $this->gpg->decryptverify($encrypted, false, $decrypted);
     if (!$decrypted || !$this->signature) {
         throw EncryptionException::notDecryptedAndVerified($this->gpg->geterror());
     }
     return $decrypted;
 }
Example #4
0
 /**
  * @inheritdoc
  */
 public function decrypt($encrypted)
 {
     $decrypted = '';
     $signature = null;
     $info = $this->gpg->verify($encrypted, false, $decrypted);
     if (!$info) {
         throw EncryptionException::notVerified($this->gpg->geterror());
     }
     return $decrypted;
 }