Skip to content

Commit

Permalink
Revert "add auto decryption with anonymous agent"
Browse files Browse the repository at this point in the history
This reverts commit 22109de.
  • Loading branch information
tcuje committed Oct 16, 2016
1 parent ad03a54 commit 20c5d78
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 31 deletions.
13 changes: 2 additions & 11 deletions src/main/java/i5/las2peer/persistency/Envelope.java
Original file line number Diff line number Diff line change
Expand Up @@ -229,18 +229,9 @@ public Serializable getContent() throws CryptoException, L2pSecurityException, S

public Serializable getContent(Agent reader) throws CryptoException, L2pSecurityException, SerializationException {
try {
try {
return getContent(AgentContext.getCurrent().getLocalNode().getAnonymous(),
AgentContext.getCurrent().getLocalNode());
} catch (CryptoException | L2pSecurityException | SerializationException e) {
return getContent(reader, AgentContext.getCurrent().getLocalNode());
}
return getContent(reader, AgentContext.getCurrent().getLocalNode());
} catch (IllegalStateException e) {
try {
return getContent(reader.getRunningAtNode().getAnonymous(), reader.getRunningAtNode());
} catch (CryptoException | L2pSecurityException | SerializationException e2) {
return getContent(reader, reader.getRunningAtNode());
}
return getContent(reader, reader.getRunningAtNode());
}
}

Expand Down
20 changes: 0 additions & 20 deletions src/test/java/i5/las2peer/persistency/EnvelopeTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -605,24 +605,4 @@ public void testWriteWithGroup() {
}
}

/**
* test read with anonymous
*/
@Test
public void testReadWithAnonymous() {
try {
PastryNodeImpl node1 = nodes.get(0);
UserAgent smith = MockAgentFactory.getAdam();
smith.unlockPrivateKey("adamspass");
smith.notifyRegistrationTo(node1);
final String testContent = "encrypted with anonymous reader";
Envelope toStore = node1.createEnvelope("test", testContent, node1.getAnonymous());
String decryptedContent = (String) toStore.getContent(smith);
Assert.assertEquals(testContent, decryptedContent);
} catch (Exception e) {
e.printStackTrace();
Assert.fail(e.toString());
}
}

}

0 comments on commit 20c5d78

Please sign in to comment.