当前位置: 首页>>代码示例>>Java>>正文


Java ECUtil.getECParameterSpec方法代码示例

本文整理汇总了Java中sun.security.util.ECUtil.getECParameterSpec方法的典型用法代码示例。如果您正苦于以下问题:Java ECUtil.getECParameterSpec方法的具体用法?Java ECUtil.getECParameterSpec怎么用?Java ECUtil.getECParameterSpec使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在sun.security.util.ECUtil的用法示例。


在下文中一共展示了ECUtil.getECParameterSpec方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initialize

import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
        throws InvalidAlgorithmParameterException {

    if (params instanceof ECParameterSpec) {
        this.params = ECUtil.getECParameterSpec(null,
                                                (ECParameterSpec)params);
        if (this.params == null) {
            throw new InvalidAlgorithmParameterException(
                "Unsupported curve: " + params);
        }
    } else if (params instanceof ECGenParameterSpec) {
        String name = ((ECGenParameterSpec)params).getName();
        this.params = ECUtil.getECParameterSpec(null, name);
        if (this.params == null) {
            throw new InvalidAlgorithmParameterException(
                "Unknown curve name: " + name);
        }
    } else {
        throw new InvalidAlgorithmParameterException(
            "ECParameterSpec or ECGenParameterSpec required for EC");
    }
    this.keySize =
        ((ECParameterSpec)this.params).getCurve().getField().getFieldSize();
    this.random = random;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:27,代码来源:ECKeyPairGenerator.java

示例2: initialize

import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public void initialize(AlgorithmParameterSpec params, SecureRandom random)
        throws InvalidAlgorithmParameterException {

    ECParameterSpec ecSpec = null;

    if (params instanceof ECParameterSpec) {
        ecSpec = ECUtil.getECParameterSpec(null,
                                                (ECParameterSpec)params);
        if (ecSpec == null) {
            throw new InvalidAlgorithmParameterException(
                "Unsupported curve: " + params);
        }
    } else if (params instanceof ECGenParameterSpec) {
        String name = ((ECGenParameterSpec)params).getName();
        ecSpec = ECUtil.getECParameterSpec(null, name);
        if (ecSpec == null) {
            throw new InvalidAlgorithmParameterException(
                "Unknown curve name: " + name);
        }
    } else {
        throw new InvalidAlgorithmParameterException(
            "ECParameterSpec or ECGenParameterSpec required for EC");
    }

    // Not all known curves are supported by the native implementation
    ensureCurveIsSupported(ecSpec);
    this.params = ecSpec;

    this.keySize =
        ((ECParameterSpec)this.params).getCurve().getField().getFieldSize();
    this.random = random;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:34,代码来源:ECKeyPairGenerator.java

示例3: genECKeyPair

import sun.security.util.ECUtil; //导入方法依赖的package包/类
private KeyPair genECKeyPair(String curvName, String privD, String pubX,
                             String pubY, Provider p) throws Exception {
    ECParameterSpec ecParams = ECUtil.getECParameterSpec(p, curvName);
    ECPrivateKeySpec privKeySpec =
        new ECPrivateKeySpec(new BigInteger(privD, 16), ecParams);
    ECPublicKeySpec pubKeySpec =
        new ECPublicKeySpec(new ECPoint(new BigInteger(pubX, 16),
                                        new BigInteger(pubY, 16)),
                            ecParams);
    PrivateKey privKey = kf.generatePrivate(privKeySpec);
    PublicKey pubKey = kf.generatePublic(pubKeySpec);
    return new KeyPair(pubKey, privKey);
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:14,代码来源:TestECDH2.java

示例4: genECKeyPair

import sun.security.util.ECUtil; //导入方法依赖的package包/类
private KeyPair genECKeyPair(String curvName, String privD, String pubX,
        String pubY, Provider p) throws Exception {
    ECParameterSpec ecParams = ECUtil.getECParameterSpec(p, curvName);
    ECPrivateKeySpec privKeySpec =
        new ECPrivateKeySpec(new BigInteger(privD, 16), ecParams);
    ECPublicKeySpec pubKeySpec =
        new ECPublicKeySpec(new ECPoint(new BigInteger(pubX, 16), new BigInteger(pubY, 16)),
                            ecParams);
    PrivateKey privKey = kf.generatePrivate(privKeySpec);
    PublicKey pubKey = kf.generatePublic(pubKeySpec);
    return new KeyPair(pubKey, privKey);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:13,代码来源:TestECDSA2.java

示例5: getECParameterSpec

import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(String namedCurveOid) {
    return ECUtil.getECParameterSpec(cryptoProvider, namedCurveOid);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:JsseJce.java

示例6: getECParameterSpec

import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(String name) {
    return ECUtil.getECParameterSpec(getSunECProvider(), name);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:P11ECKeyFactory.java

示例7: decodeParameters

import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec decodeParameters(byte[] params) throws IOException {
    return ECUtil.getECParameterSpec(getSunECProvider(), params);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:P11ECKeyFactory.java

示例8: getECParameterSpec

import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECParameterSpec getECParameterSpec(ECParameterSpec spec) {
    return ECUtil.getECParameterSpec(getSunECProvider(), spec);
}
 
开发者ID:ojdkbuild,项目名称:lookaside_java-1.8.0-openjdk,代码行数:4,代码来源:P11ECKeyFactory.java


注:本文中的sun.security.util.ECUtil.getECParameterSpec方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。