public class GridEncryptionManager extends GridManagerAdapter<EncryptionSpi> implements MetastorageLifecycleListener, IgniteChangeGlobalStateSupport, IgniteEncryption
EncryptionSpi instances.
NOTE: Following protocol applied to statically configured caches.
For dynamically created caches key generated in request creation.
Group keys generation protocol:
Master key change process:
prepareMKChangeProc,
performMKChangeProc| Modifier and Type | Class and Description |
|---|---|
static class |
GridEncryptionManager.NodeEncryptionKeys |
GridComponent.DiscoveryDataExchangeType| Modifier and Type | Field and Description |
|---|---|
static String |
ENCRYPTION_KEY_PREFIX
Prefix for a encryption group key in meta store.
|
static String |
MASTER_KEY_NAME_PREFIX
Prefix for a master key name.
|
ctx, log| Constructor and Description |
|---|
GridEncryptionManager(GridKernalContext ctx) |
| Modifier and Type | Method and Description |
|---|---|
void |
applyKeys(MasterKeyChangeRecord rec)
Apply keys from WAL record during the recovery phase.
|
void |
beforeCacheGroupStart(int grpId,
@Nullable byte[] encKey)
Callback for cache group start event.
|
IgniteFuture<Void> |
changeMasterKey(String masterKeyName)
Starts master key change process.
|
void |
checkEncryptedCacheSupported()
Checks cache encryption supported by all nodes in cluster.
|
void |
collectGridNodeData(DiscoveryDataBag dataBag)
Collects discovery data on nodes already in grid on receiving
TcpDiscoveryNodeAddedMessage. |
void |
collectJoiningNodeData(DiscoveryDataBag dataBag)
Collects discovery data on joining node before sending
TcpDiscoveryJoinRequestMessage request. |
GridComponent.DiscoveryDataExchangeType |
discoveryDataType()
Gets unique component type to distinguish components providing discovery data.
|
IgniteInternalFuture<T2<Collection<byte[]>,byte[]>> |
generateKeys(int keyCnt) |
String |
getMasterKeyName()
Gets the current master key name.
|
@Nullable Serializable |
groupKey(int grpId)
Returns group encryption key.
|
void |
groupKey(int grpId,
byte[] encGrpKey)
Store group encryption key.
|
boolean |
isMasterKeyChangeInProgress() |
byte[] |
masterKeyDigest()
Digest of last changed master key or
null if master key was not changed. |
void |
onActivate(GridKernalContext kctx)
Called when cluster performing activation.
|
void |
onCacheGroupDestroyed(int grpId)
Callback for cache group destroy event.
|
void |
onDeActivate(GridKernalContext kctx)
Called when cluster performing deactivation.
|
void |
onDisconnected(IgniteFuture<?> reconnectFut)
Client disconnected callback.
|
void |
onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
Receives discovery data object from remote nodes (called
on new node during discovery process).
|
void |
onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
Method is called on nodes that are already in grid (not on joining node).
|
protected void |
onKernalStart0() |
protected void |
onKernalStop0(boolean cancel) |
void |
onLocalJoin()
Callback for local join.
|
void |
onReadyForRead(ReadOnlyMetastorage metastorage)
Is called when metastorage is made ready for read-only operations very early on node startup phase.
|
void |
onReadyForReadWrite(ReadWriteMetastorage metaStorage)
Fully functional metastore capable of performing reading and writing operations.
|
IgniteInternalFuture<?> |
onReconnected(boolean clusterRestarted)
Client reconnected callback.
|
void |
start()
Starts grid component.
|
void |
stop(boolean cancel)
Stops grid component.
|
@Nullable IgniteNodeValidationResult |
validateNode(ClusterNode node,
DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
Validates that new node can join grid topology, this method is called on coordinator
node before new node joins topology.
|
assertParameter, enabled, getSpi, getSpi, getSpis, inject, onAfterSpiStart, onBeforeSpiStart, onKernalStart, onKernalStop, printMemoryStats, startInfo, startSpi, stopInfo, stopSpi, toString, validateNodepublic static final String ENCRYPTION_KEY_PREFIX
public static final String MASTER_KEY_NAME_PREFIX
public GridEncryptionManager(GridKernalContext ctx)
ctx - Kernel context.public void start()
throws IgniteCheckedException
start in interface GridComponentIgniteCheckedException - Throws in case of any errors.public void stop(boolean cancel)
throws IgniteCheckedException
stop in interface GridComponentcancel - If true, then all ongoing tasks or jobs for relevant
components need to be cancelled.IgniteCheckedException - Thrown in case of any errors.protected void onKernalStart0()
throws IgniteCheckedException
onKernalStart0 in class GridManagerAdapter<EncryptionSpi>IgniteCheckedException - If failed.protected void onKernalStop0(boolean cancel)
onKernalStop0 in class GridManagerAdapter<EncryptionSpi>cancel - Cancel flag.public void onDisconnected(IgniteFuture<?> reconnectFut)
onDisconnected in interface GridComponentonDisconnected in class GridManagerAdapter<EncryptionSpi>reconnectFut - Reconnect future.public IgniteInternalFuture<?> onReconnected(boolean clusterRestarted)
onReconnected in interface GridComponentonReconnected in class GridManagerAdapter<EncryptionSpi>clusterRestarted - Cluster restarted flag.public void onLocalJoin()
@Nullable public @Nullable IgniteNodeValidationResult validateNode(ClusterNode node, DiscoveryDataBag.JoiningNodeDiscoveryData discoData)
validateNode in interface GridComponentvalidateNode in class GridManagerAdapter<EncryptionSpi>node - Joining node.discoData - Joining node discovery data.null in case of success.public void collectJoiningNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryJoinRequestMessage request.collectJoiningNodeData in interface GridComponentcollectJoiningNodeData in class GridManagerAdapter<EncryptionSpi>dataBag - container object to store discovery data in.public void onJoiningNodeDataReceived(DiscoveryDataBag.JoiningNodeDiscoveryData data)
onJoiningNodeDataReceived in interface GridComponentonJoiningNodeDataReceived in class GridManagerAdapter<EncryptionSpi>data - DiscoveryDataBag.JoiningNodeDiscoveryData interface to retrieve discovery data of joining node.public void collectGridNodeData(DiscoveryDataBag dataBag)
TcpDiscoveryNodeAddedMessage.collectGridNodeData in interface GridComponentcollectGridNodeData in class GridManagerAdapter<EncryptionSpi>dataBag - container object to store discovery data in.public void onGridDataReceived(DiscoveryDataBag.GridDiscoveryData data)
onGridDataReceived in interface GridComponentonGridDataReceived in class GridManagerAdapter<EncryptionSpi>data - DiscoveryDataBag.GridDiscoveryData interface to retrieve discovery data collected on remote nodes
(data common for all nodes in grid and specific for each node).@Nullable public @Nullable Serializable groupKey(int grpId)
grpId - Group id.public void groupKey(int grpId,
byte[] encGrpKey)
grpId - Group id.encGrpKey - Encrypted group key.public IgniteFuture<Void> changeMasterKey(String masterKeyName)
Each node will re-encrypt group keys stored on the disk.
NOTE: The new master key should be available to EncryptionSpi for each server node. Cache start
and node join during the key change process is prohibited and will be rejected.
If some node was unavailable during a master key change process it won't be able to join to cluster with the old
master key. The node should re-encrypt group keys during recovery on startup. The actual master key
name should be set via IgniteSystemProperties.IGNITE_MASTER_KEY_NAME_TO_CHANGE_BEFORE_STARTUP.
changeMasterKey in interface IgniteEncryptionpublic String getMasterKeyName()
getMasterKeyName in interface IgniteEncryptionpublic void beforeCacheGroupStart(int grpId,
@Nullable
@Nullable byte[] encKey)
grpId - Group id.encKey - Encryption keypublic void onCacheGroupDestroyed(int grpId)
grpId - Group id.public void onReadyForRead(ReadOnlyMetastorage metastorage)
onReadyForRead in interface MetastorageLifecycleListenermetastorage - Read-only meta storage.public void onReadyForReadWrite(ReadWriteMetastorage metaStorage) throws IgniteCheckedException
onReadyForReadWrite in interface MetastorageLifecycleListenermetaStorage - Fully functional meta storage.IgniteCheckedExceptionpublic void onActivate(GridKernalContext kctx) throws IgniteCheckedException
onActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.IgniteCheckedException - If failed.public void onDeActivate(GridKernalContext kctx)
onDeActivate in interface IgniteChangeGlobalStateSupportkctx - Kernal context.public IgniteInternalFuture<T2<Collection<byte[]>,byte[]>> generateKeys(int keyCnt)
keyCnt - Count of keys to generate.public void checkEncryptedCacheSupported()
throws IgniteCheckedException
IgniteCheckedException - If check fails.public GridComponent.DiscoveryDataExchangeType discoveryDataType()
GridComponent.collectJoiningNodeData(DiscoveryDataBag)
or GridComponent.collectGridNodeData(DiscoveryDataBag).discoveryDataType in interface GridComponentdiscoveryDataType in class GridManagerAdapter<EncryptionSpi>public void applyKeys(MasterKeyChangeRecord rec)
rec - Record.public boolean isMasterKeyChangeInProgress()
True if the master key change process in progress.public byte[] masterKeyDigest()
null if master key was not changed.
Used to verify the digest on a client node in case of cache start after master key change.
null if master key was not changed.
Follow @ApacheIgnite
Ignite Database and Caching Platform : ver. 2.9.0 Release Date : October 15 2020