|
32 | 32 | import cloud.katta.protocols.hub.HubSession; |
33 | 33 | import com.fasterxml.jackson.core.JsonProcessingException; |
34 | 34 | import com.nimbusds.jose.JOSEException; |
| 35 | +import com.nimbusds.jose.JWEObjectJSON; |
35 | 36 | import com.nimbusds.jose.jwk.Curve; |
36 | 37 | import com.nimbusds.jose.jwk.ECKey; |
37 | 38 | import com.nimbusds.jose.jwk.JWKSet; |
@@ -103,17 +104,20 @@ void encryptDecrypt() throws JOSEException, JsonProcessingException, ParseExcept |
103 | 104 | final OctetSequenceKey memberKey = jwks.memberKey(); |
104 | 105 | final ECKey recoveryKey = jwks.recoveryKey(); |
105 | 106 |
|
106 | | - final String encrypted = orig.encrypt("https://example.com/api/", UUID.randomUUID(), jwks.toJWKSet()); |
| 107 | + final UUID vaultId = UUID.randomUUID(); |
| 108 | + final String encrypted = orig.encrypt("https://example.com/api/", vaultId, jwks.toJWKSet()); |
107 | 109 |
|
108 | 110 | // decrypt with memberKey |
109 | 111 | { |
110 | 112 | final UvfMetadataPayload decrypted = UvfMetadataPayload.decryptWithJWK(encrypted, memberKey); |
| 113 | + assertEquals(String.format("https://example.com/api/vaults/%s/uvf/vault.uvf", vaultId), JWEObjectJSON.parse(encrypted).getHeader().getCustomParams().get("origin")); |
111 | 114 | assertEquals(orig, decrypted); |
112 | 115 | } |
113 | 116 |
|
114 | 117 | // decrypt with recoveryKey |
115 | 118 | { |
116 | 119 | final UvfMetadataPayload decrypted = UvfMetadataPayload.decryptWithJWK(encrypted, recoveryKey); |
| 120 | + assertEquals(String.format("https://example.com/api/vaults/%s/uvf/vault.uvf", vaultId), JWEObjectJSON.parse(encrypted).getHeader().getCustomParams().get("origin")); |
117 | 121 | assertEquals(orig, decrypted); |
118 | 122 | } |
119 | 123 |
|
|
0 commit comments