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


Java ExtendedDigest类代码示例

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


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

示例1: getByteLength

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
private static int getByteLength(
    Digest digest)
{
    if (digest instanceof ExtendedDigest)
    {
        return ((ExtendedDigest)digest).getByteLength();
    }
    
    Integer  b = (Integer)blockLengths.get(digest.getAlgorithmName());
    
    if (b == null)
    {       
        throw new IllegalArgumentException("unknown digest passed: " + digest.getAlgorithmName());
    }
    
    return b.intValue();
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:18,代码来源:HMac.java

示例2: createCipherParameters

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
static CipherParameters createCipherParameters(ASN1ObjectIdentifier algorithm, ExtendedDigest digest, int blockSize, PKCS12PBEParams pbeParams, char[] password)
{
    PKCS12ParametersGenerator pGen = new PKCS12ParametersGenerator(digest);

    pGen.init(PKCS12ParametersGenerator.PKCS12PasswordToBytes(password), pbeParams.getIV(), pbeParams.getIterations().intValue());

    CipherParameters params;

    if (PKCS12PBEUtils.hasNoIv(algorithm))
    {
        params = pGen.generateDerivedParameters(PKCS12PBEUtils.getKeySize(algorithm));
    }
    else
    {
        params = pGen.generateDerivedParameters(PKCS12PBEUtils.getKeySize(algorithm), blockSize * 8);

        if (PKCS12PBEUtils.isDesAlg(algorithm))
        {
            DESedeParameters.setOddParity(((KeyParameter)((ParametersWithIV)params).getParameters()).getKey());
        }
    }
    return params;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:24,代码来源:PKCS12PBEUtils.java

示例3: ShortenedDigest

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
/**
 * Base constructor.
 * 
 * @param baseDigest underlying digest to use.
 * @param length length in bytes of the output of doFinal.
 * @exception IllegalArgumentException if baseDigest is null, or length is greater than baseDigest.getDigestSize().
 */
public ShortenedDigest(
    ExtendedDigest baseDigest,
    int            length)
{
    if (baseDigest == null)
    {
        throw new IllegalArgumentException("baseDigest must not be null");
    }
    
    if (length > baseDigest.getDigestSize())
    {
        throw new IllegalArgumentException("baseDigest output not large enough to support length");
    }
    
    this.baseDigest = baseDigest;
    this.length = length;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:25,代码来源:ShortenedDigest.java

示例4: PKCS12ParametersGenerator

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
/**
 * Construct a PKCS 12 Parameters generator. This constructor will
 * accept any digest which also implements ExtendedDigest.
 *
 * @param digest the digest to be used as the source of derived keys.
 * @exception IllegalArgumentException if an unknown digest is passed in.
 */
public PKCS12ParametersGenerator(
    Digest  digest)
{
    this.digest = digest;
    if (digest instanceof ExtendedDigest)
    {
        u = digest.getDigestSize();
        v = ((ExtendedDigest)digest).getByteLength();
    }
    else
    {
        throw new IllegalArgumentException("Digest " + digest.getAlgorithmName() + " unsupported");
    }
}
 
开发者ID:PhilippC,项目名称:keepass2android,代码行数:22,代码来源:PKCS12ParametersGenerator.java

示例5: get

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
public ExtendedDigest get(AlgorithmIdentifier digestAlgorithmIdentifier)
    throws OperatorCreationException
{
    BcDigestProvider extProv = (BcDigestProvider)lookup.get(digestAlgorithmIdentifier.getAlgorithm());

    if (extProv == null)
    {
        throw new OperatorCreationException("cannot recognise digest");
    }

    return extProv.get(digestAlgorithmIdentifier);
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:13,代码来源:BcDefaultDigestProvider.java

示例6: createMacCalculator

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
static MacCalculator createMacCalculator(final ASN1ObjectIdentifier digestAlgorithm, ExtendedDigest digest, final PKCS12PBEParams pbeParams, final char[] password)
{
    PKCS12ParametersGenerator pGen = new PKCS12ParametersGenerator(digest);

    pGen.init(PKCS12ParametersGenerator.PKCS12PasswordToBytes(password), pbeParams.getIV(), pbeParams.getIterations().intValue());

    final KeyParameter keyParam = (KeyParameter)pGen.generateDerivedMacParameters(digest.getDigestSize() * 8);

    final HMac hMac = new HMac(digest);

    hMac.init(keyParam);

    return new MacCalculator()
    {
        public AlgorithmIdentifier getAlgorithmIdentifier()
        {
            return new AlgorithmIdentifier(digestAlgorithm, pbeParams);
        }

        public OutputStream getOutputStream()
        {
            return new MacOutputStream(hMac);
        }

        public byte[] getMac()
        {
            byte[] res = new byte[hMac.getMacSize()];

            hMac.doFinal(res, 0);

            return res;
        }

        public GenericKey getKey()
        {
            return new GenericKey(getAlgorithmIdentifier(), PKCS12ParametersGenerator.PKCS12PasswordToBytes(password));
        }
    };
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:40,代码来源:PKCS12PBEUtils.java

示例7: NonMemoableDigest

import org.bouncycastle.crypto.ExtendedDigest; //导入依赖的package包/类
/**
 * Base constructor.
 *
 * @param baseDigest underlying digest to use.
 * @exception IllegalArgumentException if baseDigest is null
 */
public NonMemoableDigest(
    ExtendedDigest baseDigest)
{
    if (baseDigest == null)
    {
        throw new IllegalArgumentException("baseDigest must not be null");
    }

    this.baseDigest = baseDigest;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:17,代码来源:NonMemoableDigest.java


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