-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #353 from IABTechLab/cbc-UID2-4571-cloud-encryptio…
…n-cleanup Adding more work on salt encryption
- Loading branch information
Showing
17 changed files
with
612 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/com/uid2/admin/job/EncryptionJob/ClientSideKeypairEncryptionJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package com.uid2.admin.job.EncryptionJob; | ||
|
||
import com.uid2.admin.job.model.Job; | ||
import com.uid2.admin.model.PrivateSiteDataMap; | ||
import com.uid2.admin.store.MultiScopeStoreWriter; | ||
import com.uid2.admin.util.PublicSiteUtil; | ||
import com.uid2.shared.auth.OperatorKey; | ||
import com.uid2.shared.model.ClientSideKeypair; | ||
|
||
import java.util.Collection; | ||
|
||
public class ClientSideKeypairEncryptionJob extends Job { | ||
private final Collection<OperatorKey> globalOperators; | ||
private final Collection<ClientSideKeypair> globalClientSideKeypairs; | ||
|
||
private final MultiScopeStoreWriter<Collection<ClientSideKeypair>> multiScopeStoreWriter; | ||
|
||
public ClientSideKeypairEncryptionJob(Collection<OperatorKey> globalOperators, Collection<ClientSideKeypair> globalClientSideKeypairs, | ||
MultiScopeStoreWriter<Collection<ClientSideKeypair>> multiScopeStoreWriter) { | ||
this.globalOperators = globalOperators; | ||
this.globalClientSideKeypairs = globalClientSideKeypairs; | ||
this.multiScopeStoreWriter = multiScopeStoreWriter; | ||
} | ||
|
||
@Override | ||
public String getId() { | ||
return "cloud-encryption-sync-clientside-keypair"; | ||
} | ||
|
||
@Override | ||
public void execute() throws Exception { | ||
// Only public operators support clientside keypair | ||
PrivateSiteDataMap<ClientSideKeypair> desiredPublicState = PublicSiteUtil.getPublicClientKeypairs(globalClientSideKeypairs, globalOperators); | ||
multiScopeStoreWriter.uploadPublicWithEncryption(desiredPublicState, null); | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
src/main/java/com/uid2/admin/job/EncryptionJob/SaltEncryptionJob.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package com.uid2.admin.job.EncryptionJob; | ||
|
||
import com.uid2.admin.job.model.Job; | ||
import com.uid2.admin.model.PrivateSiteDataMap; | ||
import com.uid2.admin.store.MultiScopeStoreWriter; | ||
import com.uid2.admin.util.PrivateSiteUtil; | ||
import com.uid2.admin.util.PublicSiteUtil; | ||
import com.uid2.shared.auth.OperatorKey; | ||
import com.uid2.shared.model.SaltEntry; | ||
import com.uid2.shared.store.RotatingSaltProvider; | ||
|
||
import java.util.Collection; | ||
import java.util.List; | ||
|
||
public class SaltEncryptionJob extends Job { | ||
private final Collection<OperatorKey> globalOperators; | ||
private final Collection<RotatingSaltProvider.SaltSnapshot> saltEntries; | ||
private final MultiScopeStoreWriter<Collection<RotatingSaltProvider.SaltSnapshot>> multiScopeStoreWriter; | ||
|
||
public SaltEncryptionJob(Collection<OperatorKey> globalOperators, | ||
Collection<RotatingSaltProvider.SaltSnapshot> saltEntries, | ||
MultiScopeStoreWriter<Collection<RotatingSaltProvider.SaltSnapshot>> multiScopeStoreWriter) { | ||
this.globalOperators = globalOperators; | ||
this.saltEntries = saltEntries; | ||
this.multiScopeStoreWriter = multiScopeStoreWriter; | ||
} | ||
|
||
|
||
@Override | ||
public String getId() { | ||
return "cloud-encryption-sync-salts"; | ||
} | ||
|
||
@Override | ||
public void execute() throws Exception { | ||
List<Integer> desiredPrivateState = PrivateSiteUtil.getPrivateSaltSites(globalOperators); | ||
multiScopeStoreWriter.uploadPrivateWithEncryption(desiredPrivateState, saltEntries, null); | ||
List<Integer> desiredPublicState = PublicSiteUtil.getPublicSaltSites(globalOperators); | ||
multiScopeStoreWriter.uploadPublicWithEncryption(desiredPublicState, saltEntries, null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.