sun.security.util.ECKeySizeParameterSpec Java Examples

The following examples show how to use sun.security.util.ECKeySizeParameterSpec. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SM2Parameters.java    From julongchain with Apache License 2.0 5 votes vote down vote up
@Override
protected <T extends AlgorithmParameterSpec> T engineGetParameterSpec(Class<T> var1) throws InvalidParameterSpecException {
    if (var1.isAssignableFrom(ECParameterSpec.class)) {
        return var1.cast(this.namedCurve);
    } else if (var1.isAssignableFrom(ECGenParameterSpec.class)) {
        String var3 = this.namedCurve.getObjectId();
        return var1.cast(new ECGenParameterSpec(var3));
    } else if (var1.isAssignableFrom(ECKeySizeParameterSpec.class)) {
        int var2 = this.namedCurve.getCurve().getField().getFieldSize();
        return var1.cast(new ECKeySizeParameterSpec(var2));
    } else {
        throw new InvalidParameterSpecException("Only ECParameterSpec and ECGenParameterSpec supported");
    }
}
 
Example #2
Source File: CPublicKey.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ECParameterSpec getParams() {
    try {
        AlgorithmParameters ap = AlgorithmParameters.getInstance("EC");
        ap.init(new ECKeySizeParameterSpec(keyLength));
        return ap.getParameterSpec(ECParameterSpec.class);
    } catch (Exception e) {
        throw new ProviderException(e);
    }
}
 
Example #3
Source File: CPublicKey.java    From jdk8u_jdk with GNU General Public License v2.0 5 votes vote down vote up
@Override
public ECParameterSpec getParams() {
    try {
        AlgorithmParameters ap = AlgorithmParameters.getInstance("EC");
        ap.init(new ECKeySizeParameterSpec(keyLength));
        return ap.getParameterSpec(ECParameterSpec.class);
    } catch (Exception e) {
        throw new ProviderException(e);
    }
}
 
Example #4
Source File: Main.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
private String ecGroupNameForSize(int size) throws Exception {
    AlgorithmParameters ap = AlgorithmParameters.getInstance("EC");
    ap.init(new ECKeySizeParameterSpec(size));
    // The following line assumes the toString value is "name (oid)"
    return ap.toString().split(" ")[0];
}