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

public final Class GOST28147

extends Object
Class Inheritance
Imports
java.security.SecureRandom, java.util.HashMap, .Map, org.bouncycastle.asn1.ASN1ObjectIdentifier, org.bouncycastle.asn1.cryptopro.CryptoProObjectIdentifiers, org.bouncycastle.asn1.rosstandart.RosstandartObjectIdentifiers, org.bouncycastle.crypto.Algorithm, .IllegalKeyException, .ParametersWithIV, .SymmetricKey, .SymmetricSecretKey, org.bouncycastle.crypto.internal.BlockCipher, .BufferedBlockCipher, .KeyGenerationParameters, .Mac, .ValidatedSymmetricKey, org.bouncycastle.crypto.internal.modes.AEADBlockCipher, org.bouncycastle.crypto.internal.params.KeyParameter, .KeyParameterImpl, org.bouncycastle.util.Arrays, .Strings, org.bouncycastle.util.encoders.Hex

Source class for implementations of GOST28147 based algorithms.

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static class
GOST28147.AEADOperatorFactory

Factory for GOST28147 AEAD encryption/decryption operators.

public static class
GOST28147.AuthParameters

Parameters for GOST28147 AEAD and MAC modes.

private static class
public static class
GOST28147.KeyGenerator

GOST28147 key generator.

public static class
GOST28147.MACOperatorFactory

Factory for producing GOST28147 MAC calculators.

public static class
GOST28147.OperatorFactory

Factory for basic GOST28147 encryption/decryption operators.

public static class
GOST28147.Parameters

Parameters for general GOST28147 block cipher modes.

Field Summary

Modifier and TypeField and Description
public static final GeneralAlgorithm
ALGORITHM

Raw GOST28147 algorithm, can be used for creating general purpose GOST28147 keys.

public static final GOST28147.Parameters
CBC

GOST28147 in cipher block chaining (CBC) mode.

public static final GOST28147.Parameters
CBCwithCS1

GOST28147 in cipher block chaining mode cipher text stealing type 1.

public static final GOST28147.Parameters
CBCwithCS2

GOST28147 in cipher block chaining mode cipher text stealing type 2.

public static final GOST28147.Parameters
CBCwithCS3

GOST28147 in cipher block chaining mode cipher text stealing type 3.

public static final GOST28147.Parameters
CBCwithISO10126_2

GOST28147 in cipher block chaining mode with ISO10126-2 padding.

public static final GOST28147.Parameters
CBCwithISO7816_4

GOST28147 in cipher block chaining mode with ISO7816-4 padding.

public static final GOST28147.Parameters
CBCwithPKCS7

GOST28147 in cipher block chaining mode with PKCS#7/PKCS#5 padding.

public static final GOST28147.Parameters
CBCwithTBC

GOST28147 in cipher block chaining mode with trailing bit complement (TBC) padding.

public static final GOST28147.Parameters
CBCwithX923

GOST28147 in cipher block chaining mode with X9.23 padding.

public static final GOST28147.Parameters
CFB64

GOST28147 in cipher feedback (CFB) mode, 64 bit block size.

public static final GOST28147.Parameters
CFB8

GOST28147 in cipher feedback (CFB) mode, 8 bit block size.

public static final GOST28147.AuthParameters
CMAC

GOST28147 cipher-based MAC algorithm.

public static final GOST28147.Parameters
CTR

GOST28147 in counter (CTR) mode.

private static byte[]
private static byte[]
public static final GOST28147.AuthParameters
EAX

GOST28147 in EAX mode..

public static final GOST28147.Parameters
ECB

GOST28147 in electronic code book (ECB) mode.

public static final GOST28147.Parameters
ECBwithISO10126_2

GOST28147 in electronic code book mode with ISO10126-2 padding.

public static final GOST28147.Parameters
ECBwithISO7816_4

GOST28147 in electronic code book mode with ISO7816-4 padding.

public static final GOST28147.Parameters
ECBwithPKCS7

GOST28147 in electronic code book mode with PKCS#7/PKCS#5 padding.

public static final GOST28147.Parameters
ECBwithTBC

GOST28147 in electronic code book mode with trailing bit complement (TBC) padding.

