View Javadoc
1   package civitas.crypto.parameters;
2   
3   import static org.junit.jupiter.api.Assertions.assertEquals;
4   
5   import org.junit.jupiter.api.DisplayName;
6   import org.junit.jupiter.api.Test;
7   import org.mockito.InjectMocks;
8   
9   import civitas.common.RandomAwareTestBase;
10  import civitas.crypto.Constants;
11  import civitas.crypto.privatekey.ElGamalPrivateKeyTestData;
12  
13  class GenerateSchnorrPrimeTest extends RandomAwareTestBase implements ElGamalPrivateKeyTestData, Constants {
14  
15  	@InjectMocks
16  	GenerateSchnorrPrime generateSchnorrPrime;
17  
18  	@Test
19  	@DisplayName("schnorrPrime returns two primes p,q where p=q*r+1, and "
20  			+ "length of q is qLength, length of p is pLength ")
21  	void schnorrPrimeTest2() {
22  		PrimePair sp = generateSchnorrPrime.apply(EL_GAMAL_KEY_LENGTH, EL_GAMAL_GROUP_LENGTH);
23  		assertEquals(BIGINT_Q, sp.q);
24  		assertEquals(BIGINT_P, sp.p);
25  	}
26  }