Hi,
I have a windows azure service that is trying to generate a shared access signature but it generates the incorrect time.
var sas = blob.GetSharedAccessSignature(new SharedAccessPolicy()
{
Permissions = SharedAccessPermissions.Read,
SharedAccessExpiryTime = DateTime.UtcNow + TimeSpan.FromMinutes(accessWindowMinutes)
});
Using the above code I get the signature of:
se=2011-12-15T02%3A08%3A31Z&sr=b&sp=r&sig=3LMVRxjJ5qXu322deILMf8hA3aiCi8LKfwAIEmANsx8%3D
however accessing the blob gives the following error:
<Error><Code>AuthenticationFailed</Code>
<Message>Server failed to authenticate the request. Make sure the value of Authorization header is formed correctly including the signature.
RequestId:ab4dce20-5629-4839-bb43-7e7d41d50762
Time:2011-12-15T01:08:39.6475705Z
</Message>
<AuthenticationErrorDetail>Signature did not match. String to sign used was r2011-12-15T02:08:31Z/REMOVEDADDRESS
</AuthenticationErrorDetail></Error>
It looks like my DateTime.UtcNow gives a different time to what azure is using.
Any help would be greatly appreciated.