Skip to content

Feature/uvf draft #10

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

Draft
wants to merge 68 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
b07e43b
add v3 impl with UVF compatible file header and hardcoded key id
overheadhunter Feb 9, 2024
f35f9ac
Merge branch 'develop' into feature/uvf-draft
overheadhunter Nov 2, 2024
f47b27b
split Masterkey API into Perpetual + Revolving
overheadhunter Nov 29, 2024
f07ef0e
allow empty chunks, so UVF's EOF-chunks can be added
overheadhunter Nov 29, 2024
56dc34e
java 8 api sucks...
overheadhunter Nov 29, 2024
dd3ac84
fixed test after changing f07ef0e
overheadhunter Nov 29, 2024
485a7bb
fix javadoc
overheadhunter Dec 5, 2024
084e78a
added primitives for file name encryption
overheadhunter Dec 6, 2024
27958d5
add v3 impl with UVF compatible file header and hardcoded key id
overheadhunter Feb 9, 2024
df34f33
split Masterkey API into Perpetual + Revolving
overheadhunter Nov 29, 2024
e9ddfe1
allow empty chunks, so UVF's EOF-chunks can be added
overheadhunter Nov 29, 2024
57b8793
java 8 api sucks...
overheadhunter Nov 29, 2024
55db37f
fixed test after changing f07ef0e
overheadhunter Nov 29, 2024
d0705d3
fix javadoc
overheadhunter Dec 5, 2024
24dbce0
added primitives for file name encryption
overheadhunter Dec 6, 2024
5af935d
Apply nonce in v3 as in v2 - necessary?
chenkins Dec 30, 2024
01b7cdf
Bump the java-test-dependencies group across 1 directory with 3 updat…
dependabot[bot] Jan 10, 2025
c4308a4
Bump the java-production-dependencies group with 3 updates (#75)
dependabot[bot] Jan 10, 2025
3283578
Bump the maven-build-plugins group across 1 directory with 6 updates …
dependabot[bot] Jan 10, 2025
2445d1c
allow encrypting empty chunks
overheadhunter Jan 10, 2025
90fdf1c
build using JDK 23
overheadhunter Jan 10, 2025
edd4827
cleanup
overheadhunter Jan 10, 2025
3924abc
Merge branch 'develop' into feature/uvf-draft
overheadhunter Jan 10, 2025
940857f
allow empty chunks (third attempt)
overheadhunter Jan 11, 2025
4db62e9
fix UVF file header
overheadhunter Jan 17, 2025
e8aeec4
use same test vectors as in typescript impl
overheadhunter Jan 17, 2025
47a26a2
fix build with Java 8
overheadhunter Jan 18, 2025
828251a
accept ByteBuffers with non-zero position
overheadhunter Jan 24, 2025
1170de4
Merge branch 'develop' into feature/uvf-draft
overheadhunter Jan 24, 2025
dcea94d
Introduce new `DirectoryContentCryptor` API
overheadhunter Jan 24, 2025
20ad8e3
fix build on Java 8
overheadhunter Jan 24, 2025
f8c27f9
allow encrypting empty chunks
overheadhunter Jan 24, 2025
dcc1aa0
Merge branch 'develop' into feature/uvf-draft
overheadhunter Jan 24, 2025
1fa68f8
Merge remote-tracking branch 'upstream/feature/uvf-draft' into featur…
ylangisc Feb 6, 2025
f0c80f0
Fix parameter.
ylangisc Feb 6, 2025
50eadb6
Bump to 2.3.0.uvfdraft-SNAPSHOT.
chenkins Feb 8, 2025
68a6a14
Merge pull request #8 from chenkins/feature/uvf-draft
dkocher Feb 8, 2025
1549677
Pass chunkNonce further in v3.
chenkins Feb 25, 2025
6bfe40e
Never generate nonce again in v3.
chenkins Feb 25, 2025
dc674d5
Merge pull request #9 from chenkins/feature/uvf-draft
ylangisc Feb 25, 2025
f19c51e
Use same maven-compiler-plugin configuration as in Cyberduck.
chenkins Mar 4, 2025
d0e5905
Fix tests.
chenkins Mar 4, 2025
85aea94
Merge pull request #11 from chenkins/feature/uvf-draft
ylangisc Mar 4, 2025
51caf09
typo
overheadhunter Mar 5, 2025
8528f7f
UVF: use 64 bit keys for HMAC-SHA256
overheadhunter Mar 6, 2025
2acfc1e
remove generic types
overheadhunter Mar 7, 2025
a1d8c7a
cleanup
overheadhunter Mar 7, 2025
acce1cd
API: allow file encryption w/ specific revision
overheadhunter Mar 7, 2025
7d5c53a
API: add `Masterkey.rootDirId()`
overheadhunter Mar 7, 2025
0627f9c
add convenience method `dirPath(dirUvfMetadata)`
overheadhunter Mar 7, 2025
2fec038
add test to generate reference directory structure
overheadhunter Mar 7, 2025
6bddcd2
Merge pull request #12 from chenkins/feature/uvf-draft
ylangisc Mar 8, 2025
66e5b17
fix missing `flush` before returning ciphertext
overheadhunter Mar 12, 2025
be7421d
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 14, 2025
400d891
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 14, 2025
cb47778
implement `DirectoryContentCryptor` API for v1/v2
overheadhunter Mar 28, 2025
3393fff
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 28, 2025
5bde2a6
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 28, 2025
5c016a1
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 28, 2025
ae30e9e
Merge branch 'develop' into feature/uvf-draft
overheadhunter Mar 28, 2025
8ffc7f1
use base64url in `vault.uvf` file
overheadhunter Apr 3, 2025
7df351f
Merge branch 'develop' into feature/uvf-draft
overheadhunter Apr 3, 2025
faa062f
Merge branch 'develop' into feature/uvf-draft
overheadhunter Apr 3, 2025
5a63207
deploy SNAPSHOTs when commit message contains
overheadhunter Jun 5, 2025
ddb0cd9
fix workflow syntax
overheadhunter Jun 5, 2025
e6eaf1f
fix incorrectly merged fd8ac29
overheadhunter Jun 5, 2025
0f3cd0a
Merge pull request #13 from chenkins/feature/uvf-draft
ylangisc Jun 27, 2025
273c77d
Add coverage profile.
ylangisc Jun 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
fetch-depth: 0
- uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
distribution: 'temurin'
cache: 'maven'
- name: Cache SonarCloud packages
Expand All @@ -28,7 +28,7 @@ jobs:
- name: Build and Test
id: buildAndTest
run: >
mvn -B verify
mvn -B verify -Pcoverage
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # Needed to get PR information, if any
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
fetch-depth: 2
- uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
distribution: 'temurin'
cache: 'maven'
- name: Initialize CodeQL
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dependency-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
runner-os: 'ubuntu-latest'
java-distribution: 'temurin'
java-version: 22
java-version: 23
secrets:
nvd-api-key: ${{ secrets.NVD_API_KEY }}
slack-webhook-url: ${{ secrets.SLACK_WEBHOOK_URL }}
43 changes: 23 additions & 20 deletions .github/workflows/publish-central.yml
Original file line number Diff line number Diff line change
@@ -1,35 +1,38 @@
name: Publish to Maven Central
on:
workflow_dispatch:
inputs:
tag:
description: 'Tag'
required: true
default: '0.0.0'
push:
release:
types: [published]
jobs:
publish:
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[release snapshot]')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "refs/tags/${{ github.event.inputs.tag }}"
- uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
distribution: 'temurin'
cache: 'maven'
server-id: ossrh # Value of the distributionManagement/repository/id field of the pom.xml
server-username: MAVEN_USERNAME # env variable for username in deploy
server-password: MAVEN_PASSWORD # env variable for token in deploy
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Enforce project version ${{ github.event.inputs.tag }}
run: mvn versions:set -B -DnewVersion="$GIT_TAG"
env:
GIT_TAG: ${{ github.event.inputs.tag }}
server-id: central
server-username: MAVEN_CENTRAL_USERNAME
server-password: MAVEN_CENTRAL_PASSWORD
- name: Enforce project version ${{ github.event.release.tag_name }}
if: github.event_name == 'release'
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
- name: Verify this is a SNAPSHOT
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release snapshot]')
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
echo "::error file=pom.xml,title=Not a SNAPSHOT::Project version ($VERSION) does not end with -SNAPSHOT"
exit 1
fi
- name: Deploy
run: mvn deploy -B -DskipTests -Psign,deploy-central --no-transfer-progress
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_PASSWORD }}
MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
30 changes: 14 additions & 16 deletions .github/workflows/publish-github.yml
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
name: Publish to GitHub Packages
on:
push:
release:
types: [published]
jobs:
publish:
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/') || contains(github.event.head_commit.message, '[release snapshot]')
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/') # only allow publishing tagged versions
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
distribution: 'temurin'
cache: 'maven'
gpg-private-key: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }} # Value of the GPG private key to import
gpg-passphrase: MAVEN_GPG_PASSPHRASE # env variable for GPG private key passphrase
- name: Enforce project version ${{ github.event.release.tag_name }}
if: github.event_name == 'release'
run: mvn versions:set -B -DnewVersion=${{ github.event.release.tag_name }}
- name: Verify this is a SNAPSHOT
if: github.event_name == 'push' && contains(github.event.head_commit.message, '[release snapshot]')
run: |
VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)
if [[ "$VERSION" != *-SNAPSHOT ]]; then
echo "::error file=pom.xml,title=Not a SNAPSHOT::Project version ($VERSION) does not end with -SNAPSHOT"
exit 1
fi
- name: Deploy
run: mvn deploy -B -DskipTests -Psign,deploy-github --no-transfer-progress
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
MAVEN_GPG_PASSPHRASE: ${{ secrets.RELEASES_GPG_PASSPHRASE }}
- name: Slack Notification
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_USERNAME: 'Cryptobot'
SLACK_ICON:
SLACK_ICON_EMOJI: ':bot:'
SLACK_CHANNEL: 'cryptomator-desktop'
SLACK_TITLE: "Published ${{ github.event.repository.name }} ${{ github.event.release.tag_name }}"
SLACK_MESSAGE: "Ready to <https://github.com/${{ github.repository }}/actions/workflows/publish-central.yml|deploy to Maven Central>."
SLACK_FOOTER:
MSG_MINIMAL: true
MAVEN_GPG_KEY: ${{ secrets.RELEASES_GPG_PRIVATE_KEY }}
MAVEN_GPG_KEY_FINGERPRINT: ${{ vars.RELEASES_GPG_KEY_FINGERPRINT }}
2 changes: 1 addition & 1 deletion .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

