You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Computes from a valid,encrypted node (file or folder) its cleartext name.
48
+
* <p>
49
+
* Due to the structure of a vault, an encrypted node is valid if:
50
+
* <ul>
51
+
* <li>the path points into the vault (duh!)</li>
52
+
* <li>the "file" extension is {@value Constants#CRYPTOMATOR_FILE_SUFFIX} or {@value Constants#DEFLATED_FILE_SUFFIX}</li>
53
+
* <li>the node name is at least {@value Constants#MIN_CIPHER_NAME_LENGTH} characters long</li>
54
+
* <li>it is located at depth 4 from the vault storage root, i.e. d/AB/CDEFG...XYZ/validFile.c9r</li>
55
+
* </ul>
56
+
*
57
+
* @param ciphertextNode path to the ciphertext file or directory
58
+
* @return the cleartext name of the ciphertext file or directory
59
+
* @throws java.nio.file.NoSuchFileException if the ciphertextFile does not exist
60
+
* @throws IOException if an I/O error occurs reading the ciphertext files
61
+
* @throws IllegalArgumentException if {@param ciphertextNode} is not a valid ciphertext content node of the vault
62
+
* @throws UnsupportedOperationException if the directory containing the {@param ciphertextNode} does not have a {@value Constants#DIR_ID_BACKUP_FILE_NAME} file
* Single purpose class to back up the directory id of an encrypted directory when it is created.
19
+
* Single purpose class to read or write the directory id backup of an encrypted directory.
17
20
*/
18
21
@CryptoFileSystemScoped
19
22
publicclassDirectoryIdBackup {
20
23
21
-
privateCryptorcryptor;
24
+
privatefinalCryptorcryptor;
22
25
23
26
@Inject
24
27
publicDirectoryIdBackup(Cryptorcryptor) {
25
28
this.cryptor = cryptor;
26
29
}
27
30
28
31
/**
29
-
* Performs the backup operation for the given {@link CiphertextDirectory} object.
32
+
* Writes the dirId backup file for the {@link CiphertextDirectory} object.
30
33
* <p>
31
-
* The directory id is written via an encrypting channel to the file {@link CiphertextDirectory#path()} /{@value Constants#DIR_BACKUP_FILE_NAME}.
34
+
* The directory id is written via an encrypting channel to the file {@link CiphertextDirectory#path()}.resolve({@value Constants#DIR_ID_BACKUP_FILE_NAME});
32
35
*
33
36
* @param ciphertextDirectory The cipher dir object containing the dir id and the encrypted content root
34
37
* @throws IOException if an IOException is raised during the write operation
0 commit comments