mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 11:19:04 +01:00
Switched to 256-bit ECDSA. Modified some tests because two signatures
over the same data are not necessarily identical. Key generation is fast again - should I be worried? ;-)
This commit is contained in:
@@ -37,14 +37,13 @@ public class ConsumersTest extends TestCase {
|
||||
signature.initSign(keyPair.getPrivate());
|
||||
signature.update(data);
|
||||
byte[] sig = signature.sign();
|
||||
// Check that feeding a SigningConsumer generates the same signature
|
||||
signature.initSign(keyPair.getPrivate());
|
||||
// Check that a SigningConsumer fed with the same data verifies the sig
|
||||
signature.initVerify(keyPair.getPublic());
|
||||
SigningConsumer sc = new SigningConsumer(signature);
|
||||
sc.write(data[0]);
|
||||
sc.write(data, 1, data.length - 2);
|
||||
sc.write(data[data.length - 1]);
|
||||
byte[] sig1 = signature.sign();
|
||||
assertTrue(Arrays.equals(sig, sig1));
|
||||
assertTrue(signature.verify(sig));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -54,11 +54,10 @@ public class SigningDigestingOutputStreamTest extends TestCase {
|
||||
byte[] digest = messageDigest.digest();
|
||||
// Check that the output matches the input
|
||||
assertTrue(Arrays.equals(input, out.toByteArray()));
|
||||
// Check that the signature matches a signature over the first 256 bytes
|
||||
signature.initSign(keyPair.getPrivate());
|
||||
// Verify the signature over the first 256 bytes
|
||||
signature.initVerify(keyPair.getPublic());
|
||||
signature.update(input, 0, 256);
|
||||
byte[] directSig = signature.sign();
|
||||
assertTrue(Arrays.equals(directSig, sig));
|
||||
assertTrue(signature.verify(sig));
|
||||
// Check that the digest matches a digest over all but the last 256
|
||||
// bytes
|
||||
messageDigest.reset();
|
||||
|
||||
Reference in New Issue
Block a user