OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
cream
/
Xpress_backup
/
vendor
/
aws
/
aws-sdk-php
/
src
/
Crypto
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
05/19/2025 10:07:19 AM
rwxr-xr-x
📄
AbstractCryptoClient.php
4.11 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AbstractCryptoClientV2.php
4 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesDecryptingStream.php
3.65 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesEncryptingStream.php
3.83 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesGcmDecryptingStream.php
2.81 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesGcmEncryptingStream.php
3.02 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesStreamInterface.php
686 bytes
05/19/2025 10:07:18 AM
rw-r--r--
📄
AesStreamInterfaceV2.php
759 bytes
05/19/2025 10:07:18 AM
rw-r--r--
📁
Cipher
-
05/19/2025 10:07:18 AM
rwxr-xr-x
📄
DecryptionTrait.php
6.13 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
DecryptionTraitV2.php
9.28 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
EncryptionTrait.php
7.1 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
EncryptionTraitV2.php
7.29 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
KmsMaterialsProvider.php
4.01 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
KmsMaterialsProviderV2.php
3.53 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MaterialsProvider.php
3.33 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MaterialsProviderInterface.php
1.87 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MaterialsProviderInterfaceV2.php
1.72 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MaterialsProviderV2.php
2.07 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MetadataEnvelope.php
1.7 KB
05/19/2025 10:07:18 AM
rw-r--r--
📄
MetadataStrategyInterface.php
1 KB
05/19/2025 10:07:18 AM
rw-r--r--
📁
Polyfill
-
05/19/2025 10:07:18 AM
rwxr-xr-x
Editing: AesEncryptingStream.php
Close
<?php namespace Aws\Crypto; use GuzzleHttp\Psr7\StreamDecoratorTrait; use \LogicException; use Psr\Http\Message\StreamInterface; use Aws\Crypto\Cipher\CipherMethod; /** * @internal Represents a stream of data to be encrypted with a passed cipher. */ class AesEncryptingStream implements AesStreamInterface { const BLOCK_SIZE = 16; // 128 bits use StreamDecoratorTrait; /** * @var string */ private $buffer = ''; /** * @var CipherMethod */ private $cipherMethod; /** * @var string */ private $key; /** * @var StreamInterface */ private $stream; /** * @param StreamInterface $plainText * @param string $key * @param CipherMethod $cipherMethod */ public function __construct( StreamInterface $plainText, $key, CipherMethod $cipherMethod ) { $this->stream = $plainText; $this->key = $key; $this->cipherMethod = clone $cipherMethod; } public function getOpenSslName() { return $this->cipherMethod->getOpenSslName(); } public function getAesName() { return $this->cipherMethod->getAesName(); } public function getCurrentIv() { return $this->cipherMethod->getCurrentIv(); } public function getSize(): ?int { $plainTextSize = $this->stream->getSize(); if ($this->cipherMethod->requiresPadding() && $plainTextSize !== null) { // PKCS7 padding requires that between 1 and self::BLOCK_SIZE be // added to the plaintext to make it an even number of blocks. $padding = self::BLOCK_SIZE - $plainTextSize % self::BLOCK_SIZE; return $plainTextSize + $padding; } return $plainTextSize; } public function isWritable(): bool { return false; } public function read($length): string { if ($length > strlen($this->buffer)) { $this->buffer .= $this->encryptBlock( (int) self::BLOCK_SIZE * ceil(($length - strlen($this->buffer)) / self::BLOCK_SIZE) ); } $data = substr($this->buffer, 0, $length); $this->buffer = substr($this->buffer, $length); return $data ? $data : ''; } public function seek($offset, $whence = SEEK_SET): void { if ($whence === SEEK_CUR) { $offset = $this->tell() + $offset; $whence = SEEK_SET; } if ($whence === SEEK_SET) { $this->buffer = ''; $wholeBlockOffset = (int) ($offset / self::BLOCK_SIZE) * self::BLOCK_SIZE; $this->stream->seek($wholeBlockOffset); $this->cipherMethod->seek($wholeBlockOffset); $this->read($offset - $wholeBlockOffset); } else { throw new LogicException('Unrecognized whence.'); } } private function encryptBlock($length) { if ($this->stream->eof()) { return ''; } $plainText = ''; do { $plainText .= $this->stream->read((int) ($length - strlen($plainText))); } while (strlen($plainText) < $length && !$this->stream->eof()); $options = OPENSSL_RAW_DATA; if (!$this->stream->eof() || $this->stream->getSize() !== $this->stream->tell() ) { $options |= OPENSSL_ZERO_PADDING; } $cipherText = openssl_encrypt( $plainText, $this->cipherMethod->getOpenSslName(), $this->key, $options, $this->cipherMethod->getCurrentIv() ); $this->cipherMethod->update($cipherText); return $cipherText; } }