mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Don't try to erase secrets from memory.
1. The things we're really trying to protect - contact identities, message contents, etc - can't be erased from memory because they're encapsulated inside objects we don't control. 2. Long-term secrets can't be protected by erasing them from memory because they're stored in the database and the database key has to be held in memory whenever the app's running. 3. If the runtime uses a compacting garbage collector then we have no way to ensure an object is erased from memory. 4. Trying to erase secrets from memory makes the code more complex. Conclusion: Let's not try to protect secrets from an attacker who can read arbitrary memory locations.
This commit is contained in:
@@ -116,8 +116,8 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
||||
|
||||
private byte[] write() throws Exception {
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
StreamContext ctx = new StreamContext(contactId, transportId,
|
||||
secret.clone(), 0, true);
|
||||
StreamContext ctx = new StreamContext(contactId, transportId, secret,
|
||||
0, true);
|
||||
OutputStream streamWriter = streamWriterFactory.createStreamWriter(out,
|
||||
MAX_FRAME_LENGTH, ctx);
|
||||
PacketWriter packetWriter = packetWriterFactory.createPacketWriter(
|
||||
@@ -148,8 +148,8 @@ public class ProtocolIntegrationTest extends BriarTestCase {
|
||||
byte[] tag = new byte[TAG_LENGTH];
|
||||
assertEquals(TAG_LENGTH, in.read(tag, 0, TAG_LENGTH));
|
||||
// FIXME: Check that the expected tag was received
|
||||
StreamContext ctx = new StreamContext(contactId, transportId,
|
||||
secret.clone(), 0, false);
|
||||
StreamContext ctx = new StreamContext(contactId, transportId, secret,
|
||||
0, false);
|
||||
InputStream streamReader = streamReaderFactory.createStreamReader(in,
|
||||
MAX_FRAME_LENGTH, ctx);
|
||||
PacketReader packetReader = packetReaderFactory.createPacketReader(
|
||||
|
||||
Reference in New Issue
Block a user