Number160 cKey = Number160.createHash("content");
// initial put using content protection keys 1
String testData1 = "data1";
Data data = new Data(testData1).setProtectedEntry();
FuturePut futurePut1 = p1.put(lKey).setData(cKey, data).setDomainKey(dKey).keyPair(keyPair1).start();
futurePut1.awaitUninterruptibly();
assertTrue(futurePut1.isSuccess());
FutureGet futureGet1a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
futureGet1a.awaitUninterruptibly();
assertTrue(futureGet1a.isSuccess());
Data retData = futureGet1a.getData();
assertEquals(testData1, (String) retData.object());
assertEquals(keyPair1.getPublic(), retData.publicKey());
FutureGet futureGet1b = p2.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
futureGet1b.awaitUninterruptibly();
assertTrue(futureGet1b.isSuccess());
retData = futureGet1b.getData();
assertEquals(testData1, (String) retData.object());
assertEquals(keyPair1.getPublic(), retData.publicKey());
// try to put with wrong content protection keys 2
String testData2 = "data2";
Data data2 = new Data(testData2).setProtectedEntry().sign(keyPair2, factory);
FuturePut futurePut2 = p2.put(lKey).setData(cKey, data2).setDomainKey(dKey).keyPair(keyPair2).start();
futurePut2.awaitUninterruptibly();
assertFalse(futurePut2.isSuccess());
FutureGet futureGet2a = p1.get(lKey).setContentKey(cKey).setDomainKey(dKey).start();
futureGet2a.awaitUninterruptibly();
assertTrue(futureGet2a.isSuccess());
// should have been not modified