Skip to content

Add implementation of unified vault format (UVF). #16623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 39 commits into from
Closed

Conversation

chenkins
Copy link
Contributor

@chenkins chenkins commented Dec 6, 2024

@chenkins chenkins force-pushed the feature/uvf branch 2 times, most recently from 4730d93 to 13bfc8d Compare December 6, 2024 15:54
@chenkins chenkins requested a review from ylangisc December 6, 2024 17:00
@dkocher dkocher linked an issue Dec 9, 2024 that may be closed by this pull request
@chenkins chenkins changed the title First ideas for uvf imple. Add implementation of unified vault format Feb 27, 2025
@chenkins chenkins changed the title Add implementation of unified vault format Add implementation of unified vault format (UVF) Feb 27, 2025
@chenkins chenkins changed the title Add implementation of unified vault format (UVF) Add implementation of unified vault format (UVF). Feb 27, 2025
Comment on lines +83 to +89
if(new SimplePathPredicate(home).test(directory)) {
// TODO hard-coded to initial seed in UVFVault
directoryIdHash = filenameCryptor.hashDirectoryId(id);
}
else {
directoryIdHash = vault.getCryptor().fileNameCryptor(loadRevision(session, directory)).hashDirectoryId(id);
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ylangisc what's the best approach - should we cache the revisions per directory along with its ID?

Comment on lines 156 to 158
// TODO still fails as test data from org.cryptomator.cryptolib.v3.UVFIntegrationTest uses latestSeed when creating dir.uvf, hard-coded in current implementation for subdir in DirectoryMetadata subDirMetadata = dirContentCryptor.newDirectoryMetadata();)
final AttributedList<Path> list = storage.getFeature(ListService.class).list(new Path("/cyberduckbucket/subdir", EnumSet.of(AbstractPath.Type.directory, AbstractPath.Type.placeholder, AbstractPath.Type.decrypted)).withAttributes(subdir), new DisabledListProgressListener());
assertEquals(1, list.size());
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ylangisc with the loadRevision workaround, the encryption part of the subdir works and the raw folder is listed remotely, but then fails in AbstractVault.decrypt when attemptyting to decrypt the file name, probably due to the file name decryptor statically linked to the initial revision. Need to continue there.

final Path metadataFile = new Path(metadataParent, vault.getDirectoryMetadataFilename(), EnumSet.of(Path.Type.file, Path.Type.encrypted));
final byte[] ciphertext = new ContentReader(session).readBytes(metadataFile);
// https://github.com/encryption-alliance/unified-vault-format/blob/develop/file%20name%20encryption/AES-SIV-512-B64URL.md#format-of-diruvf-and-symlinkuvf
// TODO can we not use org.cryptomator.cryptolib.v3.DirectoryContentCryptorImpl.decryptDirectoryMetadata()? DirectoryMetadataImpl is not visible and DirectoryMetadata is empty interface, so we cannot access dirId attribute.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@overheadhunter how can we use cryptolib API to read UVf metadata file?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use DirectoryMetadataImpl#cast.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean the dir.uvf file? I considered it an implementation detail that should not be public.

@dkocher dkocher added this to the 9.2 milestone Jun 5, 2025
@dkocher dkocher modified the milestones: 9.1.6, 9.2 Jun 5, 2025

@Override
public Path create(final Session<?> session, final String region, final VaultCredentials credentials) throws BackgroundException {
throw new UnsupportedOperationException();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing implementation.

@chenkins
Copy link
Contributor Author

Superseded by #17173

@chenkins chenkins closed this Jun 19, 2025
@ylangisc ylangisc deleted the feature/uvf branch July 22, 2025 07:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add implementation of unified vault format
4 participants