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


Java BouncyCastleProvider.getPublicKey方法代码示例

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


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

示例1: engineGeneratePublic

import org.bouncycastle.jce.provider.BouncyCastleProvider; //导入方法依赖的package包/类
protected PublicKey engineGeneratePublic(
    KeySpec keySpec)
    throws InvalidKeySpecException
{
    if (keySpec instanceof X509EncodedKeySpec)
    {
        try
        {
            SubjectPublicKeyInfo info = SubjectPublicKeyInfo.getInstance(((X509EncodedKeySpec)keySpec).getEncoded());
            PublicKey            key = BouncyCastleProvider.getPublicKey(info);

            if (key != null)
            {
                return key;
            }

            throw new InvalidKeySpecException("no factory found for OID: " + info.getAlgorithm().getAlgorithm());
        }
        catch (Exception e)
        {
            throw new InvalidKeySpecException(e.toString());
        }
    }

    throw new InvalidKeySpecException("Unknown KeySpec type: " + keySpec.getClass().getName());
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:27,代码来源:KeyFactory.java

示例2: engineInitVerify

import org.bouncycastle.jce.provider.BouncyCastleProvider; //导入方法依赖的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: getPublicKey

import org.bouncycastle.jce.provider.BouncyCastleProvider; //导入方法依赖的package包/类
public PublicKey getPublicKey()
{
    try
    {
        return BouncyCastleProvider.getPublicKey(c.getSubjectPublicKeyInfo());
    }
    catch (IOException e)
    {
        return null;   // should never happen...
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:12,代码来源:X509CertificateObject.java

示例4: engineInitVerify

import org.bouncycastle.jce.provider.BouncyCastleProvider; //导入方法依赖的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


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