Skip to content

Commit d138f31

Browse files
authored
Merge pull request #131 from IABTechLab/wzh-uid2-3571-s3-keys-fetch
let core be able to load all the s3 encryption keys and keep a mapping
2 parents 684e843 + 69187bf commit d138f31

File tree

9 files changed

+101
-7
lines changed

9 files changed

+101
-7
lines changed

conf/default-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,6 @@
1616
"partners_metadata_path": null,
1717
"att_token_enc_key": null,
1818
"att_token_enc_salt": null,
19-
"enforceJwt": false
19+
"enforceJwt": false,
20+
"s3_keys_metadata_path": null
2021
}

conf/integ-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,6 @@
1717
"keysets_metadata_path": "uid2/keysets/metadata.json",
1818
"keyset_keys_metadata_path": "uid2/keyset_keys/metadata.json",
1919
"salts_metadata_path": "uid2/salts/metadata.json",
20-
"enforceJwt": false
20+
"enforceJwt": false,
21+
"s3_keys_metadata_path": "uid2/s3encryption_keys/metadata.json"
2122
}

conf/local-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,6 @@
1818
"att_token_enc_key": "<key-for-attestation-token>",
1919
"att_token_enc_salt": "<salt-for-attestation-token>",
2020
"provide_private_site_data": true,
21-
"enforceJwt": false
21+
"enforceJwt": false,
22+
"s3_keys_metadata_path": "/com.uid2.core/test/s3encryption_keys/metadata.json"
2223
}

conf/local-e2e-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,6 @@
3232
"aws_kms_jwt_signing_key_id": "ff275b92-0def-4dfc-b0f6-87c96b26c6c7",
3333
"aws_kms_jwt_signing_public_keys": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmvwB41qI5Fe41PDbXqcX5uOvSvfKh8l9QV0O3M+NsB4lKqQEP0t1hfoiXTpOgKz1ArYxHsQ2LeXifX4uwEbYJFlpVM+tyQkTWQjBOw6fsLYK2Xk4X2ylNXUUf7x3SDiOVxyvTh3OZW9kqrDBN9JxSoraNLyfw0hhW0SHpfs699SehgbQ7QWep/gVlKRLIz0XAXaZNw24s79ORcQlrCE6YD0PgQmpI/dK5xMML82n6y3qcTlywlGaU7OGIMdD+CTXA3BcOkgXeqZTXNaX1u6jCTa1lvAczun6avp5VZ4TFiuPo+y4rJ3GU+14cyT5NckEcaTKSvd86UdwK5Id9tl3bQIDAQAB",
3434
"core_public_url": "http://localhost:8088",
35-
"optout_url": "http://localhost:8081"
35+
"optout_url": "http://localhost:8081",
36+
"s3_keys_metadata_path": "s3encryption_keys/metadata.json"
3637
}

conf/local-e2e-docker-config.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@
3131
"aws_kms_jwt_signing_key_id": "ff275b92-0def-4dfc-b0f6-87c96b26c6c7",
3232
"aws_kms_jwt_signing_public_keys": "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmvwB41qI5Fe41PDbXqcX5uOvSvfKh8l9QV0O3M+NsB4lKqQEP0t1hfoiXTpOgKz1ArYxHsQ2LeXifX4uwEbYJFlpVM+tyQkTWQjBOw6fsLYK2Xk4X2ylNXUUf7x3SDiOVxyvTh3OZW9kqrDBN9JxSoraNLyfw0hhW0SHpfs699SehgbQ7QWep/gVlKRLIz0XAXaZNw24s79ORcQlrCE6YD0PgQmpI/dK5xMML82n6y3qcTlywlGaU7OGIMdD+CTXA3BcOkgXeqZTXNaX1u6jCTa1lvAczun6avp5VZ4TFiuPo+y4rJ3GU+14cyT5NckEcaTKSvd86UdwK5Id9tl3bQIDAQAB",
3333
"core_public_url": "http://core:8088",
34-
"optout_url": "http://optout:8081"
34+
"optout_url": "http://optout:8081",
35+
"s3_keys_metadata_path": "s3encryption_keys/metadata.json"
3536
}

pom.xml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
<groupId>com.uid2</groupId>
88
<artifactId>uid2-core</artifactId>
9-
<version>2.15.78</version>
9+
<version>2.15.79-alpha-30-SNAPSHOT</version>
1010

1111
<properties>
1212
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@@ -24,7 +24,7 @@
2424
<vertx.verticle>com.uid2.core.vertx.CoreVerticle</vertx.verticle>
2525
<launcher.class>io.vertx.core.Launcher</launcher.class>
2626

27-
<uid2-shared.version>7.10.6</uid2-shared.version>
27+
<uid2-shared.version>7.16.0</uid2-shared.version>
2828
<image.version>${project.version}</image.version>
2929
</properties>
3030

