diff --git a/.github/workflows/check-stable-dependency.yaml b/.github/workflows/check-stable-dependency.yaml
index 3974a6eb..41eab5de 100644
--- a/.github/workflows/check-stable-dependency.yaml
+++ b/.github/workflows/check-stable-dependency.yaml
@@ -3,7 +3,7 @@ on: [pull_request, workflow_dispatch]
jobs:
check_dependency:
- uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-check-stable-dependency.yaml@v2
+ uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-check-stable-dependency.yaml@v3
secrets: inherit
diff --git a/.github/workflows/validate-image.yaml b/.github/workflows/validate-image.yaml
index 3c2ae55c..bb9e5f51 100644
--- a/.github/workflows/validate-image.yaml
+++ b/.github/workflows/validate-image.yaml
@@ -20,7 +20,7 @@ on:
jobs:
build-publish-docker:
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-validate-image.yaml@v3
- with:
+ with:
failure_severity: ${{ inputs.failure_severity || 'CRITICAL,HIGH' }}
fail_on_error: ${{ inputs.fail_on_error || true }}
java_version: 21
diff --git a/conf/local-config.json b/conf/local-config.json
index c3864830..e3e2bacb 100644
--- a/conf/local-config.json
+++ b/conf/local-config.json
@@ -18,7 +18,7 @@
"keysets_metadata_path": "keysets/metadata.json",
"admin_keysets_metadata_path": "admin_keysets/metadata.json",
"keyset_keys_metadata_path": "keyset_keys/metadata.json",
- "s3_keys_metadata_path": "s3encryption_keys/metadata.json",
+ "cloud_encryption_keys_metadata_path": "cloud_encryption_keys/metadata.json",
"aws_access_key_id": "no access key needed for test",
"aws_secret_access_key": "no secret key needed for test",
"client_side_keypair_public_prefix": "UID2-X-L-",
@@ -44,6 +44,6 @@
"role_okta_group_map_maintainer": "developer",
"role_okta_group_map_privileged": "developer",
"role_okta_group_map_super_user": "developer",
- "s3_key_activates_in_seconds": 86400,
- "s3_key_count_per_site": 2
+ "cloud_encryption_key_activates_in_seconds": 86400,
+ "cloud_encryption_key_count_per_site": 2
}
diff --git a/conf/local-e2e-docker-config.json b/conf/local-e2e-docker-config.json
index 685c8887..50fea242 100644
--- a/conf/local-e2e-docker-config.json
+++ b/conf/local-e2e-docker-config.json
@@ -18,7 +18,7 @@
"keysets_metadata_path": "keysets/metadata.json",
"admin_keysets_metadata_path": "admin_keysets/metadata.json",
"keyset_keys_metadata_path": "keyset_keys/metadata.json",
- "s3_keys_metadata_path": "s3encryption_keys/metadata.json",
+ "cloud_keys_metadata_path": "cloud_encryption_keys/metadata.json",
"aws_access_key_id": "no access key needed for test",
"aws_secret_access_key": "no secret key needed for test",
"client_side_keypair_public_prefix": "UID2-X-L-",
@@ -44,6 +44,6 @@
"role_okta_group_map_maintainer": "developer",
"role_okta_group_map_privileged": "developer",
"role_okta_group_map_super_user": "developer",
- "s3_key_activates_in_seconds": 86400,
- "s3_key_count_per_site": 2
+ "cloud_encryption_key_activates_in_seconds": 86400,
+ "cloud_encryption_key_count_per_site": 2
}
diff --git a/pom.xml b/pom.xml
index e3440c57..834a319c 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
com.uid2
uid2-admin
- 5.15.24
+ 5.15.25-alpha-94-SNAPSHOT
UTF-8
@@ -16,7 +16,7 @@
1.12.2
5.11.2
- 7.21.7
+ 8.0.0
0.5.10
${project.version}
diff --git a/src/main/java/com/uid2/admin/Main.java b/src/main/java/com/uid2/admin/Main.java
index 1f5472f0..38fd2639 100644
--- a/src/main/java/com/uid2/admin/Main.java
+++ b/src/main/java/com/uid2/admin/Main.java
@@ -13,7 +13,7 @@
import com.uid2.admin.legacy.RotatingLegacyClientKeyProvider;
import com.uid2.admin.managers.KeysetManager;
import com.uid2.admin.monitoring.DataStoreMetrics;
-import com.uid2.admin.managers.S3KeyManager;
+import com.uid2.admin.managers.CloudEncryptionKeyManager;
import com.uid2.admin.secret.*;
import com.uid2.admin.store.*;
import com.uid2.admin.store.reader.RotatingAdminKeysetStore;
@@ -197,18 +197,18 @@ public void run() {
operatorKeyProvider.loadContent(operatorKeyProvider.getMetadata());
OperatorKeyStoreWriter operatorKeyStoreWriter = new OperatorKeyStoreWriter(operatorKeyProvider, fileManager, jsonWriter, versionGenerator);
- CloudPath s3KeyMetadataPath = new CloudPath(config.getString(Const.Config.S3keysMetadataPathProp));
- GlobalScope s3KeyGlobalScope = new GlobalScope(s3KeyMetadataPath);
- RotatingS3KeyProvider s3KeyProvider = new RotatingS3KeyProvider(cloudStorage, s3KeyGlobalScope);
- S3KeyStoreWriter s3KeyStoreWriter = new S3KeyStoreWriter(s3KeyProvider, fileManager, jsonWriter, versionGenerator, clock, s3KeyGlobalScope);
+ CloudPath cloudEncryptionKeyMetadataPath = new CloudPath(config.getString(Const.Config.CloudEncryptionKeysMetadataPathProp));
+ GlobalScope cloudEncryptionKeyGlobalScope = new GlobalScope(cloudEncryptionKeyMetadataPath);
+ RotatingCloudEncryptionKeyProvider RotatingCloudEncryptionKeyProvider = new RotatingCloudEncryptionKeyProvider(cloudStorage, cloudEncryptionKeyGlobalScope);
+ CloudEncryptionKeyStoreWriter cloudEncryptionKeyStoreWriter = new CloudEncryptionKeyStoreWriter(RotatingCloudEncryptionKeyProvider, fileManager, jsonWriter, versionGenerator, clock, cloudEncryptionKeyGlobalScope);
IKeyGenerator keyGenerator = new SecureKeyGenerator();
- S3KeyManager s3KeyManager = new S3KeyManager(s3KeyProvider, s3KeyStoreWriter,keyGenerator);
+ CloudEncryptionKeyManager cloudEncryptionKeyManager = new CloudEncryptionKeyManager(RotatingCloudEncryptionKeyProvider, cloudEncryptionKeyStoreWriter,keyGenerator);
try {
- s3KeyProvider.loadContent();
+ RotatingCloudEncryptionKeyProvider.loadContent();
} catch (CloudStorageException e) {
if (e.getMessage().contains("The specified key does not exist")) {
- s3KeyStoreWriter.upload(new HashMap<>(), null);
- s3KeyProvider.loadContent();
+ cloudEncryptionKeyStoreWriter.upload(new HashMap<>(), null);
+ RotatingCloudEncryptionKeyProvider.loadContent();
} else {
throw e;
}
@@ -255,11 +255,11 @@ public void run() {
clientSideKeypairService,
new ServiceService(auth, writeLock, serviceStoreWriter, serviceProvider, siteProvider, serviceLinkProvider),
new ServiceLinkService(auth, writeLock, serviceLinkStoreWriter, serviceLinkProvider, serviceProvider, siteProvider),
- new OperatorKeyService(config, auth, writeLock, operatorKeyStoreWriter, operatorKeyProvider, siteProvider, keyGenerator, keyHasher, s3KeyManager),
+ new OperatorKeyService(config, auth, writeLock, operatorKeyStoreWriter, operatorKeyProvider, siteProvider, keyGenerator, keyHasher, cloudEncryptionKeyManager),
new SaltService(auth, writeLock, saltStoreWriter, saltProvider, saltRotation),
new SiteService(auth, writeLock, siteStoreWriter, siteProvider, clientKeyProvider),
new PartnerConfigService(auth, writeLock, partnerStoreWriter, partnerConfigProvider),
- new PrivateSiteDataRefreshService(auth, jobDispatcher, writeLock, config, s3KeyProvider),
+ new PrivateSiteDataRefreshService(auth, jobDispatcher, writeLock, config, RotatingCloudEncryptionKeyProvider),
new JobDispatcherService(auth, jobDispatcher),
new SearchService(auth, clientKeyProvider, operatorKeyProvider)
};
@@ -286,8 +286,8 @@ public void run() {
}
synchronized (writeLock) {
- s3KeyManager.generateKeysForOperators(operatorKeyProvider.getAll(), config.getLong("s3_key_activates_in_seconds"), config.getInteger("s3_key_count_per_site"));
- s3KeyProvider.loadContent();
+ cloudEncryptionKeyManager.generateKeysForOperators(operatorKeyProvider.getAll(), config.getLong("cloud_encryption_key_activates_in_seconds"), config.getInteger("cloud_encryption_key_count_per_site"));
+ RotatingCloudEncryptionKeyProvider.loadContent();
}
/*
@@ -336,7 +336,7 @@ public void run() {
CompletableFuture privateSiteDataSyncJobFuture = jobDispatcher.executeNextJob();
privateSiteDataSyncJobFuture.get();
- EncryptedFilesSyncJob encryptedFilesSyncJob = new EncryptedFilesSyncJob(config, writeLock,s3KeyProvider);
+ EncryptedFilesSyncJob encryptedFilesSyncJob = new EncryptedFilesSyncJob(config, writeLock,RotatingCloudEncryptionKeyProvider);
jobDispatcher.enqueue(encryptedFilesSyncJob);
CompletableFuture encryptedFilesSyncJobFuture = jobDispatcher.executeNextJob();
encryptedFilesSyncJobFuture.get();
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/ClientKeyEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/ClientKeyEncryptionJob.java
index 7227acbe..9febe5f7 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/ClientKeyEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/ClientKeyEncryptionJob.java
@@ -26,7 +26,7 @@ public ClientKeyEncryptionJob(
@Override
public String getId() {
- return "s3-encryption-sync-clientKeys";
+ return "cloud-encryption-sync-clientKeys";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/EncryptionKeyEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/EncryptionKeyEncryptionJob.java
index 4dbc03ca..f86f8dc4 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/EncryptionKeyEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/EncryptionKeyEncryptionJob.java
@@ -40,7 +40,7 @@ public EncryptionKeyEncryptionJob(
@Override
public String getId() {
- return "s3-encryption-sync-encryptionKeys";
+ return "cloud-encryption-sync-encryptionKeys";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/KeyAclEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/KeyAclEncryptionJob.java
index d6e8b5cc..90b80591 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/KeyAclEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/KeyAclEncryptionJob.java
@@ -27,7 +27,7 @@ public KeyAclEncryptionJob(
@Override
public String getId() {
- return "s3-encryption-sync-keyAcls";
+ return "cloud-encryption-sync-keyAcls";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/KeysetKeyEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/KeysetKeyEncryptionJob.java
index ec3b3bcc..626efffc 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/KeysetKeyEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/KeysetKeyEncryptionJob.java
@@ -35,7 +35,7 @@ public KeysetKeyEncryptionJob(Collection globalOperators,
@Override
public String getId() {
- return "s3-encryption-sync-keysetKeys";
+ return "cloud-encryption-sync-keysetKeys";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/SiteEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/SiteEncryptionJob.java
index ff137387..ba5d5a16 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/SiteEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/SiteEncryptionJob.java
@@ -25,7 +25,7 @@ public SiteEncryptionJob(
@Override
public String getId() {
- return "s3-encryption-sync-sites";
+ return "cloud-encryption-sync-sites";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/EncryptionJob/SiteKeysetEncryptionJob.java b/src/main/java/com/uid2/admin/job/EncryptionJob/SiteKeysetEncryptionJob.java
index f4dba6fc..5c355fc9 100644
--- a/src/main/java/com/uid2/admin/job/EncryptionJob/SiteKeysetEncryptionJob.java
+++ b/src/main/java/com/uid2/admin/job/EncryptionJob/SiteKeysetEncryptionJob.java
@@ -28,7 +28,7 @@ public SiteKeysetEncryptionJob(
@Override
public String getId() {
- return "s3-encryption-sync-keysets";
+ return "cloud-encryption-sync-keysets";
}
@Override
diff --git a/src/main/java/com/uid2/admin/job/jobsync/EncryptedFilesSyncJob.java b/src/main/java/com/uid2/admin/job/jobsync/EncryptedFilesSyncJob.java
index 09ccb8c9..14077ac3 100644
--- a/src/main/java/com/uid2/admin/job/jobsync/EncryptedFilesSyncJob.java
+++ b/src/main/java/com/uid2/admin/job/jobsync/EncryptedFilesSyncJob.java
@@ -2,7 +2,6 @@
import com.fasterxml.jackson.databind.ObjectWriter;
import com.uid2.admin.job.EncryptionJob.*;
-import com.uid2.admin.job.jobsync.acl.KeyAclSyncJob;
import com.uid2.admin.job.EncryptionJob.ClientKeyEncryptionJob;
import com.uid2.admin.job.model.Job;
import com.uid2.admin.store.*;
@@ -23,7 +22,8 @@
import com.uid2.shared.model.Site;
import com.uid2.shared.store.CloudPath;
import com.uid2.admin.legacy.LegacyClientKey;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.store.scope.GlobalScope;
import io.vertx.core.json.JsonObject;
@@ -34,12 +34,12 @@
public class EncryptedFilesSyncJob extends Job {
private final JsonObject config;
private final WriteLock writeLock;
- private final RotatingS3KeyProvider s3KeyProvider;
+ private final RotatingCloudEncryptionKeyProvider RotatingCloudEncryptionKeyProvider;
- public EncryptedFilesSyncJob(JsonObject config, WriteLock writeLock,RotatingS3KeyProvider s3KeyProvider) {
+ public EncryptedFilesSyncJob(JsonObject config, WriteLock writeLock, RotatingCloudEncryptionKeyProvider RotatingCloudEncryptionKeyProvider) {
this.config = config;
this.writeLock = writeLock;
- this.s3KeyProvider = s3KeyProvider;
+ this.RotatingCloudEncryptionKeyProvider = RotatingCloudEncryptionKeyProvider;
}
@Override
@@ -62,7 +62,7 @@ public void execute() throws Exception {
jsonWriter,
versionGenerator,
clock,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
fileManager);
ClientKeyStoreFactory clientKeyStoreFactory = new ClientKeyStoreFactory(
@@ -71,7 +71,7 @@ public void execute() throws Exception {
jsonWriter,
versionGenerator,
clock,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
fileManager);
EncryptionKeyStoreFactory encryptionKeyStoreFactory = new EncryptionKeyStoreFactory(
@@ -79,7 +79,7 @@ public void execute() throws Exception {
new CloudPath(config.getString(Const.Config.KeysMetadataPathProp)),
versionGenerator,
clock,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
fileManager);
KeyAclStoreFactory keyAclStoreFactory = new KeyAclStoreFactory(
@@ -88,7 +88,7 @@ public void execute() throws Exception {
jsonWriter,
versionGenerator,
clock,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
fileManager);
KeysetStoreFactory keysetStoreFactory = new KeysetStoreFactory(
@@ -98,7 +98,7 @@ public void execute() throws Exception {
versionGenerator,
clock,
fileManager,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
config.getBoolean(enableKeysetConfigProp));
KeysetKeyStoreFactory keysetKeyStoreFactory = new KeysetKeyStoreFactory(
@@ -107,7 +107,7 @@ public void execute() throws Exception {
versionGenerator,
clock,
fileManager,
- s3KeyProvider,
+ RotatingCloudEncryptionKeyProvider,
config.getBoolean(enableKeysetConfigProp));
CloudPath operatorMetadataPath = new CloudPath(config.getString(Const.Config.OperatorsMetadataPathProp));
@@ -115,7 +115,7 @@ public void execute() throws Exception {
RotatingOperatorKeyProvider operatorKeyProvider = new RotatingOperatorKeyProvider(cloudStorage, cloudStorage, operatorScope);
synchronized (writeLock) {
- s3KeyProvider.loadContent();
+ RotatingCloudEncryptionKeyProvider.loadContent();
operatorKeyProvider.loadContent(operatorKeyProvider.getMetadata());
siteStoreFactory.getGlobalReader().loadContent(siteStoreFactory.getGlobalReader().getMetadata());
clientKeyStoreFactory.getGlobalReader().loadContent();
diff --git a/src/main/java/com/uid2/admin/legacy/LegacyClientKeyStoreWriter.java b/src/main/java/com/uid2/admin/legacy/LegacyClientKeyStoreWriter.java
index 431841a7..b43f13ad 100644
--- a/src/main/java/com/uid2/admin/legacy/LegacyClientKeyStoreWriter.java
+++ b/src/main/java/com/uid2/admin/legacy/LegacyClientKeyStoreWriter.java
@@ -10,7 +10,7 @@
import com.uid2.admin.store.writer.EncryptedScopedStoreWriter;
import com.uid2.admin.store.writer.ScopedStoreWriter;
import com.uid2.admin.store.writer.StoreWriter;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.store.scope.EncryptedScope;
import com.uid2.shared.store.scope.StoreScope;
import io.vertx.core.json.JsonObject;
@@ -33,11 +33,11 @@ public LegacyClientKeyStoreWriter(RotatingLegacyClientKeyProvider provider,
VersionGenerator versionGenerator,
Clock clock,
EncryptedScope scope,
- RotatingS3KeyProvider s3KeyProvider) {
+ RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider) {
this.jsonWriter = jsonWriter;
FileName dataFile = new FileName("clients", ".json");
String dataType = "client_keys";
- this.writer = new EncryptedScopedStoreWriter(provider, fileManager, versionGenerator, clock, scope, dataFile, dataType, s3KeyProvider, scope.getId());
+ this.writer = new EncryptedScopedStoreWriter(provider, fileManager, versionGenerator, clock, scope, dataFile, dataType, cloudEncryptionKeyProvider, scope.getId());
}
@Override
diff --git a/src/main/java/com/uid2/admin/legacy/RotatingLegacyClientKeyProvider.java b/src/main/java/com/uid2/admin/legacy/RotatingLegacyClientKeyProvider.java
index 72dc3e93..9d04b904 100644
--- a/src/main/java/com/uid2/admin/legacy/RotatingLegacyClientKeyProvider.java
+++ b/src/main/java/com/uid2/admin/legacy/RotatingLegacyClientKeyProvider.java
@@ -6,7 +6,7 @@
import com.uid2.shared.store.CloudPath;
import com.uid2.shared.store.EncryptedScopedStoreReader;
import com.uid2.shared.store.ScopedStoreReader;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.store.reader.StoreReader;
import com.uid2.shared.store.scope.EncryptedScope;
import com.uid2.shared.store.scope.StoreScope;
@@ -48,8 +48,8 @@ public RotatingLegacyClientKeyProvider(DownloadCloudStorage fileStreamProvider,
this.authorizableStore = new AuthorizableStore<>(LegacyClientKey.class);
}
- public RotatingLegacyClientKeyProvider(DownloadCloudStorage fileStreamProvider, EncryptedScope scope, RotatingS3KeyProvider s3KeyProvider) {
- this.reader = new EncryptedScopedStoreReader<>(fileStreamProvider, scope, new LegacyClientParser(), "auth keys", s3KeyProvider);
+ public RotatingLegacyClientKeyProvider(DownloadCloudStorage fileStreamProvider, EncryptedScope scope, RotatingCloudEncryptionKeyProvider cloudEncryptionKeyProvider) {
+ this.reader = new EncryptedScopedStoreReader<>(fileStreamProvider, scope, new LegacyClientParser(), "auth keys", cloudEncryptionKeyProvider);
this.authorizableStore = new AuthorizableStore<>(LegacyClientKey.class);
}
diff --git a/src/main/java/com/uid2/admin/managers/S3KeyManager.java b/src/main/java/com/uid2/admin/managers/CloudEncryptionKeyManager.java
similarity index 53%
rename from src/main/java/com/uid2/admin/managers/S3KeyManager.java
rename to src/main/java/com/uid2/admin/managers/CloudEncryptionKeyManager.java
index aaf911f3..d351f22f 100644
--- a/src/main/java/com/uid2/admin/managers/S3KeyManager.java
+++ b/src/main/java/com/uid2/admin/managers/CloudEncryptionKeyManager.java
@@ -1,11 +1,10 @@
package com.uid2.admin.managers;
-import com.uid2.admin.store.writer.S3KeyStoreWriter;
+import com.uid2.admin.store.writer.CloudEncryptionKeyStoreWriter;
import com.uid2.shared.auth.OperatorKey;
-import com.uid2.shared.model.S3Key;
+import com.uid2.shared.model.CloudEncryptionKey;
import com.uid2.shared.secret.IKeyGenerator;
-import com.uid2.shared.secret.SecureKeyGenerator;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
@@ -15,24 +14,24 @@
import java.time.Instant;
import java.util.*;
-public class S3KeyManager {
+public class CloudEncryptionKeyManager {
- private static final Logger LOGGER = LoggerFactory.getLogger(S3KeyManager.class);
+ private static final Logger LOGGER = LoggerFactory.getLogger(CloudEncryptionKeyManager.class);
- private final RotatingS3KeyProvider s3KeyProvider;
- private final S3KeyStoreWriter s3KeyStoreWriter;
+ private final RotatingCloudEncryptionKeyProvider RotatingCloudEncryptionKeyProvider;
+ private final CloudEncryptionKeyStoreWriter cloudEncryptionKeyStoreWriter;
private final IKeyGenerator keyGenerator;
- public S3KeyManager(RotatingS3KeyProvider s3KeyProvider, S3KeyStoreWriter s3KeyStoreWriter, IKeyGenerator keyGenerator) {
- this.s3KeyProvider = s3KeyProvider;
- this.s3KeyStoreWriter = s3KeyStoreWriter;
+ public CloudEncryptionKeyManager(RotatingCloudEncryptionKeyProvider RotatingCloudEncryptionKeyProvider, CloudEncryptionKeyStoreWriter cloudEncryptionKeyStoreWriter, IKeyGenerator keyGenerator) {
+ this.RotatingCloudEncryptionKeyProvider = RotatingCloudEncryptionKeyProvider;
+ this.cloudEncryptionKeyStoreWriter = cloudEncryptionKeyStoreWriter;
this.keyGenerator = keyGenerator;
}
- S3Key generateS3Key(int siteId, long activates, long created) throws Exception {
+ CloudEncryptionKey generateCloudEncryptionKey(int siteId, long activates, long created) throws Exception {
int newKeyId = getNextKeyId();
String secret = generateSecret();
- return new S3Key(newKeyId, siteId, activates, created, secret);
+ return new CloudEncryptionKey(newKeyId, siteId, activates, created, secret);
}
String generateSecret() throws Exception {
@@ -40,51 +39,51 @@ String generateSecret() throws Exception {
return keyGenerator.generateRandomKeyString(32);
}
- void addS3Key(S3Key s3Key) throws Exception {
- Map s3Keys = new HashMap<>(s3KeyProvider.getAll());
- s3Keys.put(s3Key.getId(), s3Key);
- s3KeyStoreWriter.upload(s3Keys, null);
+ void addCloudEncryptionKey(CloudEncryptionKey cloudEncryptionKey) throws Exception {
+ Map cloudEncryptionKeys = new HashMap<>(RotatingCloudEncryptionKeyProvider.getAll());
+ cloudEncryptionKeys.put(cloudEncryptionKey.getId(), cloudEncryptionKey);
+ cloudEncryptionKeyStoreWriter.upload(cloudEncryptionKeys, null);
}
int getNextKeyId() {
- Map s3Keys = s3KeyProvider.getAll();
- if (s3Keys == null || s3Keys.isEmpty()) {
+ Map cloudEncryptionKeys = RotatingCloudEncryptionKeyProvider.getAll();
+ if (cloudEncryptionKeys == null || cloudEncryptionKeys.isEmpty()) {
return 1;
}
- return s3Keys.keySet().stream().max(Integer::compareTo).orElse(0) + 1;
+ return cloudEncryptionKeys.keySet().stream().max(Integer::compareTo).orElse(0) + 1;
}
// Method to create and upload an S3 key that activates immediately for a specific site, for emergency rotation
- public S3Key createAndAddImmediate3Key(int siteId) throws Exception {
+ public CloudEncryptionKey createAndAddImmediate3Key(int siteId) throws Exception {
int newKeyId = getNextKeyId();
long created = Instant.now().getEpochSecond();
- S3Key newKey = new S3Key(newKeyId, siteId, created, created, generateSecret());
- addS3Key(newKey);
+ CloudEncryptionKey newKey = new CloudEncryptionKey(newKeyId, siteId, created, created, generateSecret());
+ addCloudEncryptionKey(newKey);
return newKey;
}
- public S3Key getS3KeyByKeyIdentifier(int keyIdentifier) {
- return s3KeyProvider.getAll().get(keyIdentifier);
+ public CloudEncryptionKey getCloudEncryptionKeyByKeyIdentifier(int keyIdentifier) {
+ return RotatingCloudEncryptionKeyProvider.getAll().get(keyIdentifier);
}
- public Optional getS3KeyBySiteId(int siteId) {
- return s3KeyProvider.getAll().values().stream()
+ public Optional getCloudEncryptionKeyBySiteId(int siteId) {
+ return RotatingCloudEncryptionKeyProvider.getAll().values().stream()
.filter(key -> key.getSiteId() == siteId)
.findFirst();
}
- public List getAllS3KeysBySiteId(int siteId) {
- return s3KeyProvider.getAll().values().stream()
+ public List getAllCloudEncryptionKeysBySiteId(int siteId) {
+ return RotatingCloudEncryptionKeyProvider.getAll().values().stream()
.filter(key -> key.getSiteId() == siteId)
.collect(Collectors.toList());
}
- public Map getAllS3Keys() {
- return s3KeyProvider.getAll();
+ public Map getAllCloudEncryptionKeys() {
+ return RotatingCloudEncryptionKeyProvider.getAll();
}
public boolean doesSiteHaveKeys(int siteId) {
- Map allKeys = s3KeyProvider.getAll();
+ Map allKeys = RotatingCloudEncryptionKeyProvider.getAll();
if (allKeys == null) {
return false;
}
@@ -92,12 +91,12 @@ public boolean doesSiteHaveKeys(int siteId) {
}
int countKeysForSite(int siteId) {
- Map allKeys = s3KeyProvider.getAll();
+ Map allKeys = RotatingCloudEncryptionKeyProvider.getAll();
return (int) allKeys.values().stream().filter(key -> key.getSiteId() == siteId).count();
}
public void generateKeysForOperators(Collection operatorKeys, long keyActivateInterval, int keyCountPerSite) throws Exception {
- this.s3KeyProvider.loadContent();
+ this.RotatingCloudEncryptionKeyProvider.loadContent();
if (operatorKeys == null || operatorKeys.isEmpty()) {
throw new IllegalArgumentException("Operator keys collection must not be null or empty");
@@ -123,8 +122,8 @@ public void generateKeysForOperators(Collection operatorKeys, long
for (int i = 0; i < keysToGenerate; i++) {
long created = Instant.now().getEpochSecond();
long activated = created + (i * keyActivateInterval);
- S3Key s3Key = generateS3Key(siteId, activated, created);
- addS3Key(s3Key);
+ CloudEncryptionKey cloudEncryptionKey = generateCloudEncryptionKey(siteId, activated, created);
+ addCloudEncryptionKey(cloudEncryptionKey);
}
LOGGER.info("Generated " + keysToGenerate + " keys for site ID " + siteId);
} else {
diff --git a/src/main/java/com/uid2/admin/store/factory/ClientKeyStoreFactory.java b/src/main/java/com/uid2/admin/store/factory/ClientKeyStoreFactory.java
index 0f4fd296..186a91ff 100644
--- a/src/main/java/com/uid2/admin/store/factory/ClientKeyStoreFactory.java
+++ b/src/main/java/com/uid2/admin/store/factory/ClientKeyStoreFactory.java
@@ -6,26 +6,16 @@
import com.uid2.admin.legacy.RotatingLegacyClientKeyProvider;
import com.uid2.admin.store.Clock;
import com.uid2.admin.store.FileManager;
-import com.uid2.admin.store.FileName;
import com.uid2.admin.store.version.VersionGenerator;
-import com.uid2.admin.store.writer.ClientKeyStoreWriter;
-import com.uid2.admin.store.writer.EncryptedScopedStoreWriter;
-import com.uid2.admin.store.writer.KeysetStoreWriter;
import com.uid2.admin.store.writer.StoreWriter;
-import com.uid2.shared.auth.Keyset;
import com.uid2.shared.cloud.ICloudStorage;
-import com.uid2.shared.model.Site;
import com.uid2.shared.store.CloudPath;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
-import com.uid2.shared.store.reader.RotatingSiteStore;
-import com.uid2.shared.store.reader.StoreReader;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.store.scope.EncryptedScope;
import com.uid2.shared.store.scope.GlobalScope;
import com.uid2.shared.store.scope.SiteScope;
-import com.uid2.shared.store.scope.StoreScope;
import java.util.Collection;
-import java.util.Map;
public class ClientKeyStoreFactory implements EncryptedStoreFactory> {
private final ICloudStorage fileStreamProvider;
@@ -35,7 +25,7 @@ public class ClientKeyStoreFactory implements EncryptedStoreFactory extends StoreFactory {
StoreWriter getEncryptedWriter(Integer siteId, boolean isPublic);
StoreReader getEncryptedReader (Integer siteId, boolean isPublic);
- RotatingS3KeyProvider getS3Provider();
+ RotatingCloudEncryptionKeyProvider getCloudEncryptionProvider();
}
\ No newline at end of file
diff --git a/src/main/java/com/uid2/admin/store/factory/EncryptionKeyStoreFactory.java b/src/main/java/com/uid2/admin/store/factory/EncryptionKeyStoreFactory.java
index 46d7170a..d22c4ae9 100644
--- a/src/main/java/com/uid2/admin/store/factory/EncryptionKeyStoreFactory.java
+++ b/src/main/java/com/uid2/admin/store/factory/EncryptionKeyStoreFactory.java
@@ -1,28 +1,19 @@
package com.uid2.admin.store.factory;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.uid2.admin.legacy.RotatingLegacyClientKeyProvider;
import com.uid2.admin.store.Clock;
import com.uid2.admin.store.FileManager;
-import com.uid2.admin.store.FileName;
import com.uid2.admin.store.version.VersionGenerator;
-import com.uid2.admin.store.writer.EncryptedScopedStoreWriter;
import com.uid2.admin.store.writer.EncryptionKeyStoreWriter;
-import com.uid2.admin.store.writer.KeysetStoreWriter;
-import com.uid2.admin.store.writer.StoreWriter;
-import com.uid2.shared.auth.Keyset;
import com.uid2.shared.cloud.ICloudStorage;
import com.uid2.shared.model.EncryptionKey;
import com.uid2.shared.store.CloudPath;
import com.uid2.shared.store.reader.RotatingKeyStore;
-import com.uid2.shared.store.reader.RotatingS3KeyProvider;
+import com.uid2.shared.store.reader.RotatingCloudEncryptionKeyProvider;
import com.uid2.shared.store.scope.EncryptedScope;
import com.uid2.shared.store.scope.GlobalScope;
import com.uid2.shared.store.scope.SiteScope;
-import com.uid2.shared.store.scope.StoreScope;
import java.util.Collection;
-import java.util.Map;
public class EncryptionKeyStoreFactory implements EncryptedStoreFactory> {
private final ICloudStorage fileStreamProvider;
@@ -31,7 +22,7 @@ public class EncryptionKeyStoreFactory implements EncryptedStoreFactory> getReader(Integer siteId) {
}
public StoreReader