Mentions légales du service

Skip to content
Snippets Groups Projects
Commit 11c7171c authored by Redford StopCovid's avatar Redford StopCovid
Browse files

Merge branch '14-code-quality-remove-application-classes' into 'develop'

Resolve "[Code Quality] Remove *Application classes"

Closes #14

See merge request !11
parents 56670656 67c3c8b3
No related branches found
No related tags found
1 merge request!11Resolve "[Code Quality] Remove *Application classes"
package test.fr.gouv.stopc.robert.server.crypto;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
class RobertServerCryptoApplicationTest {
@Test
void contextLoads() {
}
}
package test.fr.gouv.stopc.robert.server.crypto.callable;
import fr.gouv.stopc.robert.server.common.utils.TimeUtils;
import fr.gouv.stopc.robert.server.crypto.callable.TupleGenerator;
import fr.gouv.stopc.robert.server.crypto.model.EphemeralTuple;
import fr.gouv.stopc.robert.server.crypto.service.impl.CryptoServiceImpl;
import org.junit.jupiter.api.Test;
import java.util.*;
class TupleGeneratorTest {
private static final CryptoServiceImpl cryptoService = new CryptoServiceImpl();
@Test
void tupleGeneratorExecTest() throws Exception {
// 40 bits IDa
byte[] IDa = new byte[40/8];
// Server key should be 192-bits (3 x 64-bits) long because of the TripleDES key property
final byte[] kServ = new byte[(3*64)/8];
// Federation key should be 256-bits long.
final byte[] kFed = new byte[256/8];
// Hazarding IDa, kServ and kFed keys
Random random = new Random();
random.nextBytes(IDa);
random.nextBytes(kServ);
random.nextBytes(kFed);
final int currentEpoch = TimeUtils.getNumberOfEpochsBetween(0, TimeUtils.convertUnixMillistoNtpSeconds(new Date().getTime()));
int numberOfEpochs = 4 * 24 * 4 ;
long start = System.currentTimeMillis();
final TupleGenerator tupleGenerator = new TupleGenerator(kServ, kFed, 50);
final Collection<EphemeralTuple> ephemeralTuples = tupleGenerator.exec(IDa, currentEpoch, numberOfEpochs, (byte) 0x33);
tupleGenerator.stop();
ephemeralTuples.forEach(et -> {
System.out.println("ECC size : " + et.getEncryptedCountryCode().length * 8 + "-bits" + " " + Arrays.toString(et.getEncryptedCountryCode()));
System.out.println("EBID size : " + et.getEbid().length * 8 + "-bits"+ " " + Arrays.toString(et.getEbid()));
System.out.println("EPOCH : " + et.getEpoch());
});
long end = System.currentTimeMillis();
System.out.println("Time 1 :" + (end - start) + " ms");
}
}
\ No newline at end of file
......@@ -11,7 +11,9 @@ import fr.gouv.stopc.robert.server.crypto.structure.impl.CryptoAES;
import fr.gouv.stopc.robert.server.crypto.structure.impl.CryptoHMACSHA256;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit.jupiter.SpringExtension;
import java.util.Arrays;
import java.util.Collection;
......@@ -22,7 +24,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNull;
@Slf4j
@ContextConfiguration(classes = {RobertServerCryptoApplication.class})
@ExtendWith(SpringExtension.class)
class CryptoServiceImplTest {
private static final CryptoServiceImpl cryptoService = new CryptoServiceImpl();
......
package test.fr.gouv.stopc.robertserver.database;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.springframework.test.context.junit.jupiter.SpringExtension;
@ExtendWith(SpringExtension.class)
public class RobertServerDatabaseApplicationTest {
@Test
void contextLoads() {
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment