org.apache.derby.impl.store.raw.data
Class EncryptOrDecryptData
- java.lang.Object
-
- org.apache.derby.impl.store.raw.data.EncryptOrDecryptData
-
- All Implemented Interfaces:
- java.security.PrivilegedAction<java.lang.Boolean>
public class EncryptOrDecryptData extends java.lang.Object implements java.security.PrivilegedAction<java.lang.Boolean>This class is used to encrypt all the containers in the data segment with a new encryption key when password/key is changed or when an existing database is reconfigured for encryption. Encryption of existing data in the data segments is done by doing the following: Find all the containers in data segment (seg0) and encrypt all of them with the new encryption key, the process for each container is: 1.Write a log record to indicate that the container is getting encrypted. 2.Read all the pages of the container through the page cache and encrypt each page with new encryption key and then write to a temporary file(n.dat) in the data segment itself. 3. Rename the current container file (c .dat) to another file (o .dat) 4. Rename the new encrypted version of the file (n .dat). 5. All the old version of the container (o .dat) files are removed after a successful checkpoint with a new key or on a rollback.
-
-
Constructor Summary
Constructors Constructor and Description EncryptOrDecryptData(BaseDataFileFactory dataFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voiddecryptAllContainers(RawTransaction t)Finds all the all the containers stored in the data directory and decrypts them.voidencryptAllContainers(RawTransaction t)Find all the all the containers stored in the data directory and encrypt them.voidremoveOldVersionOfContainers()Removes old versions of the containers after a cryptographic operation on the database.java.lang.Booleanrun()
-
-
-
Constructor Detail
-
EncryptOrDecryptData
public EncryptOrDecryptData(BaseDataFileFactory dataFactory)
-
-
Method Detail
-
decryptAllContainers
public void decryptAllContainers(RawTransaction t) throws StandardException
Finds all the all the containers stored in the data directory and decrypts them.- Parameters:
t- the transaction that is used for the decryption operation- Throws:
StandardException- Standard Derby error policy
-
encryptAllContainers
public void encryptAllContainers(RawTransaction t) throws StandardException
Find all the all the containers stored in the data directory and encrypt them.- Parameters:
t- the transaction that is used for the encryption operation- Throws:
StandardException- Standard Derby error policy
-
removeOldVersionOfContainers
public void removeOldVersionOfContainers() throws StandardExceptionRemoves old versions of the containers after a cryptographic operation on the database.- Throws:
StandardException
-
run
public java.lang.Boolean run()
- Specified by:
runin interfacejava.security.PrivilegedAction<java.lang.Boolean>
-
-
DataMelt 3.0 © DataMelt by jWork.ORG