mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Changed the root package from net.sf.briar to org.briarproject.
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
package org.briarproject.crypto;
|
||||
|
||||
import static org.junit.Assert.assertArrayEquals;
|
||||
import org.briarproject.BriarTestCase;
|
||||
import org.briarproject.api.crypto.CryptoComponent;
|
||||
import org.briarproject.api.crypto.KeyPair;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class KeyAgreementTest extends BriarTestCase {
|
||||
|
||||
@Test
|
||||
public void testKeyAgreement() throws Exception {
|
||||
CryptoComponent crypto = new CryptoComponentImpl();
|
||||
KeyPair aPair = crypto.generateAgreementKeyPair();
|
||||
byte[] aPub = aPair.getPublic().getEncoded();
|
||||
KeyPair bPair = crypto.generateAgreementKeyPair();
|
||||
byte[] bPub = bPair.getPublic().getEncoded();
|
||||
byte[] aSecret = crypto.deriveMasterSecret(aPub, bPair, true);
|
||||
byte[] bSecret = crypto.deriveMasterSecret(bPub, aPair, false);
|
||||
assertArrayEquals(aSecret, bSecret);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user