src/main/java/com/uid2/core/Main.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
import com.uid2.shared.attest.JwtService;
1515
import com.uid2.shared.auth.EnclaveIdentifierProvider;
1616
import com.uid2.shared.auth.RotatingOperatorKeyProvider;
17+
import com.uid2.shared.store.reader.RotatingS3KeyProvider;
18+
import com.uid2.shared.model.S3Key;
1719
import com.uid2.shared.cloud.CloudUtils;
1820
import com.uid2.shared.cloud.EmbeddedResourceStorage;
1921
import com.uid2.shared.cloud.ICloudStorage;
@@ -104,6 +106,7 @@ public static void main(String[] args) {
104106

105107
RotatingStoreVerticle enclaveRotatingVerticle = null;
106108
RotatingStoreVerticle operatorRotatingVerticle = null;
109+
RotatingStoreVerticle s3KeyRotatingVerticle = null;
107110
CoreVerticle coreVerticle = null;
108111
try {
109112
CloudPath operatorMetadataPath = new CloudPath(config.getString(Const.Config.OperatorsMetadataPathProp));
@@ -115,6 +118,11 @@ public static void main(String[] args) {
115118
EnclaveIdentifierProvider enclaveIdProvider = new EnclaveIdentifierProvider(cloudStorage, enclaveMetadataPath);
116119
enclaveRotatingVerticle = new RotatingStoreVerticle("enclaves", 60000, enclaveIdProvider);
117120

121+
CloudPath s3KeyMetadataPath = new CloudPath(config.getString(Const.Config.S3keysMetadataPathProp));
122+
GlobalScope s3KeyScope = new GlobalScope(s3KeyMetadataPath);
123+
RotatingS3KeyProvider s3KeyProvider = new RotatingS3KeyProvider(cloudStorage, s3KeyScope);
124+
s3KeyRotatingVerticle = new RotatingStoreVerticle("s3encryption_keys", 60000, s3KeyProvider);
125+
118126
String corePublicUrl = ConfigStore.Global.get(Const.Config.CorePublicUrlProp);
119127
AttestationService attestationService = new AttestationService()
120128
.with("trusted", new TrustedCoreAttestationService())
@@ -157,6 +165,7 @@ public static void main(String[] args) {
157165

158166
vertx.deployVerticle(enclaveRotatingVerticle);
159167
vertx.deployVerticle(operatorRotatingVerticle);
168+
vertx.deployVerticle(s3KeyRotatingVerticle);
160169
vertx.deployVerticle(coreVerticle);
161170
});
162171
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"version": 1,
3+
"generated": 1620253519,
4+
"s3encryption_keys": {
5+
"location": "/com.uid2.core/test/s3encryption_keys/s3encryption_keys.json"
6+
}
7+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
[ {
2+
"id" : 1,
3+
"siteId" : 999,
4+
"activates" : 1720641670,
5+
"created" : 1720641670,
6+
"secret" : "mydrCudb2PZOm01Qn0SpthltmexHUAA11Hy1m+uxjVw="
7+
}, {
8+
"id" : 2,
9+
"siteId" : 999,
10+
"activates" : 1720728070,
11+
"created" : 1720641670,
12+
"secret" : "FtdslrFSsvVXOuhOWGwEI+0QTkCvM8SGZAP3k2u3PgY="
13+
}, {
14+
"id" : 3,
15+
"siteId" : 999,
16+
"activates" : 1720814470,
17+
"created" : 1720641670,
18+
"secret" : "/7zO6QbKrhZKIV36G+cU9UR4hZUVg5bD+KjbczICjHw="
19+
}, {
20+
"id" : 4,
21+
"siteId" : 123,
22+
"activates" : 1720641671,
23+
"created" : 1720641671,
24+
"secret" : "XjiqRlWQQJGLr7xfV1qbueKwyzt881GVohuUkQt/ht4="
25+
}, {
26+
"id" : 5,
27+
"siteId" : 123,
28+
"activates" : 1720728071,
29+
"created" : 1720641671,
30+
"secret" : "QmpIf5NzO+UROjl5XjB/BmF6paefM8n6ub9B2plC9aI="
31+
}, {
32+
"id" : 6,
33+
"siteId" : 123,
34+
"activates" : 1720814471,
35+
"created" : 1720641671,
36+
"secret" : "40w9UMSYxGm+KldOWOXhBGI8QgjvUUQjivtkP4VpKV8="
37+
}, {
38+
"id" : 7,
39+
"siteId" : 124,
40+
"activates" : 1720641671,
41+
"created" : 1720641671,
42+
"secret" : "QdwD0kQV1BwmLRD0PH1YpqgaOrgpVTfu08o98mSZ6uE="
43+
}, {
44+
"id" : 8,
45+
"siteId" : 124,
46+
"activates" : 1720728071,
47+
"created" : 1720641671,
48+
"secret" : "yCVCM/HLf9/6k+aUNrx7w17VbyfSzI8JykLQLSR+CW0="
49+
}, {
50+
"id" : 9,
51+
"siteId" : 124,
52+
"activates" : 1720814471,
53+
"created" : 1720641671,
54+
"secret" : "JqHl8BrTyx9XpR2lYj/5xvUpzgnibGeomETTwF4rn1U="
55+
}, {
56+
"id" : 10,
57+
"siteId" : 127,
58+
"activates" : 1720641671,
59+
"created" : 1720641671,
60+
"secret" : "JqiG1b34AvrdO3Aj6cCcjOBJMijrDzTmrR+p9ZtP2es="
61+
}, {
62+
"id" : 11,
63+
"siteId" : 127,
64+
"activates" : 1720728072,
65+
"created" : 1720641672,
66+
"secret" : "lp1CyHdfc7K0aO5JGpA+Ve5Z/V5LImtGEQwCg/YB0kY="
67+
}, {
68+
"id" : 12,
69+
"siteId" : 127,
70+
"activates" : 1720814472,
71+
"created" : 1720641672,
72+
"secret" : "G99rFYJF+dnSlk/xG6fuC3WNqQxTLJbDIdVyPMbGQ6s="
73+
} ]

0 commit comments

Comments
 (0)