@@ -1534,6 +1534,41 @@ static byte[] GetRandomBytes(int length)
15341534 CollectionAssert . AreEqual ( plaintext . ToArray ( ) , roundtrippedPlaintext ) ;
15351535 }
15361536
1537+ [ Test ]
1538+ [ Combinatorial ]
1539+ [ LiveOnly ]
1540+ public async Task EncryptionDataCaseInsensitivity (
1541+ [ Values ( "ENCRYPTIONDATA" , "EncryptionData" , "eNcRyPtIoNdAtA" ) ] string newKey ,
1542+ [ ValueSource ( "GetEncryptionVersions" ) ] ClientSideEncryptionVersion version )
1543+ {
1544+ // Arrange
1545+ ReadOnlyMemory < byte > data = GetRandomBuffer ( Constants . KB ) ;
1546+ Mock < IKeyEncryptionKey > mockKey1 = this . GetIKeyEncryptionKey ( s_cancellationToken ) ;
1547+ var encryptionOptions = new ClientSideEncryptionOptions ( version )
1548+ {
1549+ KeyEncryptionKey = mockKey1 . Object ,
1550+ KeyWrapAlgorithm = s_algorithmName
1551+ } ;
1552+
1553+ await using var disposable = await GetTestContainerAsync ( ) ;
1554+
1555+ BlobClient standardBlobClient = disposable . Container . GetBlobClient ( GetNewBlobName ( ) ) ;
1556+ BlobClient encryptedBlobClient = InstrumentClient ( standardBlobClient . WithClientSideEncryptionOptions ( encryptionOptions ) ) ;
1557+
1558+ await encryptedBlobClient . UploadAsync ( BinaryData . FromBytes ( data ) , cancellationToken : s_cancellationToken ) ;
1559+
1560+ // change casing of encryptiondata key
1561+ string rawEncryptiondata = ( await standardBlobClient . GetPropertiesAsync ( ) ) . Value . Metadata [ EncryptionDataKey ] ;
1562+ Assert . IsNotEmpty ( rawEncryptiondata ) ; // quick check we're testing the right thing
1563+ await standardBlobClient . SetMetadataAsync ( new Dictionary < string , string > { { newKey , rawEncryptiondata } } ) ;
1564+
1565+ // Act
1566+ ReadOnlyMemory < byte > downloadedContent = ( await encryptedBlobClient . DownloadContentAsync ( s_cancellationToken ) ) . Value . Content . ToMemory ( ) ;
1567+
1568+ // Assert
1569+ Assert . IsTrue ( data . Span . SequenceEqual ( downloadedContent . Span ) ) ;
1570+ }
1571+
15371572 /// <summary>
15381573 /// There's a few too many things to switch on for key updates. Separate method to determine the correct way to call it.
15391574 /// </summary>
0 commit comments