Skip to content
This repository was archived by the owner on Jul 19, 2024. It is now read-only.

Commit 149df12

Browse files
committed
Merge dev_breaking for 7.0
2 parents a1c74f5 + 12afa9a commit 149df12

File tree

8 files changed

+43
-32
lines changed

8 files changed

+43
-32
lines changed

BreakingChanges.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
Changes in 6.0.0
1+
Changes in 7.0.0
2+
3+
OTHER
4+
* Upgraded Key Vault dependency to 1.0.
5+
6+
Changes in 6.0.0
27

38
FILE
49
* Many File service APIs can now throw a URISyntaxException.

ChangeLog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ XXXX.XX.xx Version X.X.X
44
* Improved performance of blob uploadFromFile APIs to avoid unnecessary buffering.
55
* Improved performance when streaming directly from a FileInputStream to avoid unnecessary buffering.
66
* Switched to using fixed length streaming mode in the HTTP client to avoid unnecessary buffering.
7+
* Upgraded Key Vault dependency to 1.0.
78

89
2017.11.01 Version 6.1.0
910
* Added support for the last time the tier was modified.

microsoft-azure-storage-test/src/com/microsoft/azure/storage/DictionaryKeyResolver.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
import java.util.HashMap;
1818
import java.util.Map;
19-
import java.util.concurrent.Future;
2019

21-
import org.apache.commons.lang3.concurrent.ConcurrentUtils;
20+
import com.google.common.util.concurrent.ListenableFuture;
21+
import com.google.common.util.concurrent.SettableFuture;
2222

2323
import com.microsoft.azure.keyvault.core.IKey;
2424
import com.microsoft.azure.keyvault.core.IKeyResolver;
@@ -32,8 +32,10 @@ public void add(IKey key)
3232
}
3333

3434
@Override
35-
public Future<IKey> resolveKeyAsync(String keyId)
35+
public ListenableFuture<IKey> resolveKeyAsync(String keyId)
3636
{
37-
return ConcurrentUtils.constantFuture(this.keys.get(keyId));
37+
SettableFuture<IKey> future = SettableFuture.create();
38+
future.set(this.keys.get(keyId));
39+
return future;
3840
}
3941
}

microsoft-azure-storage-test/src/com/microsoft/azure/storage/TestHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@
4747
import org.w3c.dom.NodeList;
4848
import org.xml.sax.SAXException;
4949

50-
import com.microsoft.azure.keyvault.extensions.RsaKey;
51-
import com.microsoft.azure.keyvault.extensions.SymmetricKey;
50+
import com.microsoft.azure.keyvault.cryptography.RsaKey;
51+
import com.microsoft.azure.keyvault.cryptography.SymmetricKey;
5252
import com.microsoft.azure.storage.analytics.CloudAnalyticsClient;
5353
import com.microsoft.azure.storage.blob.CloudBlobClient;
5454
import com.microsoft.azure.storage.file.CloudFileClient;

microsoft-azure-storage-test/src/com/microsoft/azure/storage/blob/CloudBlobClientEncryptionTests.java

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
import java.nio.charset.Charset;
2727
import java.security.InvalidAlgorithmParameterException;
2828
import java.security.InvalidKeyException;
29+
import java.security.KeyPairGenerator;
2930
import java.security.NoSuchAlgorithmException;
3031
import java.util.UUID;
3132
import java.util.concurrent.ExecutionException;
33+
import java.util.concurrent.atomic.AtomicInteger;
3234

3335
import javax.crypto.Cipher;
3436
import javax.crypto.CipherInputStream;
@@ -37,15 +39,14 @@
3739
import javax.crypto.spec.IvParameterSpec;
3840
import javax.crypto.spec.SecretKeySpec;
3941

40-
import org.apache.commons.lang.mutable.MutableInt;
4142
import org.junit.After;
4243
import org.junit.Before;
4344
import org.junit.Test;
4445
import org.junit.experimental.categories.Category;
4546

