Top Description Fields Constructors Methods
org.bouncycastle.crypto.engines

public Class GOST3412_2015Engine

extends Object
implements BlockCipher
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.BlockCipher
Imports
org.bouncycastle.crypto.BlockCipher, .CipherParameters, .DataLengthException, .OutputLengthException, org.bouncycastle.crypto.params.KeyParameter, org.bouncycastle.util.Arrays

Implementation of GOST 3412 2015 (aka "Kuznyechik") RFC 7801, GOST 3412

Field Summary

Modifier and TypeField and Description
private byte[][]
protected static final int
private boolean
private static final byte[]
private int
private final byte[]
private static final byte[]
private int
private byte[][]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
C(byte[] c, int i)

private void
F(byte[] k, byte[] a1, byte[] a0)

private void
generateSubKeys(byte[] userKey)

public String
getAlgorithmName()

Implements org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.
public int
getBlockSize()

Implements org.bouncycastle.crypto.BlockCipher.getBlockSize.

Return the block size for this cipher (in bytes).
private void
GOST3412_2015Func(byte[] in, int inOff, byte[] out, int outOff)

public void
init(boolean
if true the cipher is initialised for encryption, if false for decryption.
forEncryption
,
CipherParameters
the key and other data required by the cipher.
params
)

Implements org.bouncycastle.crypto.BlockCipher.init.

Initialise the cipher.
private static byte[][]
private void
inverseL(byte[] data)

private void
inverseR(byte[] data)

private void
inverseS(byte[] data)

private static byte
kuz_mul_gf256_slow(byte a, byte b)

private void
L(byte[] data)

private byte
l(byte[] data)

private byte[]
LSX(byte[] k, byte[] a)

public int
processBlock(byte[]
the array containing the input data.
in
,
int
offset into the in array the data starts at.
inOff
,
byte[]
the array the output data will be copied into.
out
,
int
the offset into the out array the output will start at.
outOff
)

Implements org.bouncycastle.crypto.BlockCipher.processBlock.

Process one block of input from the array in and write it to the out array.
private void
R(byte[] data)

public void
reset()

Implements org.bouncycastle.crypto.BlockCipher.reset.

Reset the cipher.
private void
S(byte[] data)

private int
unsignedByte(byte b)

private void
X(byte[] result, byte[] data)

private byte[]
XSL(byte[] k, byte[] a)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_gf_mulback to summary
private byte[][] _gf_mul
BLOCK_SIZEback to summary
protected static final int BLOCK_SIZE
forEncryptionback to summary
private boolean forEncryption
inversePIback to summary
private static final byte[] inversePI
KEY_LENGTHback to summary
private int KEY_LENGTH
lFactorsback to summary
private final byte[] lFactors
PIback to summary
private static final byte[] PI
SUB_LENGTHback to summary
private int SUB_LENGTH
subKeysback to summary
private byte[][] subKeys

Constructor Detail

GOST3412_2015Engineback to summary
public GOST3412_2015Engine()

Method Detail

Cback to summary
private void C(byte[] c, int i)
Fback to summary
private void F(byte[] k, byte[] a1, byte[] a0)
generateSubKeysback to summary
private void generateSubKeys(byte[] userKey)
getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Doc from org.bouncycastle.crypto.BlockCipher.getAlgorithmName.

Return the name of the algorithm the cipher implements.

Returns:String

the name of the algorithm the cipher implements.

getBlockSizeback to summary
public int getBlockSize()

Implements org.bouncycastle.crypto.BlockCipher.getBlockSize.

Doc from org.bouncycastle.crypto.BlockCipher.getBlockSize.

Return the block size for this cipher (in bytes).

Returns:int

the block size for this cipher in bytes.

GOST3412_2015Funcback to summary
private void GOST3412_2015Func(byte[] in, int inOff, byte[] out, int outOff)
initback to summary
public void init(boolean forEncryption, CipherParameters params) throws IllegalArgumentException

Implements org.bouncycastle.crypto.BlockCipher.init.

Doc from org.bouncycastle.crypto.BlockCipher.init.

Initialise the cipher.

Parameters
forEncryption:boolean

if true the cipher is initialised for encryption, if false for decryption.

params:CipherParameters

the key and other data required by the cipher.

Exceptions
IllegalArgumentException:
if the params argument is inappropriate.
init_gf256_mul_tableback to summary
private static byte[][] init_gf256_mul_table()
inverseLback to summary
private void inverseL(byte[] data)
inverseRback to summary
private void inverseR(byte[] data)
inverseSback to summary
private void inverseS(byte[] data)
kuz_mul_gf256_slowback to summary
private static byte kuz_mul_gf256_slow(byte a, byte b)
Lback to summary
private void L(byte[] data)
lback to summary
private byte l(byte[] data)
LSXback to summary
private byte[] LSX(byte[] k, byte[] a)
processBlockback to summary
public int processBlock(byte[] in, int inOff, byte[] out, int outOff) throws DataLengthException, IllegalStateException

Implements org.bouncycastle.crypto.BlockCipher.processBlock.

Doc from org.bouncycastle.crypto.BlockCipher.processBlock.

Process one block of input from the array in and write it to the out array.

Parameters
in:byte[]

the array containing the input data.

inOff:int

offset into the in array the data starts at.

out:byte[]

the array the output data will be copied into.

outOff:int

the offset into the out array the output will start at.

Returns:int

the number of bytes processed and produced.

Exceptions
DataLengthException:
if there isn't enough data in input , or space in out.
IllegalStateException:
if the cipher isn't initialised.
Rback to summary
private void R(byte[] data)
resetback to summary
public void reset()

Implements org.bouncycastle.crypto.BlockCipher.reset.

Doc from org.bouncycastle.crypto.BlockCipher.reset.

Reset the cipher. After resetting the cipher is in the same state as it was after the last init (if there was one).

Sback to summary
private void S(byte[] data)
unsignedByteback to summary
private int unsignedByte(byte b)
Xback to summary
private void X(byte[] result, byte[] data)
XSLback to summary
private byte[] XSL(byte[] k, byte[] a)