← All changes
|
includes/sdk/s3/Aws/Crypto/AesGcmDecryptingStream.php
+4
-10
1.2.13
→
1.4.2
View file →
| @@ -5,10 +5,8 @@ | ||
| 5 | 5 | use Dudlewebs\WPMCS\s3\Aws\Exception\CryptoException; |
| 6 | 6 | use Dudlewebs\WPMCS\s3\GuzzleHttp\Psr7; |
| 7 | 7 | use Dudlewebs\WPMCS\s3\GuzzleHttp\Psr7\StreamDecoratorTrait; |
| 8 | 8 | use Dudlewebs\WPMCS\s3\Psr\Http\Message\StreamInterface; |
| 9 | -use Dudlewebs\WPMCS\s3\Aws\Crypto\Polyfill\AesGcm; | |
| 10 | -use Dudlewebs\WPMCS\s3\Aws\Crypto\Polyfill\Key; | |
| 11 | 9 | /** |
| 12 | 10 | * @internal Represents a stream of data to be gcm decrypted. |
| 13 | 11 | */ |
| 14 | 12 | class AesGcmDecryptingStream implements AesStreamInterface |
| @@ -60,17 +58,13 @@ | ||
| 60 | 58 | return $this->initializationVector; |
| 61 | 59 | } |
| 62 | 60 | public function createStream() |
| 63 | 61 | { |
| 64 | - if (\version_compare(\PHP_VERSION, '7.1', '<')) { | |
| 65 | - return Psr7\Utils::streamFor(AesGcm::decrypt((string) $this->cipherText, $this->initializationVector, new Key($this->key), $this->aad, $this->tag, $this->keySize)); | |
| 66 | - } else { | |
| 67 | - $result = \openssl_decrypt((string) $this->cipherText, $this->getOpenSslName(), $this->key, \OPENSSL_RAW_DATA, $this->initializationVector, $this->tag, $this->aad); | |
| 68 | - if ($result === \false) { | |
| 69 | - throw new CryptoException('The requested object could not be' . ' decrypted due to an invalid authentication tag.'); | |
| 70 | - } | |
| 71 | - return Psr7\Utils::streamFor($result); | |
| 62 | + $result = \openssl_decrypt((string) $this->cipherText, $this->getOpenSslName(), $this->key, \OPENSSL_RAW_DATA, $this->initializationVector, $this->tag, $this->aad); | |
| 63 | + if ($result === \false) { | |
| 64 | + throw new CryptoException('The requested object could not be ' . 'decrypted due to an invalid authentication tag.'); | |
| 72 | 65 | } |
| 66 | + return Psr7\Utils::streamFor($result); | |
| 73 | 67 | } |
| 74 | 68 | public function isWritable() : bool |
| 75 | 69 | { |
| 76 | 70 | return \false; |