81 changes: 37 additions & 44 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.iterate.cryptomator</groupId>
<artifactId>cryptolib</artifactId>
<version>2.3.0-SNAPSHOT</version>
<version>2.3.0.uvfdraft-SNAPSHOT</version>
<name>Cryptomator Crypto Library</name>
<description>This library contains all cryptographic functions that are used by Cryptomator.</description>
<url>https://github.com/cryptomator/cryptolib</url>
Expand All @@ -28,25 +28,26 @@

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.release>8</maven.compiler.release>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>

<!-- dependencies -->
<gson.version>2.11.0</gson.version>
<guava.version>33.2.1-jre</guava.version>
<siv-mode.version>1.5.2</siv-mode.version>
<bouncycastle.version>1.78.1</bouncycastle.version>
<slf4j.version>2.0.13</slf4j.version>
<gson.version>2.12.1</gson.version>
<guava.version>33.4.0-jre</guava.version>
<siv-mode.version>1.6.1</siv-mode.version>
<bouncycastle.version>1.80</bouncycastle.version>
<slf4j.version>2.0.17</slf4j.version>

<!-- test dependencies -->
<junit.jupiter.version>5.10.2</junit.jupiter.version>
<mockito.version>5.11.0</mockito.version>
<hamcrest.version>2.2</hamcrest.version>
<junit.jupiter.version>5.12.0</junit.jupiter.version>
<mockito.version>5.15.2</mockito.version>
<hamcrest.version>3.0</hamcrest.version>
<jmh.version>1.37</jmh.version>

