|
4 | 4 |
|
5 | 5 | package ch.iterate.hub.crypto.uvf; |
6 | 6 |
|
| 7 | +import ch.cyberduck.core.AbstractPath; |
| 8 | +import ch.cyberduck.core.Path; |
| 9 | +import ch.cyberduck.core.cryptomator.UVFVault; |
7 | 10 | import ch.cyberduck.core.cryptomator.random.FastSecureRandomProvider; |
| 11 | +import ch.cyberduck.core.exception.BackgroundException; |
8 | 12 |
|
| 13 | +import org.cryptomator.cryptolib.api.UVFMasterkey; |
9 | 14 | import org.cryptomator.cryptolib.common.ECKeyPair; |
10 | 15 | import org.cryptomator.cryptolib.common.P384KeyPair; |
11 | 16 | import org.junit.jupiter.api.Test; |
|
15 | 20 | import java.security.spec.InvalidKeySpecException; |
16 | 21 | import java.text.ParseException; |
17 | 22 | import java.util.Base64; |
| 23 | +import java.util.EnumSet; |
18 | 24 | import java.util.HashMap; |
19 | 25 | import java.util.UUID; |
20 | 26 |
|
@@ -177,4 +183,18 @@ public void computeRootDirIdHash() throws ParseException, JOSEException, JsonPro |
177 | 183 | final String hash = meta.computeRootDirIdHash(rootDirId); |
178 | 184 | assertEquals("6DYU3E5BTPAZ4DWEQPQK3AIHX2DXSPHG", hash); |
179 | 185 | } |
| 186 | + |
| 187 | + @Test |
| 188 | + public void testUVFMasterkeyFromUvfMetadataPayload() throws JsonProcessingException { |
| 189 | + final UvfMetadataPayload uvmetadataPayload = UvfMetadataPayload.create(); |
| 190 | + UVFMasterkey.fromDecryptedPayload(uvmetadataPayload.toJSON()); |
| 191 | + } |
| 192 | + |
| 193 | + @Test |
| 194 | + public void testUvfVaultLoadFromMetadataPayload() throws JsonProcessingException, BackgroundException { |
| 195 | + final UvfMetadataPayload uvfMetadataPayload = UvfMetadataPayload.create(); |
| 196 | + final String decryptedPayload = uvfMetadataPayload.toJSON(); |
| 197 | + final UVFVault uvfVault = new UVFVault(new Path("/", EnumSet.of(AbstractPath.Type.directory)), decryptedPayload, null, null); |
| 198 | + uvfVault.load(null, null); |
| 199 | + } |
180 | 200 | } |
0 commit comments