Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #518 from erezvani1529/master
Browse files Browse the repository at this point in the history
[8.3] Netstandard MD5 Calculation Enhancement
  • Loading branch information
jofriedm-msft authored Aug 9, 2017
2 parents 3cb0223 + eafcb2a commit 7fc6fee
Show file tree
Hide file tree
Showing 28 changed files with 72 additions and 51 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 8.2.1";
public const string AgentMetadataValue = ".NET 8.3.0";
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public static class EncryptionConstants
public const string TableEncryptionKeyDetails = "_ClientEncryptionMetadata1";
public const string TableEncryptionPropertyDetails = "_ClientEncryptionMetadata2";
public const string AgentMetadataKey = "EncryptionLibrary";
public const string AgentMetadataValue = ".NET 8.2.1";
public const string AgentMetadataValue = ".NET 8.3.0";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ namespace Microsoft.WindowsAzure.Storage.Shared.Protocol

public static class HeaderConstants
{
public static readonly string UserAgent = "Azure-Storage/8.2.1 ";
public static readonly string UserAgent = "Azure-Storage/8.3.0 ";
public const string UserAgentProductName = "Azure-Storage";
public const string UserAgentProductVersion = "8.2.1";
public const string UserAgentProductVersion = "8.3.0";
public const string PrefixForStorageHeader = "x-ms-";
public const string TrueHeader = "true";
public const string FalseHeader = "false";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: InternalsVisibleTo(
"Microsoft.WindowsAzure.Storage.Facade.Portable, PublicKey=" +
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Microsoft.WindowsAzure.Storage",
"version": "8.2.1.0",
"version": "8.3.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
6 changes: 3 additions & 3 deletions Lib/AspNet/Microsoft.WindowsAzure.Storage/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyInformationalVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]
[assembly: AssemblyInformationalVersion("8.3.0.0")]


[assembly: InternalsVisibleTo(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>WindowsAzure.Storage</id>
<version>8.2.1</version>
<version>8.3.0</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down
2 changes: 1 addition & 1 deletion Lib/AspNet/Microsoft.WindowsAzure.Storage/project.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "8.2.1.0",
"version": "8.3.0.0",

"authors": [ "Microsoft Corporation" ],
"description": "Azure Storage SDK for NetCore",
Expand Down
23 changes: 19 additions & 4 deletions Lib/ClassLibraryCommon/Core/Util/AsyncStreamCopier.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ namespace Microsoft.WindowsAzure.Storage.Core.Util
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Runtime.ExceptionServices;
using System.Threading;
using System.Threading.Tasks;

Expand Down Expand Up @@ -217,7 +218,7 @@ public async Task StartCopyStreamAsync(long? copyLength, long? maxLength)
{
this.cancellationTokenSourceCombined = this.cancellationTokenSourceAbort;
}

await this.StartCopyStreamAsyncHelper(copyLength, maxLength, this.cancellationTokenSourceCombined.Token).ConfigureAwait(false);
}

Expand Down Expand Up @@ -253,14 +254,15 @@ private async Task StartCopyStreamAsyncHelper(long? copyLength, long? maxLength,
byte[] swap;

int bytesToCopy = CalculateBytesToCopy(copyLength, 0);
int bytesCopied = await this.src.ReadAsync(readBuff, 0, bytesToCopy, token).ConfigureAwait(false);
int bytesCopied = await this.src.ReadAsync(readBuff, 0, bytesToCopy, token).ConfigureAwait(false);

long totalBytes = bytesCopied;
CheckMaxLength(maxLength, totalBytes);

swap = readBuff;
readBuff = writeBuff;
writeBuff = swap;
ExceptionDispatchInfo readException = null;

while (bytesCopied > 0)
{
Expand All @@ -269,10 +271,17 @@ private async Task StartCopyStreamAsyncHelper(long? copyLength, long? maxLength,
Task writeTask = this.dest.WriteAsync(writeBuff, 0, bytesCopied, token);

bytesToCopy = CalculateBytesToCopy(copyLength, totalBytes);
Task<int> readTask;
Task<int> readTask = null;
if (bytesToCopy > 0)
{
readTask = this.src.ReadAsync(readBuff, 0, bytesToCopy, token);
try
{
readTask = this.src.ReadAsync(readBuff, 0, bytesToCopy, token);
}
catch(Exception ex)
{
readException = ExceptionDispatchInfo.Capture(ex);
}
}
else
{
Expand All @@ -283,7 +292,13 @@ private async Task StartCopyStreamAsyncHelper(long? copyLength, long? maxLength,

UpdateStreamCopyState(writeBuff, bytesCopied);

if (readException != null)
{
readException.Throw();
}

bytesCopied = await readTask.WithCancellation(token).ConfigureAwait(false);

totalBytes = totalBytes + bytesCopied;

CheckMaxLength(maxLength, totalBytes);
Expand Down
8 changes: 5 additions & 3 deletions Lib/Common/Core/Util/MD5Wrapper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ internal class MD5Wrapper : IDisposable

#if WINDOWS_RT
private CryptographicHash hash = null;
#elif NETCORE
private IncrementalHash hash = null;

#elif (WINDOWS_PHONE && WINDOWS_DESKTOP)

Expand All @@ -58,7 +60,7 @@ internal MD5Wrapper()
#elif WINDOWS_PHONE
throw new NotSupportedException(SR.WindowsPhoneDoesNotSupportMD5);
#elif NETCORE
this.hash = MD5.Create();
this.hash = IncrementalHash.CreateHash(HashAlgorithmName.MD5);
#else
this.hash = this.version1MD5 ? MD5.Create() : new NativeMD5();
#endif
Expand All @@ -79,7 +81,7 @@ internal void UpdateHash(byte[] input, int offset, int count)
#elif WINDOWS_PHONE && WINDOWS_DESKTOP
throw new NotSupportedException(SR.WindowsPhoneDoesNotSupportMD5);
#elif NETCORE
inputStream.Write(input, offset, count);
this.hash.AppendData(input, offset, count);
#else
this.hash.TransformBlock(input, offset, count, null, 0);
#endif
Expand All @@ -98,7 +100,7 @@ internal string ComputeHash()
#elif WINDOWS_PHONE && WINDOWS_DESKTOP
throw new NotSupportedException(SR.WindowsPhoneDoesNotSupportMD5);
#elif NETCORE
return Convert.ToBase64String(this.hash.ComputeHash(inputStream.ToArray()));
return Convert.ToBase64String(this.hash.GetHashAndReset());
#else
this.hash.TransformFinalBlock(new byte[0], 0, 0);
return Convert.ToBase64String(this.hash.Hash);
Expand Down
2 changes: 1 addition & 1 deletion Lib/Common/Shared/Protocol/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ static HeaderConstants()
/// <summary>
/// Specifies the value to use for UserAgent header.
/// </summary>
public const string UserAgentProductVersion = "8.2.1";
public const string UserAgentProductVersion = "8.3.0";

/// <summary>
/// Master Microsoft Azure Storage header prefix.
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsDesktop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

#if SIGN
[assembly: InternalsVisibleTo(
Expand Down
2 changes: 1 addition & 1 deletion Lib/WindowsDesktop/WindowsAzure.Storage.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata minClientVersion="2.12">
<id>WindowsAzure.Storage</id>
<version>8.2.1</version>
<version>8.3.0</version>
<title>Windows Azure Storage</title>
<authors>Microsoft</authors>
<owners>Microsoft</owners>
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsPhone/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: NeutralResourcesLanguageAttribute("en-US")]

Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsPhoneRT/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: NeutralResourcesLanguageAttribute("en-US")]
[assembly: ComVisible(false)]
Expand Down
4 changes: 2 additions & 2 deletions Lib/WindowsRuntime/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: ComVisible(false)]

Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Microsoft Azure Storage SDK for .NET (8.2.0)
# Microsoft Azure Storage SDK for .NET (8.3.0)

The Microsoft Azure Storage SDK for .NET allows you to build Azure applications
that take advantage of scalable cloud computing resources.
Expand Down Expand Up @@ -56,7 +56,7 @@ Through the bait and switch technique, the reference assembly enables other port
## Use with the Azure Storage Emulator

- The Client Library uses a particular Storage Service version. In order to use the Storage Client Library with the Storage Emulator, a corresponding minimum version of the Azure Storage Emulator must be used. Older versions of the Storage Emulator do not have the necessary code to successfully respond to new requests.
- Currently, the minimum version of the Azure Storage Emulator needed for this library is 5.4. If you encounter a `VersionNotSupportedByEmulator` (400 Bad Request) error, please [update the Storage Emulator.](https://azure.microsoft.com/en-us/downloads/)
- Currently, the minimum version of the Azure Storage Emulator needed for this library is 5.2. If you encounter a `VersionNotSupportedByEmulator` (400 Bad Request) error, please [update the Storage Emulator.](https://azure.microsoft.com/en-us/downloads/)

## Download & Install

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"title": "Microsoft.WindowsAzure.Storage.Facade.NetCore.Test",
"version": "8.2.0.0",
"version": "8.3.0.0",
"testRunner": "xunit",

"dependencies": {
Expand All @@ -16,7 +16,7 @@
"type": "platform",
"version": "1.0.0"
},
"WindowsAzure.Storage": "8.2.0-facade"
"WindowsAzure.Storage": "8.3.0-facade"
},

"imports": "dnxcore50"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"version": "8.2.0.0",
"version": "8.3.0.0",
"supports": {},
"dependencies": {
"WindowsAzure.Storage": "8.2.0-facade"
"WindowsAzure.Storage": "8.3.0-facade"
},
"frameworks": {
".NETPortable,Version=v4.5,Profile=Profile259": {}
Expand Down
4 changes: 2 additions & 2 deletions Test/WindowsDesktop/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

4 changes: 2 additions & 2 deletions Test/WindowsPhone/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: NeutralResourcesLanguageAttribute("en-US")]
4 changes: 2 additions & 2 deletions Test/WindowsPhone81/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
// by using the '*' as shown below:


[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: NeutralResourcesLanguageAttribute("en-US")]
4 changes: 2 additions & 2 deletions Test/WindowsPhoneRT.Test/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.0.0")]
[assembly: AssemblyFileVersion("8.2.0.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: ComVisible(false)]
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>RT_Test_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>B5B21C28168D08574A37185106B2A4319FD4331C</PackageCertificateThumbprint>
<PackageCertificateThumbprint>7439A8A53DE85A82C0D106973170847C18D74A2D</PackageCertificateThumbprint>
<AppxAutoIncrementPackageRevision>True</AppxAutoIncrementPackageRevision>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
Expand Down Expand Up @@ -164,6 +164,7 @@
</Content>
</ItemGroup>
<ItemGroup>
<None Include="RT_Test_TemporaryKey.pfx" />
<None Include="MSSharedLibKey.snk" />
<None Include="RT_Test_TemporaryKey.pfx" />
</ItemGroup>
Expand Down
Binary file not shown.
4 changes: 2 additions & 2 deletions Test/WindowsRuntime/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]

[assembly: AssemblyVersion("8.2.1.0")]
[assembly: AssemblyFileVersion("8.2.1.0")]
[assembly: AssemblyVersion("8.3.0.0")]
[assembly: AssemblyFileVersion("8.3.0.0")]

[assembly: ComVisible(false)]
Binary file modified Test/WindowsRuntime/RT_Test_TemporaryKey.pfx
Binary file not shown.
13 changes: 8 additions & 5 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
Changes in 8.3.0 :
- All(Netstandard): Updated the hashing algorithm to IncrementalHash instead of the original method which required buffering the data for MD5 calculations.
- All: Fixed a race condition in the resume-download logic where a failure during downloads could lead to corrupted data.

Changes in 8.2.1 :
- All: Fixed a bug where empty metadata headers would lead to an infinite loop when trying to list blobs on a container.

Changes in 8.2.0 :
- All: Support for 2017-04-17 REST version. Please see our REST API documentation and blogs for information about the related added features. If you are using the Storage Emulator, please update to Emulator version 5.4.
- All: Support for 2017-04-17 REST version. Please see our REST API documentation and blogs for information about the related added features. If you are using the Storage Emulator, please update to Emulator version 5.2.
- Files: Added support for server side encryption.
- PageBlobs: For Premium Accounts only, added support for getting and setting the tier on a page blob. The tier can also be set when creating or copying from an existing page blob.
- Tables (NetCore): Fixed a bug where the empty etag added to the table delete operation would throw exception on Xamarin/Mono.
- All: Fixed a bug where calling OpenWrite with an IfNotExists access condition on an existing block blob only fails when the blob is committed, now it fails with error 409 as soon as OpenWrite is called.
- Tables (NetCore): Fixed a bug where the empty etag added to the table delete operation would throw an exception on Xamarin/Mono.
- All: Fixed a bug where calling OpenWrite with an IfNotExists access condition on an existing block blob only fails when the blob is committed. Now it fails with error 409 as soon as OpenWrite is called.
- Files (WinRT/NetCore): Calling CreateIfNotExistsAsync on a root directory no longer throws the error 405. It returns false if the share exists, or throws 404 if not.
- All: Connection string support expanded to allow AccountName to be specified with SharedAccessSignature and DefaultEndpointsProtocol. In this case, SharedAccessSignature is used for credentials, while having both DefaultEndpointsProtocol and AccountName allows the library to infer a set of default endpoints. Additionally, we have added support for BlobSecondaryEndpoint, QueueSecondaryEndpoint, TableSecondaryEndpoint, and FileSecondaryEndpoint. Specifying a secondary endpoint requires the specification of the corresponding primary.
- All: The use of DefaultEndpointsProtocol in a connection string is now optional in the case where endpoints would be automatically generated; if missing, a value of https will be inferred. When the parsed account settings in such a case are used to generate a connection string, the value of DefaultEndpointsProtocol will be explicitly included.
Expand All @@ -20,7 +24,7 @@ Changes in 8.1.3 :
- All(Desktop) : Fixed a memory leak issue where the SendStream was not being disposed during retries, cancellations and Table Operations.

Changes in 8.1.1 :
- All (NetStandard/NetCore): Removed Microsoft.Data.Services.Client as a temporary fix to ODataLib dependency incompatibility with NetStandard
- All (NetStandard/NetCore): Removed Microsoft.Data.Services.Client as a temporary fix to ODataLib dependency incompatibility with NetStandard.

Changes in 8.1.0 :
- All: Updated OData references to the latest Netstandard friendly package version 5.8.2.
Expand All @@ -30,7 +34,6 @@ Changes in 8.0.1 :
- (NetStandard/Xamarin) : Fix for a break in Xamarin Apps with Streaming APIs caused by NotImplemented IncrementalHash APIs in Xamarin Runtime.

Changes in 8.0.0 :

- All: Support for 2016-05-31 REST version. Please see our REST API documentation and blogs for information about the related added features. If you are using the Storage Emulator, please update to Emulator version 4.6.
- All: (Desktop) Updated the desktop library to target .Net 4.5.0.
- All: Added a new Netstandard 1.0 Target Framework (facade) as PCL support.
Expand Down

0 comments on commit 7fc6fee

Please sign in to comment.