src/Server/AmazonServer.php
private function signRequest(
        RequestInterface $request,
        array $packedCommands = []
    ): RequestInterface {
        $signature = [
            $request->getMethod(),
            $request->getHeaderLine('Content-MD5'),
            $request->getHeaderLine('Content-Type'),
            $request->getHeaderLine('Date')
        ];

        $normalizedCommands = [];
        foreach ($packedCommands as $command => $value) {
            if (!empty($value)) {
                $normalizedCommands[] = strtolower($command) . ':' . $value;
            }
        }

        if (!empty($normalizedCommands)) {
            sort($normalizedCommands);
            $signature[] = join("\n", $normalizedCommands);
        }

        $signature[] = $request->getUri()->getPath();

        return $request->withAddedHeader(
            'Authorization',
            'AWS ' . $this->options['key'] . ':' . base64_encode(hash_hmac(
                'sha1',
                join("\n", $signature),
                $this->options['secret'],
                true
            ))
        );
    }
private function signRequest(
        RequestInterface $request,
        array $packedCommands = []
    ): RequestInterface {
        $signature = [
            $request->getMethod(),
            $request->getHeaderLine('Content-MD5'),
            $request->getHeaderLine('Content-Type'),
            $request->getHeaderLine('Date')
        ];

        $normalizedCommands = [];
        foreach ($packedCommands as $command => $value) {
            if (!empty($value)) {
                $normalizedCommands[] = strtolower($command) . ':' . $value;
            }
        }

        if (!empty($normalizedCommands)) {
            sort($normalizedCommands);
            $signature[] = join("\n", $normalizedCommands);
        }

        $signature[] = $request->getUri()->getPath();

        return $request->withAddedHeader(
            'Authorization',
            'AWS ' . $this->options['key'] . ':' . base64_encode(hash_hmac(
                'sha1',
                join("\n", $signature),
                $this->options['secret'],
                true
            ))
        );
    }
private function signRequest ( RequestInterface $ request , array $ packedCommands = [ ] ) : RequestInterface { $ signature = [ $ request -> getMethod ( ) , $ request -> getHeaderLine ( 'Content-MD5' ) , $ request -> getHeaderLine ( 'Content-Type' ) , $ request -> getHeaderLine ( 'Date' ) ] ; $ normalizedCommands = [ ] ; foreach ( $ packedCommands as $ command => $ value ) { if ( ! empty ( $ value ) ) { $ normalizedCommands [ ] = strtolower ( $ command ) . ':' . $ value ; } } if ( ! empty ( $ normalizedCommands ) ) { sort ( $ normalizedCommands ) ; $ signature [ ] = join ( "\n" , $ normalizedCommands ) ; } $ signature [ ] = $ request -> getUri ( ) -> getPath ( ) ; return $ request -> withAddedHeader ( 'Authorization' , 'AWS ' . $ this -> options [ 'key' ] . ':' . base64_encode ( hash_hmac ( 'sha1' , join ( "\n" , $ signature ) , $ this -> options [ 'secret' ] , true ) ) ) ; }
Sign amazon request.

@param RequestInterface $request
@param array            $packedCommands Headers generated based on request commands, see
packCommands() method for more information.

@return RequestInterface
Sign amazon request .