Storage/src/EncryptionTrait.php
private function buildHeaders($key, $keySHA256, $useCopySourceHeaders)
    {
        if ($key) {
            $headerNames = $useCopySourceHeaders
                ? $this->copySourceEncryptionHeaderNames
                : $this->encryptionHeaderNames;

            if (!$keySHA256) {
                $decodedKey = base64_decode($key);
                $keySHA256 = base64_encode(hash('SHA256', $decodedKey, true));
            }

            return [
                $headerNames['algorithm'] => 'AES256',
                $headerNames['key'] => $key,
                $headerNames['keySHA256'] => $keySHA256
            ];
        }

        return [];
    }
private function buildHeaders($key, $keySHA256, $useCopySourceHeaders)
    {
        if ($key) {
            $headerNames = $useCopySourceHeaders
                ? $this->copySourceEncryptionHeaderNames
                : $this->encryptionHeaderNames;

            if (!$keySHA256) {
                $decodedKey = base64_decode($key);
                $keySHA256 = base64_encode(hash('SHA256', $decodedKey, true));
            }

            return [
                $headerNames['algorithm'] => 'AES256',
                $headerNames['key'] => $key,
                $headerNames['keySHA256'] => $keySHA256
            ];
        }

        return [];
    }
private function buildHeaders ( $ key , $ keySHA256 , $ useCopySourceHeaders ) { if ( $ key ) { $ headerNames = $ useCopySourceHeaders ? $ this -> copySourceEncryptionHeaderNames : $ this -> encryptionHeaderNames ; if ( ! $ keySHA256 ) { $ decodedKey = base64_decode ( $ key ) ; $ keySHA256 = base64_encode ( hash ( 'SHA256' , $ decodedKey , true ) ) ; } return [ $ headerNames [ 'algorithm' ] => 'AES256' , $ headerNames [ 'key' ] => $ key , $ headerNames [ 'keySHA256' ] => $ keySHA256 ] ; } return [ ] ; }
Builds out customer-supplied encryption headers.

@param string $key
@param string $keySHA256
@param bool $useCopySourceHeaders
@return array
Builds out customer - supplied encryption headers .