Storage/src/EncryptionTrait.php
public function formatEncryptionHeaders(array $options)
    {
        $encryptionHeaders = [];
        $useCopySourceHeaders = isset($options['useCopySourceHeaders']) ? $options['useCopySourceHeaders'] : false;
        $key = isset($options['encryptionKey']) ? $options['encryptionKey'] : null;
        $keySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null;
        $destinationKey = isset($options['destinationEncryptionKey']) ? $options['destinationEncryptionKey'] : null;
        $destinationKeySHA256 = isset($options['destinationEncryptionKeySHA256'])
            ? $options['destinationEncryptionKeySHA256']
            : null;

        unset($options['useCopySourceHeaders']);
        unset($options['encryptionKey']);
        unset($options['encryptionKeySHA256']);
        unset($options['destinationEncryptionKey']);
        unset($options['destinationEncryptionKeySHA256']);

        $encryptionHeaders = $this->buildHeaders($key, $keySHA256, $useCopySourceHeaders)
            + $this->buildHeaders($destinationKey, $destinationKeySHA256, false);

        if (!empty($encryptionHeaders)) {
            if (isset($options['restOptions']['headers'])) {
                $options['restOptions']['headers'] += $encryptionHeaders;
            } else {
                $options['restOptions']['headers'] = $encryptionHeaders;
            }
        }

        return $options;
    }
public function formatEncryptionHeaders(array $options)
    {
        $encryptionHeaders = [];
        $useCopySourceHeaders = isset($options['useCopySourceHeaders']) ? $options['useCopySourceHeaders'] : false;
        $key = isset($options['encryptionKey']) ? $options['encryptionKey'] : null;
        $keySHA256 = isset($options['encryptionKeySHA256']) ? $options['encryptionKeySHA256'] : null;
        $destinationKey = isset($options['destinationEncryptionKey']) ? $options['destinationEncryptionKey'] : null;
        $destinationKeySHA256 = isset($options['destinationEncryptionKeySHA256'])
            ? $options['destinationEncryptionKeySHA256']
            : null;

        unset($options['useCopySourceHeaders']);
        unset($options['encryptionKey']);
        unset($options['encryptionKeySHA256']);
        unset($options['destinationEncryptionKey']);
        unset($options['destinationEncryptionKeySHA256']);

        $encryptionHeaders = $this->buildHeaders($key, $keySHA256, $useCopySourceHeaders)
            + $this->buildHeaders($destinationKey, $destinationKeySHA256, false);

        if (!empty($encryptionHeaders)) {
            if (isset($options['restOptions']['headers'])) {
                $options['restOptions']['headers'] += $encryptionHeaders;
            } else {
                $options['restOptions']['headers'] = $encryptionHeaders;
            }
        }

        return $options;
    }
public function formatEncryptionHeaders ( array $ options ) { $ encryptionHeaders = [ ] ; $ useCopySourceHeaders = isset ( $ options [ 'useCopySourceHeaders' ] ) ? $ options [ 'useCopySourceHeaders' ] : false ; $ key = isset ( $ options [ 'encryptionKey' ] ) ? $ options [ 'encryptionKey' ] : null ; $ keySHA256 = isset ( $ options [ 'encryptionKeySHA256' ] ) ? $ options [ 'encryptionKeySHA256' ] : null ; $ destinationKey = isset ( $ options [ 'destinationEncryptionKey' ] ) ? $ options [ 'destinationEncryptionKey' ] : null ; $ destinationKeySHA256 = isset ( $ options [ 'destinationEncryptionKeySHA256' ] ) ? $ options [ 'destinationEncryptionKeySHA256' ] : null ; unset ( $ options [ 'useCopySourceHeaders' ] ) ; unset ( $ options [ 'encryptionKey' ] ) ; unset ( $ options [ 'encryptionKeySHA256' ] ) ; unset ( $ options [ 'destinationEncryptionKey' ] ) ; unset ( $ options [ 'destinationEncryptionKeySHA256' ] ) ; $ encryptionHeaders = $ this -> buildHeaders ( $ key , $ keySHA256 , $ useCopySourceHeaders ) + $ this -> buildHeaders ( $ destinationKey , $ destinationKeySHA256 , false ) ; if ( ! empty ( $ encryptionHeaders ) ) { if ( isset ( $ options [ 'restOptions' ] [ 'headers' ] ) ) { $ options [ 'restOptions' ] [ 'headers' ] += $ encryptionHeaders ; } else { $ options [ 'restOptions' ] [ 'headers' ] = $ encryptionHeaders ; } } return $ options ; }
Formats options for customer-supplied encryption headers.

@param array $options
@return array
@access private
Formats options for customer - supplied encryption headers .