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


Java DigestFactory.getDigest方法代码示例

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


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

示例1: PSSSignatureSpi

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
protected PSSSignatureSpi(
    AsymmetricBlockCipher signer,
    PSSParameterSpec baseParamSpec,
    boolean isRaw)
{
    this.signer = signer;
    this.originalSpec = baseParamSpec;
    
    if (baseParamSpec == null)
    {
        this.paramSpec = PSSParameterSpec.DEFAULT;
    }
    else
    {
        this.paramSpec = baseParamSpec;
    }

    this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm());
    this.saltLength = paramSpec.getSaltLength();
    this.trailer = getTrailer(paramSpec.getTrailerField());
    this.isRaw = isRaw;

    setupContentDigest();
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:PSSSignatureSpi.java

示例2: initFromSpec

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
private void initFromSpec(
    OAEPParameterSpec pSpec)
    throws NoSuchPaddingException
{
    MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters();
    Digest digest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());
    
    if (digest == null)
    {
        throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm());
    }

    cipher = new OAEPEncoding(new RSABlindedEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue());
    paramSpec = pSpec;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:CipherSpi.java

示例3: initFromSpec

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
private void initFromSpec(
    OAEPParameterSpec pSpec) 
    throws NoSuchPaddingException
{
    MGF1ParameterSpec   mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters();
    Digest              digest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());
    
    if (digest == null)
    {
        throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm());
    }

    cipher = new BufferedAsymmetricBlockCipher(new OAEPEncoding(new ElGamalEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue()));        
    paramSpec = pSpec;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:16,代码来源:CipherSpi.java

示例4: P11RSAPSSSignatureSpi

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
protected P11RSAPSSSignatureSpi(PSSParameterSpec baseParamSpec, boolean isRaw) {
    this.originalSpec = baseParamSpec;
    this.paramSpec = (baseParamSpec == null) ? PSSParameterSpec.DEFAULT : baseParamSpec;
    this.mgfDigest = DigestFactory.getDigest(paramSpec.getDigestAlgorithm());
    this.saltLength = paramSpec.getSaltLength();
    this.trailer = getTrailer(paramSpec.getTrailerField());
    this.isRaw = isRaw;

    setupContentDigest();
}
 
开发者ID:xipki,项目名称:xitk,代码行数:11,代码来源:P11RSAPSSSignatureSpi.java

示例5: initFromSpec

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
private void initFromSpec(OAEPParameterSpec pSpec)
    throws NoSuchPaddingException, NoSuchFieldException, IllegalAccessException
{
    MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)pSpec.getMGFParameters();
    Digest digest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());

    if (digest == null)
    {
        throw new NoSuchPaddingException("no match on OAEP constructor for digest algorithm: "+ mgfParams.getDigestAlgorithm());
    }

    cipher(new OAEPEncoding(new NativeRSAEngine(), digest, ((PSource.PSpecified)pSpec.getPSource()).getValue()));
    set( pSpec, "paramSpec" );
}
 
开发者ID:lookout,项目名称:fast-rsa-engine,代码行数:15,代码来源:FastCipherSpi.java

示例6: getDigest

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
/**
 * Finds checksum by name.
 *
 * @param digest digest name
 * @return digest instance
 */
private static Digest getDigest(final String digest) {
    try {
        return new JceDigest(digest);
    } catch (CryptoException e) {
        String noHyphen = digest.replaceFirst("-", "");
        return DigestFactory.getDigest(noHyphen);
    }
}
 
开发者ID:joyent,项目名称:java-http-signature,代码行数:15,代码来源:NativeRSAWithSHA.java

