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


Java ParametersWithSBox类代码示例

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


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

示例1: reset

import org.bouncycastle.crypto.params.ParametersWithSBox; //导入依赖的package包/类
public void reset(Memoable other)
{
    GOST3411Digest t = (GOST3411Digest)other;

    this.sBox = t.sBox;
    cipher.init(true, new ParametersWithSBox(null, sBox));

    reset();

    System.arraycopy(t.H, 0, this.H, 0, t.H.length);
    System.arraycopy(t.L, 0, this.L, 0, t.L.length);
    System.arraycopy(t.M, 0, this.M, 0, t.M.length);
    System.arraycopy(t.Sum, 0, this.Sum, 0, t.Sum.length);
    System.arraycopy(t.C[1], 0, this.C[1], 0, t.C[1].length);
    System.arraycopy(t.C[2], 0, this.C[2], 0, t.C[2].length);
    System.arraycopy(t.C[3], 0, this.C[3], 0, t.C[3].length);
    System.arraycopy(t.xBuf, 0, this.xBuf, 0, t.xBuf.length);

    this.xBufOff = t.xBufOff;
    this.byteCount = t.byteCount;
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:22,代码来源:GOST3411Digest.java

示例2: init

import org.bouncycastle.crypto.params.ParametersWithSBox; //导入依赖的package包/类
public void init(boolean forEncryption, CipherParameters params)
    throws IllegalArgumentException
{
    counter = 0;
    cfbEngine.init(forEncryption, params);

    this.forEncryption = forEncryption;

    if (params instanceof ParametersWithIV)
    {
        params = ((ParametersWithIV)params).getParameters();
    }

    if (params instanceof ParametersWithRandom)
    {
        params = ((ParametersWithRandom)params).getParameters();
    }

    if (params instanceof ParametersWithSBox)
    {
        params = ((ParametersWithSBox)params).getParameters();
    }

    key = (KeyParameter)params;
}
 
开发者ID:ttt43ttt,项目名称:gwt-crypto,代码行数:26,代码来源:GCFBBlockCipher.java

示例3: init

import org.bouncycastle.crypto.params.ParametersWithSBox; //导入依赖的package包/类
/**
 * initialise an GOST28147 cipher.
 *
 * @param forEncryption whether or not we are for encryption.
 * @param params the parameters required to set up the cipher.
 * @exception IllegalArgumentException if the params argument is
 * inappropriate.
 */
public void init(
    boolean           forEncryption,
    CipherParameters  params)
{
    if (params instanceof ParametersWithSBox)
    {
        ParametersWithSBox   param = (ParametersWithSBox)params;

        //
        // Set the S-Box
        //
        byte[] sBox = param.getSBox();
        if (sBox.length != Sbox_Default.length)
        {
            throw new IllegalArgumentException("invalid S-box passed to GOST28147 init");
        }
        this.S = Arrays.clone(sBox);

        //
        // set key if there is one
        //
        if (param.getParameters() != null)
        {
            workingKey = generateWorkingKey(forEncryption,
                    ((KeyParameter)param.getParameters()).getKey());
        }
    }
    else if (params instanceof KeyParameter)
    {
        workingKey = generateWorkingKey(forEncryption,
                              ((KeyParameter)params).getKey());
    }
    else if (params != null)
    {
       throw new IllegalArgumentException("invalid parameter passed to GOST28147 init - " + params.getClass().getName());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:46,代码来源:GOST28147Engine.java

示例4: init

import org.bouncycastle.crypto.params.ParametersWithSBox; //导入依赖的package包/类
public void init(
    CipherParameters params)
    throws IllegalArgumentException
{
    reset();
    buf = new byte[blockSize];
    if (params instanceof ParametersWithSBox)
    {
        ParametersWithSBox   param = (ParametersWithSBox)params;

        //
        // Set the S-Box
        //
        System.arraycopy(param.getSBox(), 0, this.S, 0, param.getSBox().length);

        //
        // set key if there is one
        //
        if (param.getParameters() != null)
        {
            workingKey = generateWorkingKey(((KeyParameter)param.getParameters()).getKey());
        }
    }
    else if (params instanceof KeyParameter)
    {
        workingKey = generateWorkingKey(((KeyParameter)params).getKey());
    }
    else
    {
       throw new IllegalArgumentException("invalid parameter passed to GOST28147 init - " + params.getClass().getName());
    }
}
 
开发者ID:Appdome,项目名称:ipack,代码行数:33,代码来源:GOST28147Mac.java

示例5: GOST3411Digest

import org.bouncycastle.crypto.params.ParametersWithSBox; //导入依赖的package包/类
/**
 * Standard constructor
 */
public GOST3411Digest()
{
    sBox = GOST28147Engine.getSBox("D-A");
    cipher.init(true, new ParametersWithSBox(null, sBox));

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


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