4647
import com.microsoft.azure.keyvault.core.IKey;
47-
import com.microsoft.azure.keyvault.extensions.RsaKey;
48-
import com.microsoft.azure.keyvault.extensions.SymmetricKey;
48+
import com.microsoft.azure.keyvault.cryptography.RsaKey;
49+
import com.microsoft.azure.keyvault.cryptography.SymmetricKey;
4950
import com.microsoft.azure.storage.Constants;
5051
import com.microsoft.azure.storage.DictionaryKeyResolver;
5152
import com.microsoft.azure.storage.OperationContext;
@@ -156,9 +157,12 @@ public void testDownloadUnencryptedBlobWithEncryptionPolicy() throws StorageExce
156157
// Upload data without encryption
157158
blob.uploadFromByteArray(msg, 0, msg.length);
158159

160+
// Create an asymmetric encryption key. The provider must be specified to work around an issue in RsaKey.
161+
RsaKey rsaKey = new RsaKey("myKey", 1024, KeyPairGenerator.getInstance("RSA").getProvider());
162+
159163
// Create options with encryption policy
160164
BlobRequestOptions options = new BlobRequestOptions();
161-
options.setEncryptionPolicy(new BlobEncryptionPolicy(new RsaKey("myKey", 1024), null));
165+
options.setEncryptionPolicy(new BlobEncryptionPolicy(rsaKey, null));
162166
options.setRequireEncryption(true);
163167

