Key derivation function based on NIST SP 800-108.

This commit is contained in:
akwizgran
2011-11-15 17:19:11 +00:00
parent 6a15c03e81
commit 9220bb3426
9 changed files with 83 additions and 56 deletions

View File

@@ -99,7 +99,7 @@ public class ProtocolIntegrationTest extends TestCase {
assertEquals(crypto.getMessageDigest().getDigestLength(),
UniqueId.LENGTH);
Random r = new Random();
aliceToBobSecret = new byte[123];
aliceToBobSecret = new byte[32];
r.nextBytes(aliceToBobSecret);
// Create two groups: one restricted, one unrestricted
GroupFactory groupFactory = i.getInstance(GroupFactory.class);

View File

@@ -97,9 +97,9 @@ public abstract class DatabaseComponentTest extends TestCase {
properties);
transports = Collections.singletonList(transport);
Random r = new Random();
inSecret = new byte[123];
inSecret = new byte[32];
r.nextBytes(inSecret);
outSecret = new byte[123];
outSecret = new byte[32];
r.nextBytes(outSecret);
}

View File

@@ -123,9 +123,9 @@ public class H2DatabaseTest extends TestCase {
remoteTransports = Collections.singletonList(remoteTransport);
subscriptions = Collections.singletonMap(group, 0L);
Random r = new Random();
inSecret = new byte[123];
inSecret = new byte[32];
r.nextBytes(inSecret);
outSecret = new byte[123];
outSecret = new byte[32];
r.nextBytes(outSecret);
}

View File

@@ -43,7 +43,7 @@ public class ConnectionRecogniserImplTest extends TestCase {
Injector i = Guice.createInjector(new CryptoModule());
crypto = i.getInstance(CryptoComponent.class);
contactId = new ContactId(1);
inSecret = new byte[123];
inSecret = new byte[32];
new Random().nextBytes(inSecret);
transportId = new TransportId(TestUtils.getRandomId());
localIndex = new TransportIndex(13);

View File

@@ -39,7 +39,7 @@ public class ConnectionWriterTest extends TestCase {
new TestDatabaseModule(), new TransportBatchModule(),
new TransportModule(), new TransportStreamModule());
connectionWriterFactory = i.getInstance(ConnectionWriterFactory.class);
outSecret = new byte[123];
outSecret = new byte[32];
new Random().nextBytes(outSecret);
}

View File

@@ -44,7 +44,7 @@ public class FrameReadWriteTest extends TestCase {
frameCipher = crypto.getFrameCipher();
random = new Random();
// Since we're sending frames to ourselves, we only need outgoing keys
outSecret = new byte[123];
outSecret = new byte[32];
random.nextBytes(outSecret);
ivKey = crypto.deriveIvKey(outSecret, true);
frameKey = crypto.deriveFrameKey(outSecret, true);

View File

@@ -65,9 +65,9 @@ public class BatchConnectionReadWriteTest extends TestCase {
transportIndex = new TransportIndex(1);
// Create matching secrets for Alice and Bob
Random r = new Random();
aliceToBobSecret = new byte[123];
aliceToBobSecret = new byte[32];
r.nextBytes(aliceToBobSecret);
bobToAliceSecret = new byte[123];
bobToAliceSecret = new byte[32];
r.nextBytes(bobToAliceSecret);
}