summaryrefslogtreecommitdiff
path: root/src/cz/crcs/ectester/standalone/libs/SunECLib.java
blob: 3aec842ee8448280f42b21cb2b64a7bb663c228f (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
package cz.crcs.ectester.standalone.libs;

import sun.security.ec.SunEC;

import java.util.Set;
import java.util.TreeSet;

/**
 * @author Jan Jancar johny@neuromancer.sk
 */
public class SunECLib extends ProviderECLibrary {

    public SunECLib() {
        super(new SunEC());
    }

    @Override
    public Set<String> getCurves() {
        String curves = provider.get("AlgorithmParameters.EC SupportedCurves").toString();
        String[] split = curves.split("\\|");
        Set<String> result = new TreeSet<>();
        for (String curve : split) {
            String body = curve.split(",")[0].substring(1);
            result.add(body);
        }
        return result;
    }
}