public static final GOST28147.Parameters
ECBwithX923

GOST28147 in electronic code book mode with X9.23 padding.

private static final GOST28147.EngineProvider
private static byte[]
private static byte[]
private static byte[]
private static byte[]
private static byte[]
public static final GOST28147.Parameters
GCFB

Standard GOST28147 GOST-CFB mode

public static final GOST28147.Parameters
GOFB

Standard GOST28147 GOST-OFB mode

public static final GOST28147.AuthParameters
MAC

Standard GOST28147 MAC algorithm

private static Map<String, ASN1ObjectIdentifier>
public static final GOST28147.Parameters
OFB

GOST28147 in output feedback (OFB) mode.

private static Map<ASN1ObjectIdentifier, String>
private static byte[]
private static byte[]
private static Map<String, byte[]>

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
addSBox(String sBoxName, byte[] sBox)

private static KeyParameter
createGOST28147Parameters(SymmetricKey key, Algorithm algorithm, byte[] sBox)

public static byte[]

Returns:

byte array representing the S-Box
getSBox
(String
name of the S-Box
sBoxName
)

Return the S-Box associated with SBoxName

public static byte[]

Returns:

byte array representing the S-Box
getSBox
(ASN1ObjectIdentifier
an object identifier associated with an S-Box.
sBoxOID
)

Return the S-Box associated with SBox OID.

public static String
public static ASN1ObjectIdentifier
public static ASN1ObjectIdentifier
getSBoxOID(byte[] sBox)

private static GOST28147Parameters
validateKey(SymmetricKey key, Algorithm genAlgorithm, byte[] sBox)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ALGORITHMback to summary
public static final GeneralAlgorithm ALGORITHM

Raw GOST28147 algorithm, can be used for creating general purpose GOST28147 keys.

CBCback to summary
public static final GOST28147.Parameters CBC

GOST28147 in cipher block chaining (CBC) mode.

CBCwithCS1back to summary
public static final GOST28147.Parameters CBCwithCS1

GOST28147 in cipher block chaining mode cipher text stealing type 1.

CBCwithCS2back to summary
public static final GOST28147.Parameters CBCwithCS2

GOST28147 in cipher block chaining mode cipher text stealing type 2.

CBCwithCS3back to summary
public static final GOST28147.Parameters CBCwithCS3

GOST28147 in cipher block chaining mode cipher text stealing type 3.

CBCwithISO10126_2back to summary
public static final GOST28147.Parameters CBCwithISO10126_2

GOST28147 in cipher block chaining mode with ISO10126-2 padding.

CBCwithISO7816_4back to summary
public static final GOST28147.Parameters CBCwithISO7816_4

GOST28147 in cipher block chaining mode with ISO7816-4 padding.

CBCwithPKCS7back to summary
public static final GOST28147.Parameters CBCwithPKCS7

GOST28147 in cipher block chaining mode with PKCS#7/PKCS#5 padding.

CBCwithTBCback to summary
public static final GOST28147.Parameters CBCwithTBC

GOST28147 in cipher block chaining mode with trailing bit complement (TBC) padding.

CBCwithX923back to summary
public static final GOST28147.Parameters CBCwithX923

GOST28147 in cipher block chaining mode with X9.23 padding.

CFB64back to summary
public static final GOST28147.Parameters CFB64

GOST28147 in cipher feedback (CFB) mode, 64 bit block size.

CFB8back to summary
public static final GOST28147.Parameters CFB8

GOST28147 in cipher feedback (CFB) mode, 8 bit block size.

CMACback to summary
public static final GOST28147.AuthParameters CMAC

GOST28147 cipher-based MAC algorithm.

CTRback to summary
public static final GOST28147.Parameters CTR

GOST28147 in counter (CTR) mode.

DSbox_Aback to summary
private static byte[] DSbox_A
DSbox_Testback to summary
private static byte[] DSbox_Test
EAXback to summary
public static final GOST28147.AuthParameters EAX

GOST28147 in EAX mode..

ECBback to summary
public static final GOST28147.Parameters ECB

GOST28147 in electronic code book (ECB) mode.

