java.lang.Object
org.cryptomator.cryptofs.VaultConfig
Typesafe representation of vault configuration files.
To prevent config tampering, such as downgrade attacks, vault configurations are cryptographically signed using HMAC-256 with the vault's 64 byte master key.
If the signature could be successfully verified, the configuration can be assumed valid and the masterkey can be assumed eligible for the vault.
When loading a vault configuration, a key must be provided and the signature is checked.
It is impossible to create an instance of this class from an existing configuration without signature verification.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classstatic class -
Method Summary
Modifier and TypeMethodDescriptionCreate a new configuration object for a new vault.Decodes a vault configuration stored in JWT format to load itorg.cryptomator.cryptolib.api.CryptorProvider.SchemegetId()intintstatic VaultConfigload(String token, org.cryptomator.cryptolib.api.MasterkeyLoader keyLoader, int expectedVaultVersion) Convenience wrapper fordecode(String)andVaultConfig.UnverifiedVaultConfig.verify(byte[], int)
-
Method Details
-
getId
-
getVaultVersion
public int getVaultVersion() -
getCipherCombo
public org.cryptomator.cryptolib.api.CryptorProvider.Scheme getCipherCombo() -
getShorteningThreshold
public int getShorteningThreshold() -
toToken
-
load
public static VaultConfig load(String token, org.cryptomator.cryptolib.api.MasterkeyLoader keyLoader, int expectedVaultVersion) throws org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException, VaultConfigLoadException Convenience wrapper fordecode(String)andVaultConfig.UnverifiedVaultConfig.verify(byte[], int)- Parameters:
token- The tokenkeyLoader- A key loader capable of providing a key for this tokenexpectedVaultVersion- The vault version this token should contain- Returns:
- The decoded configuration
- Throws:
org.cryptomator.cryptolib.api.MasterkeyLoadingFailedException- If the key loader was unable to provide a key for this vault configurationVaultConfigLoadException- When loading the configuration fails
-
decode
public static VaultConfig.UnverifiedVaultConfig decode(String token) throws VaultConfigLoadException Decodes a vault configuration stored in JWT format to load it- Parameters:
token- The token- Returns:
- A loader object that allows loading the configuration (if providing the required key)
- Throws:
VaultConfigLoadException- When parsing the token failed
-
createNew
Create a new configuration object for a new vault.- Returns:
- A new configuration builder
-