@Test void testEncryptionDoesNotLeakSameSegments() { String testPath = "path/to/path/file/to"; Uri testURI = new Uri(testPath); AuthPathEncryptionSecretKey pathEncryptionSecretKey = pathEncryptionSecretKey(); Uri encrypted = symmetricPathEncryptionService.encrypt(pathEncryptionSecretKey, testURI); String[] encryptedSegments = encrypted.asString().split("/"); assertThat(encryptedSegments[1]).isNotEqualTo(encryptedSegments[3]); assertThat(encryptedSegments[2]).isNotEqualTo(encryptedSegments[5]); }
@Override @SneakyThrows public Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath) { validateArgs(pathEncryptionSecretKey, bucketPath); validateUriIsRelative(bucketPath); Uri uri = processURIparts( pathEncryptionSecretKey, bucketPath, encryptAndEncode ); return AES_SIV.asUriRoot().resolve(uri); }
IntegrityPreservingUriEncryption implements SymmetricPathEncryptionService { @Override @SneakyThrows public Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath) { validateArgs(pathEncryptionSecretKey, bucketPath); validateUriIsRelative(bucketPath); Uri uri = processURIparts( pathEncryptionSecretKey, bucketPath, encryptAndEncode ); return AES_SIV.asUriRoot().resolve(uri); } }
IntegrityPreservingUriEncryption implements SymmetricPathEncryptionService { @Override @SneakyThrows public Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath) { validateArgs(pathEncryptionSecretKey, bucketPath); validateUriIsRelative(bucketPath); Uri uri = processURIparts( pathEncryptionSecretKey, bucketPath, encryptAndEncode ); return AES_SIV.asUriRoot().resolve(uri); } @Inject  IntegrityPreservingUriEncryption(PathEncryptorDecryptor pathEncryptorDecryptor); }
IntegrityPreservingUriEncryption implements SymmetricPathEncryptionService { @Override @SneakyThrows public Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath) { validateArgs(pathEncryptionSecretKey, bucketPath); validateUriIsRelative(bucketPath); Uri uri = processURIparts( pathEncryptionSecretKey, bucketPath, encryptAndEncode ); return AES_SIV.asUriRoot().resolve(uri); } @Inject  IntegrityPreservingUriEncryption(PathEncryptorDecryptor pathEncryptorDecryptor); @Override @SneakyThrows Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath); @Override @SneakyThrows Uri decrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath); }
IntegrityPreservingUriEncryption implements SymmetricPathEncryptionService { @Override @SneakyThrows public Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath) { validateArgs(pathEncryptionSecretKey, bucketPath); validateUriIsRelative(bucketPath); Uri uri = processURIparts( pathEncryptionSecretKey, bucketPath, encryptAndEncode ); return AES_SIV.asUriRoot().resolve(uri); } @Inject  IntegrityPreservingUriEncryption(PathEncryptorDecryptor pathEncryptorDecryptor); @Override @SneakyThrows Uri encrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath); @Override @SneakyThrows Uri decrypt(AuthPathEncryptionSecretKey pathEncryptionSecretKey, Uri bucketPath);  }