示例#1
0
 /**
  * @inheritdoc
  */
 public function encrypt($unencrypted)
 {
     $encrypted = $this->gpg->sign($unencrypted);
     if (!$encrypted) {
         throw EncryptionException::notEncrypted($this->gpg->geterror());
     }
     return $encrypted;
 }
示例#2
0
 /**
  * @inheritdoc
  */
 public function decrypt($encrypted)
 {
     $decrypted = $this->gpg->decrypt($encrypted);
     if (!$decrypted) {
         throw EncryptionException::notDecrypted($this->gpg->geterror());
     }
     return $decrypted;
 }
示例#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;
 }
示例#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;
 }