2121public class FileSystemCapabilityChecker {
2222
2323 private static final Logger LOG = LoggerFactory .getLogger (FileSystemCapabilityChecker .class );
24- private static final int MAX_CIPHERTEXT_NAME_LENGTH = 220 ; // inclusive. calculations done in https://github.com/cryptomator/cryptofs/issues/60#issuecomment-523238303
25- private static final int MIN_CIPHERTEXT_NAME_LENGTH = 28 ; // base64(iv).c9r
26- private static final int MAX_ADDITIONAL_PATH_LENGTH = 48 ; // beginning at d/... see https://github.com/cryptomator/cryptofs/issues/77
2724
2825 public enum Capability {
2926 /**
@@ -95,7 +92,7 @@ public void assertWriteAccess(Path pathToVault) throws MissingCapabilityExceptio
9592
9693 public int determineSupportedCleartextFileNameLength (Path pathToVault ) throws IOException {
9794 int maxCiphertextLen = determineSupportedCiphertextFileNameLength (pathToVault );
98- assert maxCiphertextLen >= MIN_CIPHERTEXT_NAME_LENGTH ;
95+ assert maxCiphertextLen >= Constants . MIN_CIPHER_NAME_LENGTH ;
9996 // math explained in https://github.com/cryptomator/cryptofs/issues/60#issuecomment-523238303;
10097 // subtract 4 for file extension, base64-decode, subtract 16 for IV
10198 return (maxCiphertextLen - 4 ) / 4 * 3 - 16 ;
@@ -109,8 +106,8 @@ public int determineSupportedCleartextFileNameLength(Path pathToVault) throws IO
109106 * @throws IOException If unable to perform this check
110107 */
111108 public int determineSupportedCiphertextFileNameLength (Path pathToVault ) throws IOException {
112- int subPathLength = MAX_ADDITIONAL_PATH_LENGTH - 2 ; // subtract "c/"
113- return determineSupportedCiphertextFileNameLength (pathToVault .resolve ("c" ), subPathLength , MIN_CIPHERTEXT_NAME_LENGTH , MAX_CIPHERTEXT_NAME_LENGTH );
109+ int subPathLength = Constants . MAX_ADDITIONAL_PATH_LENGTH - 2 ; // subtract "c/"
110+ return determineSupportedCiphertextFileNameLength (pathToVault .resolve ("c" ), subPathLength , Constants . MIN_CIPHER_NAME_LENGTH , Constants . MAX_CIPHER_NAME_LENGTH );
114111 }
115112
116113 /**
0 commit comments