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


Java ECUtil.decodePoint方法代码示例

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


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

示例1: generateKeyPair

import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public KeyPair generateKeyPair() {

    byte[] encodedParams =
        ECUtil.encodeECParameterSpec(null, (ECParameterSpec)params);

    // seed is twice the key size (in bytes) plus 1
    byte[] seed = new byte[(((keySize + 7) >> 3) + 1) * 2];
    if (random == null) {
        random = JCAUtil.getSecureRandom();
    }
    random.nextBytes(seed);

    try {

        Object[] keyBytes = generateECKeyPair(keySize, encodedParams, seed);

        // The 'params' object supplied above is equivalent to the native
        // one so there is no need to fetch it.
        // keyBytes[0] is the encoding of the native private key
        BigInteger s = new BigInteger(1, (byte[])keyBytes[0]);

        PrivateKey privateKey =
            new ECPrivateKeyImpl(s, (ECParameterSpec)params);

        // keyBytes[1] is the encoding of the native public key
        ECPoint w = ECUtil.decodePoint((byte[])keyBytes[1],
            ((ECParameterSpec)params).getCurve());
        PublicKey publicKey =
            new ECPublicKeyImpl(w, (ECParameterSpec)params);

        return new KeyPair(publicKey, privateKey);

    } catch (Exception e) {
        throw new ProviderException(e);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:38,代码来源:ECKeyPairGenerator.java

示例2: generateKeyPair

import sun.security.util.ECUtil; //导入方法依赖的package包/类
@Override
public KeyPair generateKeyPair() {

    byte[] encodedParams =
        ECUtil.encodeECParameterSpec(null, (ECParameterSpec)params);

    // seed is twice the key size (in bytes) plus 1
    byte[] seed = new byte[(((keySize + 7) >> 3) + 1) * 2];
    if (random == null) {
        random = JCAUtil.getSecureRandom();
    }
    random.nextBytes(seed);

    try {

        long[] handles = generateECKeyPair(keySize, encodedParams, seed);

        // The 'params' object supplied above is equivalent to the native
        // one so there is no need to fetch it.

        // handles[0] points to the native private key
        BigInteger s = new BigInteger(1, getEncodedBytes(handles[0]));

        PrivateKey privateKey =
            new ECPrivateKeyImpl(s, (ECParameterSpec)params);

        // handles[1] points to the native public key
        ECPoint w = ECUtil.decodePoint(getEncodedBytes(handles[1]),
            ((ECParameterSpec)params).getCurve());
        PublicKey publicKey =
            new ECPublicKeyImpl(w, (ECParameterSpec)params);

        return new KeyPair(publicKey, privateKey);

    } catch (Exception e) {
        throw new ProviderException(e);
    }
}
 
开发者ID:RedlineResearch,项目名称:OLD-OpenJDK8,代码行数:39,代码来源:ECKeyPairGenerator.java

示例3: decodePoint

import sun.security.util.ECUtil; //导入方法依赖的package包/类
static ECPoint decodePoint(byte[] encoded, EllipticCurve curve)
        throws java.io.IOException {
    return ECUtil.decodePoint(encoded, curve);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:5,代码来源:JsseJce.java

示例4: decodePoint

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


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