<!-- build plugin dependencies -->
<dependency-check.version>10.0.2</dependency-check.version>
<jacoco.version>0.8.12</jacoco.version>
<nexus-staging.version>1.7.0</nexus-staging.version>
<dependency-check.version>12.1.0</dependency-check.version>
<jacoco.version>0.8.13</jacoco.version>
<central-publishing.version>0.7.0</central-publishing.version>
</properties>

<licenses>
Expand Down Expand Up @@ -170,7 +171,7 @@
<rules>
<requireJavaVersion>
<message>You need at least JDK 22 to build this project.</message>
<version>[21,)</version>
<version>[22,)</version>
</requireJavaVersion>
</rules>
</configuration>
Expand All @@ -179,10 +180,11 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.13.0</version>
<version>3.14.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
<release>${maven.compiler.target}</release>
<encoding>UTF-8</encoding>
<showWarnings>true</showWarnings>
</configuration>
Expand Down Expand Up @@ -257,7 +259,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.3.0</version>
<version>3.5.0</version>
<executions>
<execution>
<phase>package</phase>
Expand All @@ -281,12 +283,15 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.2.5</version>
<version>3.5.2</version>
<configuration>
<argLine>@{argLine} -Dnet.bytebuddy.experimental=true</argLine>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>3.4.1</version>
<version>3.4.2</version>
<configuration>
<archive>
<manifestEntries>
Expand All @@ -310,7 +315,7 @@
</plugin>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.11.2</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down Expand Up @@ -410,12 +415,12 @@
</profile>