ECBwithISO10126_2back to summary
public static final GOST28147.Parameters ECBwithISO10126_2

GOST28147 in electronic code book mode with ISO10126-2 padding.

ECBwithISO7816_4back to summary
public static final GOST28147.Parameters ECBwithISO7816_4

GOST28147 in electronic code book mode with ISO7816-4 padding.

ECBwithPKCS7back to summary
public static final GOST28147.Parameters ECBwithPKCS7

GOST28147 in electronic code book mode with PKCS#7/PKCS#5 padding.

ECBwithTBCback to summary
public static final GOST28147.Parameters ECBwithTBC

GOST28147 in electronic code book mode with trailing bit complement (TBC) padding.

ECBwithX923back to summary
public static final GOST28147.Parameters ECBwithX923

GOST28147 in electronic code book mode with X9.23 padding.

ENGINE_PROVIDERback to summary
private static final GOST28147.EngineProvider ENGINE_PROVIDER
ESbox_Aback to summary
private static byte[] ESbox_A
ESbox_Bback to summary
private static byte[] ESbox_B
ESbox_Cback to summary
private static byte[] ESbox_C
ESbox_Dback to summary
private static byte[] ESbox_D
ESbox_Testback to summary
private static byte[] ESbox_Test
GCFBback to summary
public static final GOST28147.Parameters GCFB

Standard GOST28147 GOST-CFB mode

GOFBback to summary
public static final GOST28147.Parameters GOFB

Standard GOST28147 GOST-OFB mode

MACback to summary
public static final GOST28147.AuthParameters MAC

Standard GOST28147 MAC algorithm

nameMappingsback to summary
private static Map<String, ASN1ObjectIdentifier> nameMappings
OFBback to summary
public static final GOST28147.Parameters OFB

GOST28147 in output feedback (OFB) mode.

oidMappingsback to summary
private static Map<ASN1ObjectIdentifier, String> oidMappings
Param_Zback to summary
private static byte[] Param_Z
Sbox_Defaultback to summary
private static byte[] Sbox_Default
sBoxesback to summary
private static Map<String, byte[]> sBoxes

Constructor Detail

GOST28147back to summary
private GOST28147()

Method Detail

addSBoxback to summary
private static void addSBox(String sBoxName, byte[] sBox)
createGOST28147Parametersback to summary
private static KeyParameter createGOST28147Parameters(SymmetricKey key, Algorithm algorithm, byte[] sBox)
getSBoxback to summary
public static byte[] getSBox(String sBoxName)

Return the S-Box associated with SBoxName

Parameters
sBoxName:String

name of the S-Box

Returns:byte[]

byte array representing the S-Box

getSBoxback to summary
public static byte[] getSBox(ASN1ObjectIdentifier sBoxOID)

Return the S-Box associated with SBox OID.

Parameters
sBoxOID:ASN1ObjectIdentifier

an object identifier associated with an S-Box.

Returns:byte[]

byte array representing the S-Box

getSBoxNameback to summary
public static String getSBoxName(ASN1ObjectIdentifier oid)
getSBoxOIDback to summary
public static ASN1ObjectIdentifier getSBoxOID(String name)
getSBoxOIDback to summary
public static ASN1ObjectIdentifier getSBoxOID(byte[] sBox)
validateKeyback to summary
private static GOST28147Parameters validateKey(SymmetricKey key, Algorithm genAlgorithm, byte[] sBox)
org.bouncycastle.crypto.general back to summary

public final Class GOST28147.AEADOperatorFactory

extends GuardedAEADOperatorFactory<GOST28147.AuthParameters>
Class Inheritance

Factory for GOST28147 AEAD encryption/decryption operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected AEADBlockCipher
Inherited from org.bouncycastle.crypto.general.GuardedAEADOperatorFactory:
createInputAEADDecryptorcreateOutputAEADDecryptorcreateOutputAEADEncryptor

Constructor Detail

AEADOperatorFactoryback to summary
public AEADOperatorFactory()

Method Detail

createAEADCipherback to summary
protected AEADBlockCipher createAEADCipher(boolean forEncryption, SymmetricKey key, GOST28147.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedAEADOperatorFactory.createAEADCipher.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class GOST28147.AuthParameters

extends GeneralAuthParameters<GOST28147.AuthParameters>
Class Inheritance

Parameters for GOST28147 AEAD and MAC modes.

Field Summary

Modifier and TypeField and Description
private final byte[]
Inherited from org.bouncycastle.crypto.general.GeneralAuthParameters:
macLenInBits

Constructor Summary

AccessConstructor and Description
private
AuthParameters(GeneralAlgorithm algorithm, byte[] iv, int tagLenInBits, byte[] sBox)

pack-priv
AuthParameters(GeneralAlgorithm
algorithm mode.
algorithm
)

Base constructor - the algorithm, null IV.

public
AuthParameters(GeneralAlgorithm
algorithm mode.
algorithm
,
byte[]
alternate sBox to use.
sBox
)

Base constructor - the algorithm, null IV.

Method Summary

Modifier and TypeMethod and Description
protected GOST28147.AuthParameters
create(GeneralAlgorithm algorithm, byte[] iv, int macSizeInBits)

Implements abstract org.bouncycastle.crypto.general.GeneralAuthParameters.create.

public byte[]
public GOST28147.AuthParameters
withSBox(byte[] sBox)

Inherited from org.bouncycastle.crypto.general.GeneralAuthParameters:
creategetMACSizeInBitswithIVwithMACSize

Field Detail

sBoxback to summary
private final byte[] sBox

Constructor Detail

AuthParametersback to summary
private AuthParameters(GeneralAlgorithm algorithm, byte[] iv, int tagLenInBits, byte[] sBox)
AuthParametersback to summary
pack-priv AuthParameters(GeneralAlgorithm algorithm)

Base constructor - the algorithm, null IV. In this case the tag length defaults to the 64 for CMAC, 32 bits otherwise.

Parameters
algorithm:GeneralAlgorithm

algorithm mode.

AuthParametersback to summary
public AuthParameters(GeneralAlgorithm algorithm, byte[] sBox)

Base constructor - the algorithm, null IV. In this case the tag length defaults to the 64 for CMAC, 32 bits otherwise.

Parameters
algorithm:GeneralAlgorithm

algorithm mode.

sBox:byte[]

alternate sBox to use.

Method Detail

createback to summary
protected GOST28147.AuthParameters create(GeneralAlgorithm algorithm, byte[] iv, int macSizeInBits)

Implements abstract org.bouncycastle.crypto.general.GeneralAuthParameters.create.

getSBoxback to summary
public byte[] getSBox()
withSBoxback to summary
public GOST28147.AuthParameters withSBox(byte[] sBox)
org.bouncycastle.crypto.general back to summary

private final Class GOST28147.EngineProvider

extends Object
implements EngineProvider<BlockCipher>
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.internal.EngineProvider

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
public BlockCipher
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

EngineProviderback to summary
private EngineProvider()

Method Detail

createEngineback to summary
public BlockCipher createEngine()

Implements org.bouncycastle.crypto.internal.EngineProvider.createEngine.

org.bouncycastle.crypto.general back to summary

public final Class GOST28147.KeyGenerator

extends GuardedSymmetricKeyGenerator
Class Inheritance

GOST28147 key generator.

Field Summary

Modifier and TypeField and Description
private final Algorithm
private final SecureRandom

Constructor Summary

AccessConstructor and Description
public
public
KeyGenerator(GeneralParameters<T extends Algorithm> algorithm, SecureRandom random)

Method Summary

Modifier and TypeMethod and Description
protected SymmetricKey
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator:
generateKey

Field Detail

algorithmback to summary
private final Algorithm algorithm
randomback to summary
private final SecureRandom random

Constructor Detail

KeyGeneratorback to summary
public KeyGenerator(SecureRandom random)
KeyGeneratorback to summary
public KeyGenerator(GeneralParameters<T extends Algorithm> algorithm, SecureRandom random)

Method Detail

doGenerateKeyback to summary
protected SymmetricKey doGenerateKey()

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricKeyGenerator.doGenerateKey.

org.bouncycastle.crypto.general back to summary

public final Class GOST28147.MACOperatorFactory

extends GuardedMACOperatorFactory<GOST28147.AuthParameters>
Class Inheritance

Factory for producing GOST28147 MAC calculators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected int
protected Mac
Inherited from org.bouncycastle.crypto.general.GuardedMACOperatorFactory:
createOutputMACCalculator

Constructor Detail

MACOperatorFactoryback to summary
public MACOperatorFactory()

Method Detail

calculateMACSizeback to summary
protected int calculateMACSize(GOST28147.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedMACOperatorFactory.calculateMACSize.

Annotations
@Override
createMACback to summary
protected Mac createMAC(SymmetricKey key, final GOST28147.AuthParameters parameters)

Implements abstract org.bouncycastle.crypto.general.GuardedMACOperatorFactory.createMAC.

Annotations
@Override
org.bouncycastle.crypto.general back to summary

public final Class GOST28147.OperatorFactory

extends GuardedSymmetricOperatorFactory<GOST28147.Parameters>
Class Inheritance

Factory for basic GOST28147 encryption/decryption operators.

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
protected BufferedBlockCipher
Inherited from org.bouncycastle.crypto.general.GuardedSymmetricOperatorFactory:
createInputDecryptorcreateOutputDecryptorcreateOutputEncryptor

Constructor Detail

OperatorFactoryback to summary
public OperatorFactory()

Method Detail

createCipherback to summary
protected BufferedBlockCipher createCipher(boolean forEncryption, SymmetricKey key, GOST28147.Parameters parameters, SecureRandom random)

Implements abstract org.bouncycastle.crypto.general.GuardedSymmetricOperatorFactory.createCipher.

org.bouncycastle.crypto.general back to summary

public final Class GOST28147.Parameters

extends GeneralParameters<GeneralAlgorithm>
implements ParametersWithIV
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.ParametersWithIV, org.bouncycastle.crypto.Parameters

Parameters for general GOST28147 block cipher modes.

Field Summary

Modifier and TypeField and Description
private final byte[]
private final byte[]

Constructor Summary

AccessConstructor and Description
pack-priv
private
Parameters(GOST28147.Parameters parameters, boolean isSbox, byte[] data)

Method Summary

Modifier and TypeMethod and Description
public byte[]
getIV()

Implements org.bouncycastle.crypto.ParametersWithIV.getIV.

Return the initialization vector associated with this parameter set.
public byte[]
public GOST28147.Parameters
withIV(byte[]
the IV to use.
iv
)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV.
public GOST28147.Parameters
withIV(SecureRandom
the SecureRandom to use as the source of IV data.
random
)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV based on the output of the passed in random.
public GOST28147.Parameters
withSBox(byte[] sBox)

Inherited from org.bouncycastle.crypto.general.GeneralParameters:
getAlgorithm

Field Detail

ivback to summary
private final byte[] iv
sBoxback to summary
private final byte[] sBox

Constructor Detail

Parametersback to summary
pack-priv Parameters(GeneralAlgorithm algorithm)
Parametersback to summary
private Parameters(GOST28147.Parameters parameters, boolean isSbox, byte[] data)

Method Detail

getIVback to summary
public byte[] getIV()

Implements org.bouncycastle.crypto.ParametersWithIV.getIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.getIV.

Return the initialization vector associated with this parameter set.

Returns:byte[]

the IV for these parameters.

getSBoxback to summary
public byte[] getSBox()
withIVback to summary
public GOST28147.Parameters withIV(byte[] iv)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV.

Parameters
iv:byte[]

the IV to use.

Returns:GOST28147.Parameters

a copy of the current parameter set with the new IV.

withIVback to summary
public GOST28147.Parameters withIV(SecureRandom random)

Implements org.bouncycastle.crypto.ParametersWithIV.withIV.

Doc from org.bouncycastle.crypto.ParametersWithIV.withIV.

Create a new parameter set with a different IV based on the output of the passed in random.

Parameters
random:SecureRandom

the SecureRandom to use as the source of IV data.

Returns:GOST28147.Parameters

a copy of the current parameter set with the new IV.

withSBoxback to summary
public GOST28147.Parameters withSBox(byte[] sBox)