Package net.randombit.botan.seckey.block
Class BotanBlockCipher
java.lang.Object
javax.crypto.CipherSpi
net.randombit.botan.seckey.BotanBaseAsymmetricCipher
net.randombit.botan.seckey.block.BotanBlockCipher
- Direct Known Subclasses:
BotanAeadCipher,BotanBlockCipher.AesCbc,BotanBlockCipher.AesCfb,BotanBlockCipher.DesCbc,BotanBlockCipher.DesCfb,BotanBlockCipher.DesEdeCbc,BotanBlockCipher.DesEdeCfb
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic final classstatic final classstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected byte[]Native botan_cipher_update() will be called only with blocks of sizeupdateGranularity.protected final CipherModeHolds theCipherMode.protected PaddingAlgorithmHolds the padding algorithm (e.g.protected intBotan update granularity for this cipher. botan_cipher_update() must be called with blocks of this size, except for doFinal().Fields inherited from class net.randombit.botan.seckey.BotanBaseAsymmetricCipher
cipherRef, iv, mode, name -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBotanBlockCipher(String name, CipherMode cipherMode, int blockSize) -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]engineDoFinal(byte[] input, int inputOffset, int inputLen) protected intprotected intengineGetOutputSize(int inputLen) protected voidengineInit(int opmode, Key key, SecureRandom random) protected voidprotected voidengineSetPadding(String padding) protected byte[]engineUpdate(byte[] input, int inputOffset, int inputLen) protected booleanisValidNonceLength(int nonceLength) Checks whether the given nonce size is supported.protected abstract booleanWhether the operation modes requires data block aligned or not.Methods inherited from class net.randombit.botan.seckey.BotanBaseAsymmetricCipher
clone, doCipher, engineDoFinal, engineGetIV, engineGetParameters, engineInit, engineInit, engineSetMode, engineUpdate, getBotanCipherName, isDecryptingMethods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineGetKeySize, engineUnwrap, engineUpdate, engineUpdateAAD, engineUpdateAAD, engineWrap
-
Field Details
-
cipherMode
Holds theCipherMode. -
padding
Holds the padding algorithm (e.g. PKCS5) -
updateGranularity
protected int updateGranularityBotan update granularity for this cipher. botan_cipher_update() must be called with blocks of this size, except for doFinal(). -
buffer
protected byte[] bufferNative botan_cipher_update() will be called only with blocks of sizeupdateGranularity. The rest will be held until the next update or doFinal call.
-
-
Constructor Details
-
BotanBlockCipher
-
-
Method Details
-
requiresDataBlockAligned
protected abstract boolean requiresDataBlockAligned()Whether the operation modes requires data block aligned or not.- Returns:
trueif data must be block size aligned,falseotherwise.
-
engineSetPadding
- Specified by:
engineSetPaddingin classCipherSpi- Throws:
NoSuchPaddingException
-
engineGetBlockSize
protected int engineGetBlockSize()- Specified by:
engineGetBlockSizein classCipherSpi
-
engineGetOutputSize
protected int engineGetOutputSize(int inputLen) - Specified by:
engineGetOutputSizein classCipherSpi
-
engineInit
- Overrides:
engineInitin classBotanBaseAsymmetricCipher- Throws:
InvalidKeyException
-
engineUpdate
protected byte[] engineUpdate(byte[] input, int inputOffset, int inputLen) - Specified by:
engineUpdatein classCipherSpi
-
engineDoFinal
protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLen) throws IllegalBlockSizeException - Specified by:
engineDoFinalin classBotanBaseAsymmetricCipher- Throws:
IllegalBlockSizeException
-
engineReset
protected void engineReset()- Overrides:
engineResetin classBotanBaseAsymmetricCipher
-
isValidNonceLength
protected boolean isValidNonceLength(int nonceLength) Description copied from class:BotanBaseAsymmetricCipherChecks whether the given nonce size is supported.- Specified by:
isValidNonceLengthin classBotanBaseAsymmetricCipher- Parameters:
nonceLength- the nonce length- Returns:
Trueis the given nonce length is supported,Falseotherwise.
-