From 77c247bf13b7d004447fbfbed9eea7148742588f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Skaar=2C=20Bj=C3=B8rn-Andre?= Date: Mon, 11 Dec 2023 15:17:53 +0100 Subject: [PATCH] Add getAlgorithm method to all PseudoFunc implementations. --- .../java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java | 3 +++ .../java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java | 5 +++++ .../no/ssb/dapla/dlp/pseudo/func/redact/RedactFunc.java | 8 ++++++++ .../dapla/dlp/pseudo/func/tink/daead/TinkDaeadFunc.java | 7 +++++++ .../ssb/dapla/dlp/pseudo/func/tink/fpe/TinkFpeFunc.java | 6 ++++++ 5 files changed, 29 insertions(+) diff --git a/src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java b/src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java index ccc865c..ee0a5cc 100644 --- a/src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java +++ b/src/main/java/no/ssb/dapla/dlp/pseudo/func/PseudoFunc.java @@ -5,6 +5,9 @@ public interface PseudoFunc { /** Name of the function declaration (including any parameters), e.g. foo(param1,param2) */ String getFuncDecl(); + /** Name of the encryption algorithm, e.g. TINK_FPE, TINK_DEEAD */ + String getAlgorithm(); + /** * Preprocessing of input. This will be called before apply */ diff --git a/src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java b/src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java index f9f4a3c..888d5c7 100644 --- a/src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java +++ b/src/main/java/no/ssb/dapla/dlp/pseudo/func/map/MapFunc.java @@ -12,6 +12,11 @@ public class MapFunc extends AbstractPseudoFunc { private final Mapper mapper; + @Override + public String getAlgorithm() { + return null; + } + public MapFunc(PseudoFuncConfig genericConfig) { super(genericConfig.getFuncDecl()); this.mapper = loadMapper(); diff --git a/src/main/java/no/ssb/dapla/dlp/pseudo/func/redact/RedactFunc.java b/src/main/java/no/ssb/dapla/dlp/pseudo/func/redact/RedactFunc.java index 02450f6..e361fe7 100644 --- a/src/main/java/no/ssb/dapla/dlp/pseudo/func/redact/RedactFunc.java +++ b/src/main/java/no/ssb/dapla/dlp/pseudo/func/redact/RedactFunc.java @@ -16,6 +16,14 @@ public class RedactFunc extends AbstractPseudoFunc { private final RedactFuncConfigService configService = new RedactFuncConfigService(); private final RedactFuncConfig config; + // A.k.a Free Text Redaction + private static final String ALGORITHM = "REDACT"; + + @Override + public String getAlgorithm() { + return ALGORITHM; + } + public RedactFunc(@NonNull PseudoFuncConfig genericConfig) { super(genericConfig.getFuncDecl()); this.config = configService.resolve(genericConfig); diff --git a/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/daead/TinkDaeadFunc.java b/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/daead/TinkDaeadFunc.java index 4158a22..7b23c98 100644 --- a/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/daead/TinkDaeadFunc.java +++ b/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/daead/TinkDaeadFunc.java @@ -17,6 +17,13 @@ public class TinkDaeadFunc extends AbstractPseudoFunc { private final TinkDaeadFuncConfigService configService = new TinkDaeadFuncConfigService(); private final TinkDaeadFuncConfig config; + private static final String ALGORITHM = "TINK-DAEAD"; + + @Override + public String getAlgorithm() { + return ALGORITHM; + } + public TinkDaeadFunc(@NonNull PseudoFuncConfig genericConfig) { super(genericConfig.getFuncDecl()); this.config = configService.resolve(genericConfig); diff --git a/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/fpe/TinkFpeFunc.java b/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/fpe/TinkFpeFunc.java index ae9b983..b3ef858 100644 --- a/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/fpe/TinkFpeFunc.java +++ b/src/main/java/no/ssb/dapla/dlp/pseudo/func/tink/fpe/TinkFpeFunc.java @@ -15,6 +15,12 @@ public class TinkFpeFunc extends AbstractPseudoFunc { private final TinkFpeFuncConfigService configService = new TinkFpeFuncConfigService(); private final TinkFpeFuncConfig config; + private static final String ALGORITHM = "TINK-FPE"; + @Override + public String getAlgorithm() { + return ALGORITHM; + } + public TinkFpeFunc(@NonNull PseudoFuncConfig genericConfig) { super(genericConfig.getFuncDecl()); this.config = configService.resolve(genericConfig);