public function generateAccountSharedAccessSignatureToken(
        $signedVersion,
        $signedPermissions,
        $signedService,
        $signedResourceType,
        $signedExpiry,
        $signedStart = "",
        $signedIP = "",
        $signedProtocol = ""
    ) {
        // check that version is valid
        Validate::canCastAsString($signedVersion, 'signedVersion');
        Validate::notNullOrEmpty($signedVersion, 'signedVersion');
        Validate::isDateString($signedVersion, 'signedVersion');

        // validate and sanitize signed service
        $signedService = $this->validateAndSanitizeSignedService($signedService);

        // validate and sanitize signed resource type
        $signedResourceType = $this->validateAndSanitizeSignedResourceType($signedResourceType);

        // validate and sanitize signed permissions
        $signedPermissions = $this->validateAndSanitizeSignedPermissions($signedPermissions);

        // check that expiracy is valid
        if ($signedExpiry instanceof \Datetime) {
            $signedExpiry = Utilities::isoDate($signedExpiry);
        }
        Validate::canCastAsString($signedExpiry, 'signedExpiry');
        Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
        Validate::isDateString($signedExpiry, 'signedExpiry');

        // check that signed start is valid
        if ($signedStart instanceof \Datetime) {
            $signedStart = Utilities::isoDate($signedStart);
        }
        Validate::canCastAsString($signedStart, 'signedStart');
        if (strlen($signedStart) > 0) {
            Validate::isDateString($signedStart, 'signedStart');
        }

        // check that signed IP is valid
        Validate::canCastAsString($signedIP, 'signedIP');

        // validate and sanitize signed protocol
        $signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);

        // construct an array with the parameters to generate the shared access signature at the account level
        $parameters = array();
        $parameters[] = $this->accountName;
        $parameters[] = $signedPermissions;
        $parameters[] = $signedService;
        $parameters[] = $signedResourceType;
        $parameters[] = $signedStart;
        $parameters[] = $signedExpiry;
        $parameters[] = $signedIP;
        $parameters[] = $signedProtocol;
        $parameters[] = $signedVersion;

        // implode the parameters into a string
        $stringToSign = utf8_encode(implode("\n", $parameters) . "\n");

        // decode the account key from base64
        $decodedAccountKey = base64_decode($this->accountKey);

        // create the signature with hmac sha256
        $signature = hash_hmac("sha256", $stringToSign, $decodedAccountKey, true);

        // encode the signature as base64 and url encode.
        $sig = urlencode(base64_encode($signature));

        //adding all the components for account SAS together.
        $sas  = 'sv=' . $signedVersion;
        $sas .= '&ss=' . $signedService;
        $sas .= '&srt=' . $signedResourceType;
        $sas .= '&sp=' . $signedPermissions;
        $sas .= '&se=' . $signedExpiry;
        $sas .= $signedStart === ''? '' : '&st=' . $signedStart;
        $sas .= $signedIP === ''? '' : '&sip=' . $signedIP;
        $sas .= '&spr=' . $signedProtocol;
        $sas .= '&sig=' . $sig;

        // return the signature
        return $sas;
    }
public function generateAccountSharedAccessSignatureToken(
        $signedVersion,
        $signedPermissions,
        $signedService,
        $signedResourceType,
        $signedExpiry,
        $signedStart = "",
        $signedIP = "",
        $signedProtocol = ""
    ) {
        // check that version is valid
        Validate::canCastAsString($signedVersion, 'signedVersion');
        Validate::notNullOrEmpty($signedVersion, 'signedVersion');
        Validate::isDateString($signedVersion, 'signedVersion');

        // validate and sanitize signed service
        $signedService = $this->validateAndSanitizeSignedService($signedService);

        // validate and sanitize signed resource type
        $signedResourceType = $this->validateAndSanitizeSignedResourceType($signedResourceType);

        // validate and sanitize signed permissions
        $signedPermissions = $this->validateAndSanitizeSignedPermissions($signedPermissions);

        // check that expiracy is valid
        if ($signedExpiry instanceof \Datetime) {
            $signedExpiry = Utilities::isoDate($signedExpiry);
        }
        Validate::canCastAsString($signedExpiry, 'signedExpiry');
        Validate::notNullOrEmpty($signedExpiry, 'signedExpiry');
        Validate::isDateString($signedExpiry, 'signedExpiry');

        // check that signed start is valid
        if ($signedStart instanceof \Datetime) {
            $signedStart = Utilities::isoDate($signedStart);
        }
        Validate::canCastAsString($signedStart, 'signedStart');
        if (strlen($signedStart) > 0) {
            Validate::isDateString($signedStart, 'signedStart');
        }

        // check that signed IP is valid
        Validate::canCastAsString($signedIP, 'signedIP');

        // validate and sanitize signed protocol
        $signedProtocol = $this->validateAndSanitizeSignedProtocol($signedProtocol);

        // construct an array with the parameters to generate the shared access signature at the account level
        $parameters = array();
        $parameters[] = $this->accountName;
        $parameters[] = $signedPermissions;
        $parameters[] = $signedService;
        $parameters[] = $signedResourceType;
        $parameters[] = $signedStart;
        $parameters[] = $signedExpiry;
        $parameters[] = $signedIP;
        $parameters[] = $signedProtocol;
        $parameters[] = $signedVersion;

        // implode the parameters into a string
        $stringToSign = utf8_encode(implode("\n", $parameters) . "\n");

        // decode the account key from base64
        $decodedAccountKey = base64_decode($this->accountKey);

        // create the signature with hmac sha256
        $signature = hash_hmac("sha256", $stringToSign, $decodedAccountKey, true);

        // encode the signature as base64 and url encode.
        $sig = urlencode(base64_encode($signature));

        //adding all the components for account SAS together.
        $sas  = 'sv=' . $signedVersion;
        $sas .= '&ss=' . $signedService;
        $sas .= '&srt=' . $signedResourceType;
        $sas .= '&sp=' . $signedPermissions;
        $sas .= '&se=' . $signedExpiry;
        $sas .= $signedStart === ''? '' : '&st=' . $signedStart;
        $sas .= $signedIP === ''? '' : '&sip=' . $signedIP;
        $sas .= '&spr=' . $signedProtocol;
        $sas .= '&sig=' . $sig;

        // return the signature
        return $sas;
    }
