• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ECUtil类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil的典型用法代码示例。如果您正苦于以下问题:Java ECUtil类的具体用法?Java ECUtil怎么用?Java ECUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



ECUtil类属于org.bouncycastle.jcajce.provider.asymmetric.util包,在下文中一共展示了ECUtil类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: engineInitSign

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitSign(
    PrivateKey privateKey)
    throws InvalidKeyException
{
    CipherParameters param = null;

    if (privateKey instanceof ECKey)
    {
        param = ECUtil.generatePrivateKeyParameter(privateKey);
    }

    digest = new GOST3411Digest(DEFAULT_SBOX);

    if (appRandom != null)
    {
        signer.init(true, new ParametersWithRandom(param, appRandom));
    }
    else
    {
        signer.init(true, param);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:23,代码来源:SignatureSpi.java


示例2: engineInitVerify

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitVerify(
    PublicKey   publicKey)
    throws InvalidKeyException
{
    CipherParameters    param;

    if (publicKey instanceof ECPublicKey)
    {
        param = ECUtil.generatePublicKeyParameter(publicKey);
    }
    else if (publicKey instanceof GOST3410Key)
    {
        param = GOST3410Util.generatePublicKeyParameter(publicKey);
    }
    else
    {
        try
        {
            byte[]  bytes = publicKey.getEncoded();

            publicKey = BouncyCastleProvider.getPublicKey(SubjectPublicKeyInfo.getInstance(bytes));

            if (publicKey instanceof ECPublicKey)
            {
                param = ECUtil.generatePublicKeyParameter(publicKey);
            }
            else
            {
                throw new InvalidKeyException("can't recognise key type in DSA based signer");
            }
        }
        catch (Exception e)
        {
            throw new InvalidKeyException("can't recognise key type in DSA based signer");
        }
    }

    digest.reset();
    signer.init(false, param);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:41,代码来源:SignatureSpi.java


示例3: engineInitSign

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitSign(
    PrivateKey  privateKey)
    throws InvalidKeyException
{
    CipherParameters    param;

    if (privateKey instanceof ECKey)
    {
        param = ECUtil.generatePrivateKeyParameter(privateKey);
    }
    else
    {
        param = GOST3410Util.generatePrivateKeyParameter(privateKey);
    }

    digest.reset();

    if (random != null)
    {
        signer.init(true, new ParametersWithRandom(param, random));
    }
    else
    {
        signer.init(true, param);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:SignatureSpi.java


示例4: engineInitSign

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitSign(
    PrivateKey privateKey)
    throws InvalidKeyException
{
    CipherParameters param = ECUtil.generatePrivateKeyParameter(privateKey);

    digest.reset();

    if (appRandom != null)
    {
        signer.init(true, new ParametersWithRandom(param, appRandom));
    }
    else
    {
        signer.init(true, param);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:18,代码来源:SignatureSpi.java


示例5: engineInitSign

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitSign(
    PrivateKey  privateKey)
    throws InvalidKeyException
{
    CipherParameters    param;

    if (privateKey instanceof ECKey)
    {
        param = ECUtil.generatePrivateKeyParameter(privateKey);
    }
    else
    {
        param = GOST3410Util.generatePrivateKeyParameter(privateKey);
    }

    digest.reset();

    if (appRandom != null)
    {
        signer.init(true, new ParametersWithRandom(param, appRandom));
    }
    else
    {
        signer.init(true, param);
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:SignatureSpi.java


示例6: calculateECKAShS

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
/**
 * Implement the ECKA algorithm (EG variant) in order to calculate the ShS (shared secret) from the provided
 * static and ephemeral keys from the same curve.
 * @param privateKey the private key to use for the ShS calculation.
 * @param publicKey the public key to use for the ShS calculation.
 * @return the calculated shared secret.
 */
public static byte[] calculateECKAShS(PrivateKey privateKey, PublicKey publicKey) {

    try {
        ECKABasicAgreement basicAgreement = new ECKABasicAgreement();
        basicAgreement.init(ECUtil.generatePrivateKeyParameter(privateKey));

        return basicAgreement.calculatePoint(ECUtil.generatePublicKeyParameter(publicKey)).getEncoded();
    } catch (InvalidKeyException e) {
        e.printStackTrace();
    }
    return null;
}
 
开发者ID:mDL-ILP,项目名称:mDL-ILP,代码行数:20,代码来源:ECCUtils.java


示例7: engineInitVerify

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitVerify(
    PublicKey publicKey)
    throws InvalidKeyException
{
    CipherParameters param;

    if (publicKey instanceof ECPublicKey)
    {
        param = ECUtil.generatePublicKeyParameter(publicKey);
    }
    else
    {
        try
        {
            byte[] bytes = publicKey.getEncoded();

            publicKey = BouncyCastleProvider.getPublicKey(SubjectPublicKeyInfo.getInstance(bytes));

            if (publicKey instanceof ECPublicKey)
            {
                param = ECUtil.generatePublicKeyParameter(publicKey);
            }
            else
            {
                throw new InvalidKeyException("can't recognise key type in DSA based signer");
            }
        }
        catch (Exception e)
        {
            throw new InvalidKeyException("can't recognise key type in DSA based signer");
        }
    }

    digest = new GOST3411Digest(expandSbox(((BCDSTU4145PublicKey)publicKey).getSbox()));
    signer.init(false, param);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:37,代码来源:SignatureSpi.java


示例8: engineInitVerify

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitVerify(PublicKey publicKey)
    throws InvalidKeyException
{
    CipherParameters param = ECUtil.generatePublicKeyParameter(publicKey);

    digest.reset();
    signer.init(false, param);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:9,代码来源:SignatureSpi.java


示例9: generatePublicKeyParameter

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
public static AsymmetricKeyParameter generatePublicKeyParameter(PublicKey key)
        throws InvalidKeyException {
    ParamUtil.requireNonNull("key", key);

    if (key instanceof RSAPublicKey) {
        RSAPublicKey rsaKey = (RSAPublicKey) key;
        return new RSAKeyParameters(false, rsaKey.getModulus(), rsaKey.getPublicExponent());
    } else if (key instanceof ECPublicKey) {
        return ECUtil.generatePublicKeyParameter(key);
    } else if (key instanceof DSAPublicKey) {
        return DSAUtil.generatePublicKeyParameter(key);
    } else {
        throw new InvalidKeyException("unknown key " + key.getClass().getName());
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:16,代码来源:KeyUtil.java


示例10: getDomainParametersFromName

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
static X9ECParameters getDomainParametersFromName(String curveName)
{
    X9ECParameters domainParameters;
    try
    {
        if (curveName.charAt(0) >= '0' && curveName.charAt(0) <= '2')
        {
            ASN1ObjectIdentifier oidID = new ASN1ObjectIdentifier(curveName);
            domainParameters = ECUtil.getNamedCurveByOid(oidID);
        }
        else
        {
            if (curveName.indexOf(' ') > 0)
            {
                curveName = curveName.substring(curveName.indexOf(' ') + 1);
                domainParameters = ECUtil.getNamedCurveByName(curveName);
            }
            else
            {
                domainParameters = ECUtil.getNamedCurveByName(curveName);
            }
        }
    }
    catch (IllegalArgumentException ex)
    {
        domainParameters = ECUtil.getNamedCurveByName(curveName);
    }
    return domainParameters;
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:30,代码来源:ECUtils.java


示例11: engineInitVerify

import org.bouncycastle.jcajce.provider.asymmetric.util.ECUtil; //导入依赖的package包/类
protected void engineInitVerify(
    PublicKey   publicKey)
    throws InvalidKeyException
{
    CipherParameters    param;

    if (publicKey instanceof ECPublicKey)
    {
        param = ECUtil.generatePublicKeyParameter(publicKey);
    }
    else if (publicKey instanceof GOST3410Key)
    {
        param = GOST3410Util.generatePublicKeyParameter(publicKey);
    }
    else
    {
        try
        {
            byte[]  bytes = publicKey.getEncoded();

            publicKey = BouncyCastleProvider.getPublicKey(SubjectPublicKeyInfo.getInstance(bytes));

            param = ECUtil.generatePublicKeyParameter(publicKey);
        }
        catch (Exception e)
        {
            throw new InvalidKeyException("can't recognise key type in DSA based signer");
        }
    }

    digest.reset();
    signer.init(false, param);
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:34,代码来源:SignatureSpi.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LayoutSetLocalServiceUtil类代码示例发布时间:2022-05-22
下一篇:
Java SelectBeforeUpdate类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap