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


Java SkeinParameters类代码示例

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


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

示例1: createInitialState

import org.bouncycastle.crypto.params.SkeinParameters; //导入依赖的package包/类
/**
 * Calculate the initial (pre message block) chaining state.
 */
private void createInitialState()
{
    long[] precalc = (long[])INITIAL_STATES.get(variantIdentifier(getBlockSize(), getOutputSize()));
    if ((key == null) && (precalc != null))
    {
        // Precalculated UBI(CFG)
        chain = Arrays.clone(precalc);
    }
    else
    {
        // Blank initial state
        chain = new long[getBlockSize() / 8];

        // Process key block
        if (key != null)
        {
            ubiComplete(SkeinParameters.PARAM_TYPE_KEY, key);
        }

        // Process configuration block
        ubiComplete(PARAM_TYPE_CONFIG, new Configuration(outputSizeBytes * 8).getBytes());
    }

    // Process additional pre-message parameters
    if (preMessageParameters != null)
    {
        for (int i = 0; i < preMessageParameters.length; i++)
        {
            Parameter param = preMessageParameters[i];
            ubiComplete(param.getType(), param.getValue());
        }
    }
    initialState = Arrays.clone(chain);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:38,代码来源:SkeinEngine.java

示例2: testParameters

import org.bouncycastle.crypto.params.SkeinParameters; //导入依赖的package包/类
private void testParameters() throws Exception
{
    Mac mac = Mac.getInstance("Skein-Mac-512-160", provider);

    // test six, init using SkeinParameters
    mac.init(new SecretKeySpec(shortMacKey, "Skein-Mac-512-160"),
            new SkeinParameters.Builder().setKeyIdentifier(keyIdentifier).build());
    byte[] result = mac.doFinal(shortMacMessage);

    if (!MessageDigest.isEqual(result, keyIdentifierVector))
    {
        fail("Mac with key identifier failed.", new String(Hex.encode(keyIdentifierVector)),  new String(Hex.encode(result)));
    }
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:15,代码来源:SkeinTest.java

示例3: engineInit

import org.bouncycastle.crypto.params.SkeinParameters; //导入依赖的package包/类
protected void engineInit(
    Key                     key,
    AlgorithmParameterSpec  params)
    throws InvalidKeyException, InvalidAlgorithmParameterException
{
    CipherParameters        param;

    if (key == null)
    {
        throw new InvalidKeyException("key is null");
    }

    if (key instanceof BCPBEKey)
    {
        BCPBEKey k = (BCPBEKey)key;

        if (k.getParam() != null)
        {
            param = k.getParam();
        }
        else if (params instanceof PBEParameterSpec)
        {
            param = PBE.Util.makePBEMacParameters(k, params);
        }
        else
        {
            throw new InvalidAlgorithmParameterException("PBE requires PBE parameters to be set.");
        }
    }
    else if (params instanceof IvParameterSpec)
    {
        param = new ParametersWithIV(new KeyParameter(key.getEncoded()), ((IvParameterSpec)params).getIV());
    }
    else if (params instanceof SkeinParameterSpec)
    {
        param = new SkeinParameters.Builder(copyMap(((SkeinParameterSpec)params).getParameters())).setKey(key.getEncoded()).build();
    }
    else if (params == null)
    {
        param = new KeyParameter(key.getEncoded());
    }
    else
    {
        throw new InvalidAlgorithmParameterException("unknown parameter type.");
    }

    macEngine.init(param);
}
 
开发者ID:NoYouShutup,项目名称:CryptMeme,代码行数:49,代码来源:BaseMac.java

示例4: engineInit

import org.bouncycastle.crypto.params.SkeinParameters; //导入依赖的package包/类
protected void engineInit(
    Key                     key,
    AlgorithmParameterSpec  params)
    throws InvalidKeyException, InvalidAlgorithmParameterException
{
    CipherParameters        param;

    if (key == null)
    {
        throw new InvalidKeyException("key is null");
    }

    if (key instanceof BCPBEKey)
    {
        BCPBEKey k = (BCPBEKey)key;

        if (k.getParam() != null)
        {
            param = k.getParam();
        }
        else if (params instanceof PBEParameterSpec)
        {
            param = PBE.Util.makePBEMacParameters(k, params);
        }
        else
        {
            throw new InvalidAlgorithmParameterException("PBE requires PBE parameters to be set.");
        }
    }
    else if (params instanceof IvParameterSpec)
    {
        param = new ParametersWithIV(new KeyParameter(key.getEncoded()), ((IvParameterSpec)params).getIV());
    }
    else if (params instanceof SkeinParameters)
    {
        param = new SkeinParameters.Builder((SkeinParameters) params).setKey(key.getEncoded()).build();
    }
    else if (params == null)
    {
        param = new KeyParameter(key.getEncoded());
    }
    else
    {
        throw new InvalidAlgorithmParameterException("unknown parameter type.");
    }

    macEngine.init(param);
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:49,代码来源:BaseMac.java

示例5: init

import org.bouncycastle.crypto.params.SkeinParameters; //导入依赖的package包/类
/**
 * Optionally initialises the Skein digest with the provided parameters.<br>
 * See {@link SkeinParameters} for details on the parameterisation of the Skein hash function.
 *
 * @param params the parameters to apply to this engine, or <code>null</code> to use no parameters.
 */
public void init(SkeinParameters params)
{
    engine.init(params);
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:11,代码来源:SkeinDigest.java


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