Class NoopEncryptionSpi
- java.lang.Object
-
- org.apache.ignite.spi.IgniteSpiAdapter
-
- org.apache.ignite.spi.encryption.noop.NoopEncryptionSpi
-
- All Implemented Interfaces:
EncryptionSpi
,IgniteSpi
@IgniteSpiNoop public class NoopEncryptionSpi extends IgniteSpiAdapter implements EncryptionSpi
No operationEncryptionSPI
implementation.- See Also:
EncryptionSpi
,KeystoreEncryptionSpi
-
-
Field Summary
-
Fields inherited from class org.apache.ignite.spi.IgniteSpiAdapter
ignite, igniteInstanceName, log
-
-
Constructor Summary
Constructors Constructor Description NoopEncryptionSpi()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
blockSize()
Serializable
create()
Creates new key for an encryption/decryption of cache persistent data: pages, WAL records.byte[]
decrypt(byte[] data, Serializable key)
Decrypts data encrypted withEncryptionSpi.encrypt(ByteBuffer, Serializable, ByteBuffer)
Serializable
decryptKey(byte[] key)
Decrypts key and checks it integrity.Serializable
decryptKey(byte[] key, String masterKeyName)
Decrypts key and checks its integrity using the master key specified by name.void
decryptNoPadding(ByteBuffer data, Serializable key, ByteBuffer res)
Decrypts data encrypted withEncryptionSpi.encryptNoPadding(ByteBuffer, Serializable, ByteBuffer)
void
encrypt(ByteBuffer data, Serializable key, ByteBuffer res)
Encrypts data.int
encryptedSize(int dataSize)
int
encryptedSizeNoPadding(int dataSize)
byte[]
encryptKey(Serializable key)
Encrypts key.byte[]
encryptKey(Serializable key, String masterKeyName)
Encrypts a key with the master key specified by name.void
encryptNoPadding(ByteBuffer data, Serializable key, ByteBuffer res)
Encrypts data without padding info.String
getMasterKeyName()
Gets the current master key name.byte[]
masterKeyDigest()
Returns master key digest.byte[]
masterKeyDigest(String masterKeyName)
Returns master key digest by name.void
setMasterKeyName(String masterKeyName)
Sets master key Name that will be used for keys encryption inEncryptionSpi.encryptKey(Serializable)
andEncryptionSpi.decryptKey(byte[])
methods and in theEncryptionSpi.masterKeyDigest()
method.void
spiStart(@Nullable String igniteInstanceName)
This method is called to start SPI.void
spiStop()
This method is called to stop SPI.-
Methods inherited from class org.apache.ignite.spi.IgniteSpiAdapter
addTimeoutObject, assertParameter, checkConfigurationConsistency0, clientFailureDetectionTimeout, configInfo, createSpiAttributeName, failureDetectionTimeout, failureDetectionTimeoutEnabled, failureDetectionTimeoutEnabled, getConsistentAttributeNames, getExceptionRegistry, getLocalNode, getName, getNodeAttributes, getSpiContext, ignite, initFailureDetectionTimeout, injectables, injectResources, isNodeStopping, onBeforeStart, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextDestroyed0, onContextInitialized, onContextInitialized0, registerMBean, removeTimeoutObject, setName, started, startInfo, startStopwatch, stopInfo, unregisterMBean
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.ignite.spi.IgniteSpi
getName, getNodeAttributes, onClientDisconnected, onClientReconnected, onContextDestroyed, onContextInitialized
-
-
-
-
Method Detail
-
masterKeyDigest
public byte[] masterKeyDigest()
Returns master key digest. Should always return same digest for a same key. Digest used for a configuration consistency check.- Specified by:
masterKeyDigest
in interfaceEncryptionSpi
- Returns:
- Master key digest.
-
masterKeyDigest
public byte[] masterKeyDigest(String masterKeyName)
Returns master key digest by name. Should always return same digest for a same key. Digest used for a configuration consistency check.- Specified by:
masterKeyDigest
in interfaceEncryptionSpi
- Parameters:
masterKeyName
- Master key name.- Returns:
- Master key digest.
-
create
public Serializable create() throws IgniteException
Creates new key for an encryption/decryption of cache persistent data: pages, WAL records.- Specified by:
create
in interfaceEncryptionSpi
- Returns:
- Newly created encryption key.
- Throws:
IgniteException
- If key creation failed.
-
encrypt
public void encrypt(ByteBuffer data, Serializable key, ByteBuffer res)
Encrypts data.- Specified by:
encrypt
in interfaceEncryptionSpi
- Parameters:
data
- Data to encrypt.key
- Encryption key.res
- Destination buffer.
-
encryptNoPadding
public void encryptNoPadding(ByteBuffer data, Serializable key, ByteBuffer res)
Encrypts data without padding info.- Specified by:
encryptNoPadding
in interfaceEncryptionSpi
- Parameters:
data
- Data to encrypt.key
- Encryption key.res
- Destination buffer.
-
decrypt
public byte[] decrypt(byte[] data, Serializable key)
Decrypts data encrypted withEncryptionSpi.encrypt(ByteBuffer, Serializable, ByteBuffer)
- Specified by:
decrypt
in interfaceEncryptionSpi
- Parameters:
data
- Data to decrypt.key
- Encryption key.- Returns:
- Encrypted data.
-
decryptNoPadding
public void decryptNoPadding(ByteBuffer data, Serializable key, ByteBuffer res)
Decrypts data encrypted withEncryptionSpi.encryptNoPadding(ByteBuffer, Serializable, ByteBuffer)
- Specified by:
decryptNoPadding
in interfaceEncryptionSpi
- Parameters:
data
- Data to decrypt.key
- Encryption key.res
- Destination of the decrypted data.
-
encryptKey
public byte[] encryptKey(Serializable key)
Encrypts key. Adds some info to check key integrity on decryption.- Specified by:
encryptKey
in interfaceEncryptionSpi
- Parameters:
key
- Key to encrypt.- Returns:
- Encrypted key.
-
encryptKey
public byte[] encryptKey(Serializable key, String masterKeyName)
Encrypts a key with the master key specified by name. Adds some info to check key integrity on decryption.- Specified by:
encryptKey
in interfaceEncryptionSpi
- Parameters:
key
- Key to encrypt.masterKeyName
- Master key name.- Returns:
- Encrypted key.
-
decryptKey
public Serializable decryptKey(byte[] key)
Decrypts key and checks it integrity.- Specified by:
decryptKey
in interfaceEncryptionSpi
- Parameters:
key
- Key to decrypt.- Returns:
- Encrypted key.
-
decryptKey
public Serializable decryptKey(byte[] key, String masterKeyName)
Decrypts key and checks its integrity using the master key specified by name.- Specified by:
decryptKey
in interfaceEncryptionSpi
- Parameters:
key
- Key to decrypt.masterKeyName
- Master key name.- Returns:
- Encrypted key.
-
encryptedSize
public int encryptedSize(int dataSize)
- Specified by:
encryptedSize
in interfaceEncryptionSpi
- Parameters:
dataSize
- Size of plain data in bytes.- Returns:
- Size of encrypted data in bytes for padding encryption mode.
-
encryptedSizeNoPadding
public int encryptedSizeNoPadding(int dataSize)
- Specified by:
encryptedSizeNoPadding
in interfaceEncryptionSpi
- Parameters:
dataSize
- Size of plain data in bytes.- Returns:
- Size of encrypted data in bytes for nopadding encryption mode.
-
blockSize
public int blockSize()
- Specified by:
blockSize
in interfaceEncryptionSpi
- Returns:
- Encrypted data block size.
-
getMasterKeyName
public String getMasterKeyName()
Gets the current master key name.- Specified by:
getMasterKeyName
in interfaceEncryptionSpi
- Returns:
- Master key name.
- See Also:
EncryptionSpi.setMasterKeyName(String)
-
setMasterKeyName
public void setMasterKeyName(String masterKeyName)
Sets master key Name that will be used for keys encryption inEncryptionSpi.encryptKey(Serializable)
andEncryptionSpi.decryptKey(byte[])
methods and in theEncryptionSpi.masterKeyDigest()
method.- Specified by:
setMasterKeyName
in interfaceEncryptionSpi
- Parameters:
masterKeyName
- Master key name.
-
spiStart
public void spiStart(@Nullable @Nullable String igniteInstanceName) throws IgniteSpiException
This method is called to start SPI. After this method returns successfully kernel assumes that SPI is fully operational.- Specified by:
spiStart
in interfaceIgniteSpi
- Parameters:
igniteInstanceName
- Name of Ignite instance this SPI is being started for (null
for default Ignite instance).- Throws:
IgniteSpiException
- Throws in case of any error during SPI start.
-
spiStop
public void spiStop() throws IgniteSpiException
This method is called to stop SPI. After this method returns kernel assumes that this SPI is finished and all resources acquired by it are released.Note that this method can be called at any point including during recovery of failed start. It should make no assumptions on what state SPI will be in when this method is called.
- Specified by:
spiStop
in interfaceIgniteSpi
- Throws:
IgniteSpiException
- Thrown in case of any error during SPI stop.
-
-