164168
try {
@@ -605,7 +609,7 @@ else if (type == BlobType.APPEND_BLOB) {
605609
// Wait for writes to complete asynchronously
606610
Thread.sleep(10000);
607611

608-
// Page blobs have one extra call due to create.
612+
// Page and append blobs have one extra call due to create.
609613
if (type == BlobType.BLOCK_BLOB) {
610614
assertEquals(1, opContext.getRequestResults().size());
611615
}
@@ -622,7 +626,7 @@ else if (type == BlobType.APPEND_BLOB) {
622626
// Wait for writes to complete asynchronously
623627
Thread.sleep(10000);
624628

625-
// Page blobs have one extra call due to create.
629+
// Page and append blobs have one extra call due to create.
626630
if (type == BlobType.BLOCK_BLOB) {
627631
assertEquals(2, opContext.getRequestResults().size());
628632
}
@@ -635,8 +639,6 @@ else if (type == BlobType.APPEND_BLOB) {
635639
// Block blobs have an additional PutBlockList call.
636640
assertEquals(4, opContext.getRequestResults().size());
637641

638-
assertEquals(4, opContext.getRequestResults().size());
639-
640642
ByteArrayOutputStream downloadedBlob = new ByteArrayOutputStream();
641643
blob.download(downloadedBlob, null, uploadOptions, null);
642644
assertArrayEquals(wholeBlob.toByteArray(), downloadedBlob.toByteArray());
@@ -1012,13 +1014,13 @@ private void doEncryptionTestCountOperations(int size, int count, boolean encryp
10121014

10131015
OperationContext opContext = new OperationContext();
10141016

1015-
final MutableInt operationCount = new MutableInt(0);
1017+
final AtomicInteger operationCount = new AtomicInteger();
10161018

10171019
opContext.getSendingRequestEventHandler().addListener(new StorageEvent<SendingRequestEvent>() {
10181020

10191021
@Override
10201022
public void eventOccurred(SendingRequestEvent eventArg) {
1021-
operationCount.increment();
1023+
operationCount.incrementAndGet();
10221024
}
10231025
});
10241026

microsoft-azure-storage-test/src/com/microsoft/azure/storage/queue/CloudQueueEncryptionTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@
4242

4343
import com.fasterxml.jackson.core.JsonProcessingException;
4444
import com.microsoft.azure.keyvault.core.IKey;
45-
import com.microsoft.azure.keyvault.extensions.RsaKey;
46-
import com.microsoft.azure.keyvault.extensions.SymmetricKey;
45+
import com.microsoft.azure.keyvault.cryptography.RsaKey;
46+
import com.microsoft.azure.keyvault.cryptography.SymmetricKey;
4747
import com.microsoft.azure.storage.DictionaryKeyResolver;
4848
import com.microsoft.azure.storage.StorageException;
4949
import com.microsoft.azure.storage.TestHelper;

microsoft-azure-storage-test/src/com/microsoft/azure/storage/table/TableEncryptionTests.java

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@
3232
import org.junit.Before;
3333
import org.junit.Test;
3434

35-
import com.microsoft.azure.keyvault.extensions.SymmetricKey;
35+
import com.google.common.io.BaseEncoding;
36+
37+
import com.microsoft.azure.keyvault.cryptography.SymmetricKey;
3638
import com.microsoft.azure.storage.Constants;
3739
import com.microsoft.azure.storage.DictionaryKeyResolver;
3840
import com.microsoft.azure.storage.ResultContinuation;
@@ -45,7 +47,6 @@
4547
import com.microsoft.azure.storage.table.TableTestHelper.Class1;
4648
import com.microsoft.azure.storage.table.TableTestHelper.EncryptedClass1;
4749
import com.microsoft.azure.storage.table.TableTestHelper.ComplexEntity;
48-
import com.sun.jersey.core.util.Base64;
4950

5051
public class TableEncryptionTests {
5152
CloudTable table = null;
@@ -1096,27 +1097,27 @@ public void testCrossPlatformCompatibility() throws StorageException, URISyntaxE
10961097

10971098
// Hard code some sample data, then see if we can decrypt it.
10981099
// This key is used only for test, do not use to encrypt any sensitive data.
1099-
SymmetricKey sampleKEK = new SymmetricKey("key1", Base64.decode("rFz7+tv4hRiWdWUJMFlxl1xxtU/qFUeTriGaxwEcxjU="));
1100+
SymmetricKey sampleKEK = new SymmetricKey("key1", BaseEncoding.base64().decode("rFz7+tv4hRiWdWUJMFlxl1xxtU/qFUeTriGaxwEcxjU="));
11001101

11011102
// This data here was created using Fiddler to capture the .NET library uploading an encrypted entity, encrypted with the specified KEK and CEK.
11021103
// Note that this data is lacking the library information in the KeyWrappingMetadata.
11031104
DynamicTableEntity dteNetOld = new DynamicTableEntity("pk", "netUp");
1104-
dteNetOld.getProperties().put("sampleProp", new EntityProperty(Base64.decode("27cLSlSFqy9C0xUCr57XAA==")));
1105-
dteNetOld.getProperties().put("sampleProp2", new EntityProperty(Base64.decode("pZR6Ln/DwbwyyOCEezL/hg==")));
1106-
dteNetOld.getProperties().put("sampleProp3", new EntityProperty(Base64.decode("JOix4N8eX/WuCtIvlD2QxQ==")));
1105+
dteNetOld.getProperties().put("sampleProp", new EntityProperty(BaseEncoding.base64().decode("27cLSlSFqy9C0xUCr57XAA==")));
1106+
dteNetOld.getProperties().put("sampleProp2", new EntityProperty(BaseEncoding.base64().decode("pZR6Ln/DwbwyyOCEezL/hg==")));
1107+
dteNetOld.getProperties().put("sampleProp3", new EntityProperty(BaseEncoding.base64().decode("JOix4N8eX/WuCtIvlD2QxQ==")));
11071108
dteNetOld.getProperties().put("_ClientEncryptionMetadata1", new EntityProperty("{\"WrappedContentKey\":{\"KeyId\":\"key1\",\"EncryptedKey\":\"pwSKxpJkwCS2zCaykh0m8e4OApeLuQ4FiahZ9zdwxaLL1HsWqQ4DSw==\",\"Algorithm\":\"A256KW\"},\"EncryptionAgent\":{\"Protocol\":\"1.0\",\"EncryptionAlgorithm\":\"AES_CBC_256\"},\"ContentEncryptionIV\":\"obTAQcYeFQ3IU7Jfcema7Q==\",\"KeyWrappingMetadata\":{}}"));
1108-
dteNetOld.getProperties().put("_ClientEncryptionMetadata2", new EntityProperty(Base64.decode("MWA7LlvXSJnKhf8f7MVhfjWECkxrCyCXGIlYY6ucpr34IVDU7fN6IHvKxV15WiXp")));
1109+
dteNetOld.getProperties().put("_ClientEncryptionMetadata2", new EntityProperty(BaseEncoding.base64().decode("MWA7LlvXSJnKhf8f7MVhfjWECkxrCyCXGIlYY6ucpr34IVDU7fN6IHvKxV15WiXp")));
11091110

11101111
testTable.execute(TableOperation.insert(dteNetOld));
11111112

11121113
// This data here was created using Fiddler to capture the Java library uploading an encrypted entity, encrypted with the specified KEK and CEK.
11131114
// Note that this data is lacking the KeyWrappingMetadata. It also constructs an IV with PK + RK + column name.
11141115
DynamicTableEntity dteJavaOld = new DynamicTableEntity("pk", "javaUp");
1115-
dteJavaOld.getProperties().put("sampleProp", new EntityProperty(Base64.decode("sa3bCvXq79ImSPveChS+cg==")));
1116-
dteJavaOld.getProperties().put("sampleProp2", new EntityProperty(Base64.decode("KXjuBNn9DesCmMcdVpamJw==")));
1117-
dteJavaOld.getProperties().put("sampleProp3", new EntityProperty(Base64.decode("wykVEni1rV+H6oNjoNml6A==")));
1116+
dteJavaOld.getProperties().put("sampleProp", new EntityProperty(BaseEncoding.base64().decode("sa3bCvXq79ImSPveChS+cg==")));
1117+
dteJavaOld.getProperties().put("sampleProp2", new EntityProperty(BaseEncoding.base64().decode("KXjuBNn9DesCmMcdVpamJw==")));
1118+
dteJavaOld.getProperties().put("sampleProp3", new EntityProperty(BaseEncoding.base64().decode("wykVEni1rV+H6oNjoNml6A==")));
11181119
dteJavaOld.getProperties().put("_ClientEncryptionMetadata1", new EntityProperty("{\"WrappedContentKey\":{\"KeyId\":\"key1\",\"EncryptedKey\":\"2F4rIuDmGPgEmhpvTtE7x6281BetKz80EsgRwGxTjL8rRt7Z7GrOgg==\",\"Algorithm\":\"A256KW\"},\"EncryptionAgent\":{\"Protocol\":\"1.0\",\"EncryptionAlgorithm\":\"AES_CBC_256\"},\"ContentEncryptionIV\":\"8st/uXffG+6DxBhw4D1URw==\"}"));
1119-
dteJavaOld.getProperties().put("_ClientEncryptionMetadata2", new EntityProperty(Base64.decode("WznUoytxkvl9KhZ4mNlqkBvRTUHN/D5IgJmNl7kQBOtFBOSgZZrTfZXKH8GjmvKA")));
1120+
dteJavaOld.getProperties().put("_ClientEncryptionMetadata2", new EntityProperty(BaseEncoding.base64().decode("WznUoytxkvl9KhZ4mNlqkBvRTUHN/D5IgJmNl7kQBOtFBOSgZZrTfZXKH8GjmvKA")));
11201121

11211122
testTable.execute(TableOperation.insert(dteJavaOld));
11221123

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,12 @@
7373
<dependency>
7474
<groupId>com.microsoft.azure</groupId>
7575
<artifactId>azure-keyvault-core</artifactId>
76-
<version>0.8.0</version>
76+
<version>1.0.0</version>
7777
</dependency>
7878
<dependency>
7979
<groupId>com.microsoft.azure</groupId>
8080
<artifactId>azure-keyvault-extensions</artifactId>
81-
<version>0.8.0</version>
81+
<version>1.0.0</version>
8282
<scope>test</scope>
8383
</dependency>
8484
</dependencies>

0 commit comments

Comments
 (0)