Java 类org.bouncycastle.crypto.params.SkeinParameters 实例源码

项目:gwt-crypto    文件:SkeinEngine.java   
/**
 * 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);
}
项目:Aki-SSL    文件:SkeinEngine.java   
/**
 * 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);
}
项目:TinyTravelTracker    文件:SkeinEngine.java   
/**
 * 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);
}
项目:CryptMeme    文件:SkeinEngine.java   
/**
 * 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);
}
项目:irma_future_id    文件:SkeinEngine.java   
/**
 * 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);
}
项目:irma_future_id    文件:SkeinTest.java   
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)));
    }
}
项目:bc-java    文件:SkeinEngine.java   
/**
 * 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);
}
项目:bc-java    文件:SkeinTest.java   
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)));
    }
}
项目:CryptMeme    文件:BaseMac.java   
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);
}
项目:irma_future_id    文件:BaseMac.java   
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);
}
项目:bc-java    文件:BaseMac.java   
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);
}
项目:gwt-crypto    文件:SkeinDigest.java   
/**
 * 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);
}
项目:Aki-SSL    文件:SkeinDigest.java   
/**
 * 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);
}
项目:TinyTravelTracker    文件:SkeinDigest.java   
/**
 * 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);
}
项目:CryptMeme    文件:SkeinDigest.java   
/**
 * 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);
}
项目:irma_future_id    文件:SkeinDigest.java   
/**
 * 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);
}
项目:bc-java    文件:SkeinDigest.java   
/**
 * 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);
}