示例7: engineSetParameter

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
protected void engineSetParameter(
    AlgorithmParameterSpec params)
    throws InvalidParameterException
{
    if (params instanceof PSSParameterSpec)
    {
        PSSParameterSpec newParamSpec = (PSSParameterSpec)params;
        
        if (originalSpec != null)
        {
            if (!DigestFactory.isSameDigest(originalSpec.getDigestAlgorithm(), newParamSpec.getDigestAlgorithm()))
            {
                throw new InvalidParameterException("parameter must be using " + originalSpec.getDigestAlgorithm());
            }
        }
        if (!newParamSpec.getMGFAlgorithm().equalsIgnoreCase("MGF1") && !newParamSpec.getMGFAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1.getId()))
        {
            throw new InvalidParameterException("unknown mask generation function specified");
        }
        
        if (!(newParamSpec.getMGFParameters() instanceof MGF1ParameterSpec))
        {
            throw new InvalidParameterException("unkown MGF parameters");
        }
        
        MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)newParamSpec.getMGFParameters();
        
        if (!DigestFactory.isSameDigest(mgfParams.getDigestAlgorithm(), newParamSpec.getDigestAlgorithm()))
        {
            throw new InvalidParameterException("digest algorithm for MGF should be the same as for PSS parameters.");
        }
        
        Digest newDigest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());
        
        if (newDigest == null)
        {
            throw new InvalidParameterException("no match on MGF digest algorithm: "+ mgfParams.getDigestAlgorithm());
        }

        this.engineParams = null;
        this.paramSpec = newParamSpec;
        this.mgfDigest = newDigest;
        this.saltLength = paramSpec.getSaltLength();
        this.trailer = getTrailer(paramSpec.getTrailerField());

        setupContentDigest();
    }
    else
    {
        throw new InvalidParameterException("Only PSSParameterSpec supported");
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:53,代码来源:PSSSignatureSpi.java

示例8: engineSetParameter

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
@Override
protected void engineSetParameter(AlgorithmParameterSpec params)
        throws InvalidParameterException {
    if (params instanceof PSSParameterSpec) {
        PSSParameterSpec newParamSpec = (PSSParameterSpec) params;

        if (originalSpec != null) {
            if (!DigestFactory.isSameDigest(originalSpec.getDigestAlgorithm(),
                    newParamSpec.getDigestAlgorithm())) {
                throw new InvalidParameterException("parameter must be using "
                        + originalSpec.getDigestAlgorithm());
            }
        }
        if (!newParamSpec.getMGFAlgorithm().equalsIgnoreCase("MGF1")
                && !newParamSpec.getMGFAlgorithm().equals(
                        PKCSObjectIdentifiers.id_mgf1.getId())) {
            throw new InvalidParameterException("unknown mask generation function specified");
        }

        if (!(newParamSpec.getMGFParameters() instanceof MGF1ParameterSpec)) {
            throw new InvalidParameterException("unkown MGF parameters");
        }

        MGF1ParameterSpec mgfParams = (MGF1ParameterSpec) newParamSpec.getMGFParameters();

        if (!DigestFactory.isSameDigest(mgfParams.getDigestAlgorithm(),
                newParamSpec.getDigestAlgorithm())) {
            throw new InvalidParameterException(
                    "digest algorithm for MGF should be the same as for PSS parameters.");
        }

        Digest newDigest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());

        if (newDigest == null) {
            throw new InvalidParameterException(
                    "no match on MGF digest algorithm: " + mgfParams.getDigestAlgorithm());
        }

        this.engineParams = null;
        this.paramSpec = newParamSpec;
        this.mgfDigest = newDigest;
        this.saltLength = paramSpec.getSaltLength();
        this.trailer = getTrailer(paramSpec.getTrailerField());

        setupContentDigest();
    } else {
        throw new InvalidParameterException("only PSSParameterSpec supported");
    }
}
 
开发者ID:xipki,项目名称:xitk,代码行数:50,代码来源:P11RSAPSSSignatureSpi.java

示例9: engineSetParameter

import org.bouncycastle.jcajce.provider.util.DigestFactory; //导入方法依赖的package包/类
protected void engineSetParameter(
    AlgorithmParameterSpec params)
    throws InvalidAlgorithmParameterException
{
    if (params instanceof PSSParameterSpec)
    {
        PSSParameterSpec newParamSpec = (PSSParameterSpec)params;
        
        if (originalSpec != null)
        {
            if (!DigestFactory.isSameDigest(originalSpec.getDigestAlgorithm(), newParamSpec.getDigestAlgorithm()))
            {
                throw new InvalidAlgorithmParameterException("parameter must be using " + originalSpec.getDigestAlgorithm());
            }
        }
        if (!newParamSpec.getMGFAlgorithm().equalsIgnoreCase("MGF1") && !newParamSpec.getMGFAlgorithm().equals(PKCSObjectIdentifiers.id_mgf1.getId()))
        {
            throw new InvalidAlgorithmParameterException("unknown mask generation function specified");
        }
        
        if (!(newParamSpec.getMGFParameters() instanceof MGF1ParameterSpec))
        {
            throw new InvalidAlgorithmParameterException("unknown MGF parameters");
        }
        
        MGF1ParameterSpec mgfParams = (MGF1ParameterSpec)newParamSpec.getMGFParameters();
        
        if (!DigestFactory.isSameDigest(mgfParams.getDigestAlgorithm(), newParamSpec.getDigestAlgorithm()))
        {
            throw new InvalidAlgorithmParameterException("digest algorithm for MGF should be the same as for PSS parameters.");
        }
        
        Digest newDigest = DigestFactory.getDigest(mgfParams.getDigestAlgorithm());
        
        if (newDigest == null)
        {
            throw new InvalidAlgorithmParameterException("no match on MGF digest algorithm: "+ mgfParams.getDigestAlgorithm());
        }

        this.engineParams = null;
        this.paramSpec = newParamSpec;
        this.mgfDigest = newDigest;
        this.saltLength = paramSpec.getSaltLength();
        this.trailer = getTrailer(paramSpec.getTrailerField());

        setupContentDigest();
    }
    else
    {
        throw new InvalidAlgorithmParameterException("Only PSSParameterSpec supported");
    }
}
 
开发者ID:thedrummeraki,项目名称:Aki-SSL,代码行数:53,代码来源:PSSSignatureSpi.java


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