public class NullCipher extends javax.crypto.CipherSpi implements PKCS11EngineClass
Constructor and Description |
---|
NullCipher()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineDoFinal(byte[] input,
int inputOffset,
int inputLength)
Just returns a clone of the input data.
|
protected int |
engineDoFinal(byte[] input,
int inputOffset,
int inputLen,
byte[] output,
int outputOffset)
Just copy the input to the output.
|
protected int |
engineGetBlockSize()
Return 1.
|
protected byte[] |
engineGetIV()
Returns null.
|
protected int |
engineGetKeySize(java.security.Key key)
Returns -1.
|
protected int |
engineGetOutputSize(int inputLength)
Returns -1.
|
protected java.security.AlgorithmParameters |
engineGetParameters()
Returns null.
|
protected void |
engineInit(int operationMode,
java.security.Key key,
java.security.spec.AlgorithmParameterSpec parameterSpecs,
java.security.SecureRandom randomSource)
Does nothing, because this cipher needs no initialization.
|
protected void |
engineInit(int operationMode,
java.security.Key key,
java.security.AlgorithmParameters parameters,
java.security.SecureRandom random)
Does nothing, because this cipher needs no initialization.
|
protected void |
engineInit(int operationMode,
java.security.Key key,
java.security.SecureRandom randomSource)
Does nothing, because this cipher needs no initialization.
|
protected void |
engineSetMode(java.lang.String mode)
Does nothing, because this cipher needs no mode.
|
protected void |
engineSetPadding(java.lang.String padding)
Does nothing, because this cipher needs no padding.
|
protected java.security.Key |
engineUnwrap(byte[] wrappedKey,
java.lang.String wrappedKeyAlgorithm,
int wrappedKeyType)
Just returns the given wrapped key as key material in a key object.
|
protected byte[] |
engineUpdate(byte[] data,
int offset,
int length)
Just return the input data.
|
protected int |
engineUpdate(byte[] input,
int inputOffset,
int inputLength,
byte[] output,
int outputOffset)
Update the cureently running cipher operation with the given data and write the intermediate
result (if any) to the given buffer.
|
protected byte[] |
engineWrap(java.security.Key key)
Wrap (encrypt) the given key.
|
boolean |
isSupportedBy(TokenManager tokenManager)
Always returns true.
|
public boolean isSupportedBy(TokenManager tokenManager)
isSupportedBy
in interface PKCS11EngineClass
tokenManager
- Not used by this implementation.protected int engineDoFinal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException
engineDoFinal
in class javax.crypto.CipherSpi
input
- The byte array that holds the input data.inputOffset
- The offset in the input byte array that indicates the first input data byte to read.inputLen
- The number of bytes to read starting from offset.output
- The byte array that receives the final output data.outputOffset
- The offset in the output byte array where to start writing the output.javax.crypto.ShortBufferException
- If the provided output buffer is too small.protected byte[] engineDoFinal(byte[] input, int inputOffset, int inputLength) throws javax.crypto.BadPaddingException, javax.crypto.IllegalBlockSizeException
engineDoFinal
in class javax.crypto.CipherSpi
input
- The byte array that holds the input data.inputOffset
- The offset in the input byte array that indicates the first input data byte to read.inputLength
- The number of bytes to read starting from offset.javax.crypto.BadPaddingException
- If the padding of the decrypted data is bad or if the padding of the input data
failed.javax.crypto.IllegalBlockSizeException
- If the input data size does not match the required block size.protected int engineGetBlockSize()
engineGetBlockSize
in class javax.crypto.CipherSpi
protected byte[] engineGetIV()
engineGetIV
in class javax.crypto.CipherSpi
protected int engineGetKeySize(java.security.Key key)
engineGetKeySize
in class javax.crypto.CipherSpi
key
- Unused.protected int engineGetOutputSize(int inputLength)
engineGetOutputSize
in class javax.crypto.CipherSpi
inputLength
- Unused.protected java.security.AlgorithmParameters engineGetParameters()
engineGetParameters
in class javax.crypto.CipherSpi
protected void engineInit(int operationMode, java.security.Key key, java.security.SecureRandom randomSource)
engineInit
in class javax.crypto.CipherSpi
operationMode
- Unused.key
- The Unused.randomSource
- Unused.protected void engineInit(int operationMode, java.security.Key key, java.security.AlgorithmParameters parameters, java.security.SecureRandom random)
engineInit
in class javax.crypto.CipherSpi
operationMode
- Unused.key
- Unused.parameters
- Unused.random
- Unused.protected void engineInit(int operationMode, java.security.Key key, java.security.spec.AlgorithmParameterSpec parameterSpecs, java.security.SecureRandom randomSource)
engineInit
in class javax.crypto.CipherSpi
operationMode
- Unused.key
- Unused.parameterSpecs
- Unused.randomSource
- Unused.protected void engineSetMode(java.lang.String mode)
engineSetMode
in class javax.crypto.CipherSpi
mode
- Unused.protected void engineSetPadding(java.lang.String padding)
engineSetPadding
in class javax.crypto.CipherSpi
padding
- The padding.protected byte[] engineUpdate(byte[] data, int offset, int length)
engineUpdate
in class javax.crypto.CipherSpi
data
- The byte array that holds the data.offset
- The offset in the byte array that indicates the first data byte to read.length
- The number of bytes to read starting from offset.protected int engineUpdate(byte[] input, int inputOffset, int inputLength, byte[] output, int outputOffset) throws javax.crypto.ShortBufferException
pkcs11
instead
of engine
.engineUpdate
in class javax.crypto.CipherSpi
input
- The byte array that holds the input data.inputOffset
- The offset in the input byte array that indicates the first input data byte to read.inputLength
- The number of bytes to read starting from offset.output
- The byte array that receives the output data.outputOffset
- The offset in the output byte array where to start writing the output.javax.crypto.ShortBufferException
- If the given output buffer does not have enough space left for the produced
output.protected java.security.Key engineUnwrap(byte[] wrappedKey, java.lang.String wrappedKeyAlgorithm, int wrappedKeyType)
engineUnwrap
in class javax.crypto.CipherSpi
wrappedKey
- The wrapped (encrypted) key to be unwrapped (decrypted).wrappedKeyAlgorithm
- Ignored in this implementation.wrappedKeyType
- Ignored in this implementation.protected byte[] engineWrap(java.security.Key key) throws java.security.InvalidKeyException, javax.crypto.IllegalBlockSizeException
pkcs11
instead of engine
.engineWrap
in class javax.crypto.CipherSpi
key
- The key to wrap (encrypt).java.security.InvalidKeyException
- If the given key is invalid.javax.crypto.IllegalBlockSizeException
- If wrapping fails due to block-size constraints of the cipher.IAIK JavaSecurity Website https://jce.iaik.tugraz.at/
IAIK at Graz University of Technology, Austria, Europe
Copyright 2001-2023 IAIK, Graz University of Technology, Inffeldgasse 16a, 8010 Graz, Austria. All Rights Reserved. Version 1.9.4