aboutsummaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/reader/test/WrongCurvesSuite.java
blob: 307a16a9cf7e73a6b6633b601d3a262ea61d1fbe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package cz.crcs.ectester.reader.test;

import cz.crcs.ectester.data.EC_Store;
import cz.crcs.ectester.reader.CardMngr;
import cz.crcs.ectester.reader.ECTester;
import cz.crcs.ectester.reader.output.TestWriter;
import javacard.security.KeyPair;

import javax.smartcardio.CardException;
import java.io.IOException;
import java.util.List;

/**
 *
 * @author Jan Jancar johny@neuromancer.sk
 */
public class WrongCurvesSuite extends TestSuite {

    public WrongCurvesSuite(EC_Store dataStore, ECTester.Config cfg) {
        super(dataStore, cfg, "wrong", "");
    }

    @Override
    public void setup(CardMngr cardManager) throws IOException {
        /* Just do the default tests on the wrong curves.
         * These should generally fail, the curves aren't curves.
         */
        if (cfg.primeField) {
            tests.addAll(defaultCategoryTests(cardManager, cfg.testSuite, KeyPair.ALG_EC_FP, Result.Value.FAILURE, Result.Value.FAILURE, Result.Value.FAILURE, Result.Value.FAILURE));
        }
        if (cfg.binaryField) {
            tests.addAll(defaultCategoryTests(cardManager, cfg.testSuite, KeyPair.ALG_EC_F2M, Result.Value.FAILURE, Result.Value.FAILURE, Result.Value.FAILURE, Result.Value.FAILURE));
        }
    }
}