microsoft-azure-storage/src/com/microsoft/azure/storage/queue/CloudQueue.java
public String generateSharedAccessSignature(
            final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
            final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
            throw new IllegalArgumentException(errorMessage);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(
                policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(
                policy, groupPolicyIdentifier, ipRange, protocols, signature);

        return builder.toString();
    }
public String generateSharedAccessSignature(
            final SharedAccessQueuePolicy policy, final String groupPolicyIdentifier, final IPRange ipRange,
            final SharedAccessProtocols protocols)
            throws InvalidKeyException, StorageException {

        if (!StorageCredentialsHelper.canCredentialsSignRequest(this.queueServiceClient.getCredentials())) {
            final String errorMessage = SR.CANNOT_CREATE_SAS_WITHOUT_ACCOUNT_KEY;
            throw new IllegalArgumentException(errorMessage);
        }

        final String resourceName = this.getSharedAccessCanonicalName();

        final String signature = SharedAccessSignatureHelper.generateSharedAccessSignatureHashForQueue(
                policy, groupPolicyIdentifier, resourceName, ipRange, protocols, this.queueServiceClient);

        final UriQueryBuilder builder = SharedAccessSignatureHelper.generateSharedAccessSignatureForQueue(
                policy, groupPolicyIdentifier, ipRange, protocols, signature);

        return builder.toString();
    }
Returns a shared access signature for the queue.

@param policy
The access policy for the shared access signature.
@param groupPolicyIdentifier
A queue-level access policy.
@param ipRange
A {@link IPRange} object containing the range of allowed IP addresses.
@param protocols
A {@link SharedAccessProtocols} representing the allowed Internet protocols.

@return A shared access signature for the queue.

@throws InvalidKeyException
If an invalid key was passed.
@throws StorageException
If a storage service error occurred.
@throws IllegalArgumentException
If an unexpected value is passed.