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

pack-priv Class GOST28147Mac

extends Object
implements Mac
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.Mac
Imports
org.bouncycastle.crypto.internal.CipherParameters, .DataLengthException, .Mac, org.bouncycastle.crypto.internal.params.KeyParameter

implementation of GOST 28147-89 MAC

Field Summary

Modifier and TypeField and Description
private int
private byte[]
private int
private boolean
private byte[]
private int
private byte[]
S

private int[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private int
bytesToint(byte[] in, int inOff)

private byte[]
CM5func(byte[] buf, int bufOff, byte[] mac)

public int
doFinal(byte[]
the array the MAC is to be output to.
out
,
int
the offset into the out buffer the output is to start at.
outOff
)

Implements org.bouncycastle.crypto.internal.Mac.doFinal.

Compute the final stage of the MAC writing the output to the out parameter.
private int[]
generateWorkingKey(byte[] userKey)

public String
getAlgorithmName()

Implements org.bouncycastle.crypto.internal.Mac.getAlgorithmName.

Return the name of the algorithm the MAC implements.
public int
getMacSize()

Implements org.bouncycastle.crypto.internal.Mac.getMacSize.

Return the block size for this MAC (in bytes).
private int
gost28147_mainStep(int n1, int key)

private void
gost28147MacFunc(int[] workingKey, byte[] in, int inOff, byte[] out, int outOff)

public void
init(CipherParameters
the key and other data required by the MAC.
params
)

Implements org.bouncycastle.crypto.internal.Mac.init.

Initialise the MAC.
private void
intTobytes(int num, byte[] out, int outOff)

public void
public void
update(byte
the byte to be processed.
in
)

Implements org.bouncycastle.crypto.internal.Mac.update.

add a single byte to the mac for processing.
public void
update(byte[]
the array containing the input.
in
,
int
the index in the array the data begins at.
inOff
,
int
the length of the input starting at inOff.
len
)

Implements org.bouncycastle.crypto.internal.Mac.update.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

blockSizeback to summary
private int blockSize
bufback to summary
private byte[] buf
bufOffback to summary
private int bufOff
firstStepback to summary
private boolean firstStep
macback to summary
private byte[] mac
macSizeback to summary
private int macSize
Sback to summary
private byte[] S
workingKeyback to summary
private int[] workingKey

Constructor Detail

GOST28147Macback to summary
public GOST28147Mac()

Method Detail

bytesTointback to summary
private int bytesToint(byte[] in, int inOff)
CM5funcback to summary
private byte[] CM5func(byte[] buf, int bufOff, byte[] mac)
doFinalback to summary
public int doFinal(byte[] out, int outOff) throws DataLengthException, IllegalStateException

Implements org.bouncycastle.crypto.internal.Mac.doFinal.

Doc from org.bouncycastle.crypto.internal.Mac.doFinal.

Compute the final stage of the MAC writing the output to the out parameter.

doFinal leaves the MAC in the same state it was after the last init.

Parameters
out:byte[]

the array the MAC is to be output to.

outOff:int

the offset into the out buffer the output is to start at.

Exceptions
DataLengthException:
if there isn't enough space in out.
IllegalStateException:
if the MAC is not initialised.
generateWorkingKeyback to summary
private int[] generateWorkingKey(byte[] userKey)
getAlgorithmNameback to summary
public String getAlgorithmName()

Implements org.bouncycastle.crypto.internal.Mac.getAlgorithmName.

Doc from org.bouncycastle.crypto.internal.Mac.getAlgorithmName.

Return the name of the algorithm the MAC implements.

Returns:String

the name of the algorithm the MAC implements.

getMacSizeback to summary
public int getMacSize()

Implements org.bouncycastle.crypto.internal.Mac.getMacSize.

Doc from org.bouncycastle.crypto.internal.Mac.getMacSize.

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

Returns:int

the block size for this MAC in bytes.

gost28147_mainStepback to summary
private int gost28147_mainStep(int n1, int key)
gost28147MacFuncback to summary
private void gost28147MacFunc(int[] workingKey, byte[] in, int inOff, byte[] out, int outOff)
initback to summary
public void init(CipherParameters params) throws IllegalArgumentException

Implements org.bouncycastle.crypto.internal.Mac.init.

Doc from org.bouncycastle.crypto.internal.Mac.init.

Initialise the MAC.

Parameters
params:CipherParameters

the key and other data required by the MAC.

Exceptions
IllegalArgumentException:
if the params argument is inappropriate.
intTobytesback to summary
private void intTobytes(int num, byte[] out, int outOff)
resetback to summary
public void reset()

Implements org.bouncycastle.crypto.internal.Mac.reset.

Doc from org.bouncycastle.crypto.internal.Mac.reset.

Reset the MAC. At the end of resetting the MAC should be in the in the same state it was after the last init (if there was one).

updateback to summary
public void update(byte in) throws IllegalStateException

Implements org.bouncycastle.crypto.internal.Mac.update.

Doc from org.bouncycastle.crypto.internal.Mac.update.

add a single byte to the mac for processing.

Parameters
in:byte

the byte to be processed.

Exceptions
IllegalStateException:
if the MAC is not initialised.
updateback to summary
public void update(byte[] in, int inOff, int len) throws DataLengthException, IllegalStateException

Implements org.bouncycastle.crypto.internal.Mac.update.

Parameters
in:byte[]

Doc from org.bouncycastle.crypto.internal.Mac.update.

the array containing the input.

inOff:int

Doc from org.bouncycastle.crypto.internal.Mac.update.

the index in the array the data begins at.

len:int

Doc from org.bouncycastle.crypto.internal.Mac.update.

the length of the input starting at inOff.

Exceptions
DataLengthException:

Doc from org.bouncycastle.crypto.internal.Mac.update.

if there isn't enough data in in.

IllegalStateException:

Doc from org.bouncycastle.crypto.internal.Mac.update.

if the MAC is not initialised.