# media-cloud-sync/1.1.1/includes/sdk/s3/Aws/Crypto/AbstractCryptoClientV2.php

Media Cloud Sync, version 1.1.1. 99 lines.

- Page: https://pluginprobe.com/plugins/media-cloud-sync/1.1.1/code/includes/sdk/s3/Aws/Crypto/AbstractCryptoClientV2.php
- Raw: https://pluginprobe.com/plugins/media-cloud-sync/1.1.1/raw/includes/sdk/s3/Aws/Crypto/AbstractCryptoClientV2.php
- Modified: 2024-10-27T10:40:38+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/media-cloud-sync/1.1.1/code/includes/sdk/s3/Aws/Crypto/AbstractCryptoClientV2.php#L10-L20`.

```php
<?php

namespace Dudlewebs\WPMCS\s3\Aws\Crypto;

use Dudlewebs\WPMCS\s3\Aws\Crypto\Cipher\CipherMethod;
use Dudlewebs\WPMCS\s3\GuzzleHttp\Psr7\Stream;
/**
 * @internal
 */
abstract class AbstractCryptoClientV2
{
    public static $supportedCiphers = ['gcm'];
    public static $supportedKeyWraps = [KmsMaterialsProviderV2::WRAP_ALGORITHM_NAME];
    public static $supportedSecurityProfiles = ['V2', 'V2_AND_LEGACY'];
    public static $legacySecurityProfiles = ['V2_AND_LEGACY'];
    /**
     * Returns if the passed cipher name is supported for encryption by the SDK.
     *
     * @param string $cipherName The name of a cipher to verify is registered.
     *
     * @return bool If the cipher passed is in our supported list.
     */
    public static function isSupportedCipher($cipherName)
    {
        return \in_array($cipherName, self::$supportedCiphers, \true);
    }
    /**
     * Returns an identifier recognizable by `openssl_*` functions, such as
     * `aes-256-gcm`
     *
     * @param string $cipherName Name of the cipher being used for encrypting
     *                           or decrypting.
     * @param int $keySize Size of the encryption key, in bits, that will be
     *                     used.
     *
     * @return string
     */
    protected abstract function getCipherOpenSslName($cipherName, $keySize);
    /**
     * Constructs a CipherMethod for the given name, initialized with the other
     * data passed for use in encrypting or decrypting.
     *
     * @param string $cipherName Name of the cipher to generate for encrypting.
     * @param string $iv Base Initialization Vector for the cipher.
     * @param int $keySize Size of the encryption key, in bits, that will be
     *                     used.
     *
     * @return CipherMethod
     *
     * @internal
     */
    protected abstract function buildCipherMethod($cipherName, $iv, $keySize);
    /**
     * Performs a reverse lookup to get the openssl_* cipher name from the
     * AESName passed in from the MetadataEnvelope.
     *
     * @param $aesName
     *
     * @return string
     *
     * @internal
     */
    protected abstract function getCipherFromAesName($aesName);
    /**
     * Dependency to provide an interface for building an encryption stream for
     * data given cipher details, metadata, and materials to do so.
     *
     * @param Stream $plaintext Plain-text data to be encrypted using the
     *                          materials, algorithm, and data provided.
     * @param array $options Options for use in encryption.
     * @param MaterialsProviderV2 $provider A provider to supply and encrypt
     *                                      materials used in encryption.
     * @param MetadataEnvelope $envelope A storage envelope for encryption
     *                                   metadata to be added to.
     *
     * @return AesStreamInterface
     *
     * @internal
     */
    public abstract function encrypt(Stream $plaintext, array $options, MaterialsProviderV2 $provider, MetadataEnvelope $envelope);
    /**
     * Dependency to provide an interface for building a decryption stream for
     * cipher text given metadata and materials to do so.
     *
     * @param string $cipherText Plain-text data to be decrypted using the
     *                           materials, algorithm, and data provided.
     * @param MaterialsProviderInterface $provider A provider to supply and encrypt
     *                                             materials used in encryption.
     * @param MetadataEnvelope $envelope A storage envelope for encryption
     *                                   metadata to be read from.
     * @param array $options Options used for decryption.
     *
     * @return AesStreamInterface
     *
     * @internal
     */
    public abstract function decrypt($cipherText, MaterialsProviderInterfaceV2 $provider, MetadataEnvelope $envelope, array $options = []);
}

```