<profile>
<id>release</id>
<id>sign</id>
<build>
<plugins>
<plugin>
<artifactId>maven-gpg-plugin</artifactId>
<version>3.2.4</version>
<version>3.2.7</version>
<executions>
<execution>
<id>sign-artifacts</id>
Expand All @@ -424,10 +429,7 @@
<goal>sign</goal>
</goals>
<configuration>
<gpgArguments>
<arg>--pinentry-mode</arg>
<arg>loopback</arg>
</gpgArguments>
<signer>bc</signer>
</configuration>
</execution>
</executions>
Expand All @@ -438,26 +440,17 @@

<profile>
<id>deploy-central</id>
<distributionManagement>
<repository>
<id>ossrh</id>
<name>Maven Central</name>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
<build>
<plugins>
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>attach-javadocs</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>${central-publishing.version}</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>
Expand Down
43 changes: 35 additions & 8 deletions src/main/java/org/cryptomator/cryptolib/api/Cryptor.java
Original file line number Diff line number Diff line change
@@ -1,23 +1,50 @@
/*******************************************************************************
* Copyright (c) 2016 Sebastian Stenzel and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the accompanying LICENSE.txt.
*
* Contributors:
* Sebastian Stenzel - initial API and implementation
*******************************************************************************/
package org.cryptomator.cryptolib.api;

import javax.security.auth.Destroyable;

public interface Cryptor extends Destroyable, AutoCloseable {

/**
* Encryption and decryption of file content.
* @return utility for encrypting and decrypting file content
*/
FileContentCryptor fileContentCryptor();

/**
* Encryption and decryption of file headers.
* @return utility for encrypting and decrypting file headers
*/
FileHeaderCryptor fileHeaderCryptor();

/**
* Encryption and decryption of file headers.
* @param revision The revision of the seed to {@link RevolvingMasterkey#subKey(int, int, byte[], String) derive subkeys}.
* @return utility for encrypting and decrypting file headers
* @apiNote Only relevant for Universal Vault Format, for Cryptomator Vault Format see {@link #fileHeaderCryptor()}
*/
FileHeaderCryptor fileHeaderCryptor(int revision);

/**
* Encryption and decryption of file names in Cryptomator Vault Format.
* @return utility for encrypting and decrypting file names
* @apiNote Only relevant for Cryptomator Vault Format, for Universal Vault Format see {@link #fileNameCryptor(int)}
*/
FileNameCryptor fileNameCryptor();

/**
* Encryption and decryption of file names in Universal Vault Format.
* @param revision The revision of the seed to {@link RevolvingMasterkey#subKey(int, int, byte[], String) derive subkeys}.
* @return utility for encrypting and decrypting file names
* @apiNote Only relevant for Universal Vault Format, for Cryptomator Vault Format see {@link #fileNameCryptor()}
*/
FileNameCryptor fileNameCryptor(int revision);

/**
* High-Level API for file name encryption and decryption
* @return utility for encryption and decryption of file names in the context of a directory
*/
DirectoryContentCryptor directoryContentCryptor();

@Override
void destroy();

Expand Down
Loading