public function generateAccountSharedAccessSignatureToken ( $ signedVersion , $ signedPermissions , $ signedService , $ signedResourceType , $ signedExpiry , $ signedStart = "" , $ signedIP = "" , $ signedProtocol = "" ) { // check that version is valid Validate :: canCastAsString ( $ signedVersion , 'signedVersion' ) ; Validate :: notNullOrEmpty ( $ signedVersion , 'signedVersion' ) ; Validate :: isDateString ( $ signedVersion , 'signedVersion' ) ; // validate and sanitize signed service $ signedService = $ this -> validateAndSanitizeSignedService ( $ signedService ) ; // validate and sanitize signed resource type $ signedResourceType = $ this -> validateAndSanitizeSignedResourceType ( $ signedResourceType ) ; // validate and sanitize signed permissions $ signedPermissions = $ this -> validateAndSanitizeSignedPermissions ( $ signedPermissions ) ; // check that expiracy is valid if ( $ signedExpiry instanceof \ Datetime ) { $ signedExpiry = Utilities :: isoDate ( $ signedExpiry ) ; } Validate :: canCastAsString ( $ signedExpiry , 'signedExpiry' ) ; Validate :: notNullOrEmpty ( $ signedExpiry , 'signedExpiry' ) ; Validate :: isDateString ( $ signedExpiry , 'signedExpiry' ) ; // check that signed start is valid if ( $ signedStart instanceof \ Datetime ) { $ signedStart = Utilities :: isoDate ( $ signedStart ) ; } Validate :: canCastAsString ( $ signedStart , 'signedStart' ) ; if ( strlen ( $ signedStart ) > 0 ) { Validate :: isDateString ( $ signedStart , 'signedStart' ) ; } // check that signed IP is valid Validate :: canCastAsString ( $ signedIP , 'signedIP' ) ; // validate and sanitize signed protocol $ signedProtocol = $ this -> validateAndSanitizeSignedProtocol ( $ signedProtocol ) ; // construct an array with the parameters to generate the shared access signature at the account level $ parameters = array ( ) ; $ parameters [ ] = $ this -> accountName ; $ parameters [ ] = $ signedPermissions ; $ parameters [ ] = $ signedService ; $ parameters [ ] = $ signedResourceType ; $ parameters [ ] = $ signedStart ; $ parameters [ ] = $ signedExpiry ; $ parameters [ ] = $ signedIP ; $ parameters [ ] = $ signedProtocol ; $ parameters [ ] = $ signedVersion ; // implode the parameters into a string $ stringToSign = utf8_encode ( implode ( "\n" , $ parameters ) . "\n" ) ; // decode the account key from base64 $ decodedAccountKey = base64_decode ( $ this -> accountKey ) ; // create the signature with hmac sha256 $ signature = hash_hmac ( "sha256" , $ stringToSign , $ decodedAccountKey , true ) ; // encode the signature as base64 and url encode. $ sig = urlencode ( base64_encode ( $ signature ) ) ; //adding all the components for account SAS together. $ sas = 'sv=' . $ signedVersion ; $ sas .= '&ss=' . $ signedService ; $ sas .= '&srt=' . $ signedResourceType ; $ sas .= '&sp=' . $ signedPermissions ; $ sas .= '&se=' . $ signedExpiry ; $ sas .= $ signedStart === '' ? '' : '&st=' . $ signedStart ; $ sas .= $ signedIP === '' ? '' : '&sip=' . $ signedIP ; $ sas .= '&spr=' . $ signedProtocol ; $ sas .= '&sig=' . $ sig ; // return the signature return $ sas ; }
Generates a shared access signature at the account level.

@param string $signedVersion           Specifies the signed version to use.
@param string $signedPermissions       Specifies the signed permissions for
the account SAS.
@param string $signedService           Specifies the signed services
accessible with the account SAS.
@param string $signedResourceType      Specifies the signed resource types
that are accessible with the account
SAS.
@param \Datetime|string $signedExpiry  The time at which the shared access
signature becomes invalid, in an ISO
8601 format.
@param \Datetime|string $signedStart   The time at which the SAS becomes
valid, in an ISO 8601 format.
@param string $signedIP                Specifies an IP address or a range
of IP addresses from which to accept
requests.
@param string $signedProtocol          Specifies the protocol permitted for
a request made with the account SAS.

@see Constructing an account SAS at
https://docs.microsoft.com/en-us/rest/api/storageservices/fileservices/constructing-an-account-sas

@return string
Generates a shared access signature at the account level .