Skip to content

Commit d3be28e

Browse files
fix(sdk): Set ec-wrapped to new salt value (#230)
This reverts commit 0fe37c6.
1 parent 053efac commit d3be28e

File tree

1 file changed

+14
-1
lines changed
  • sdk/src/main/java/io/opentdf/platform/sdk

1 file changed

+14
-1
lines changed

sdk/src/main/java/io/opentdf/platform/sdk/TDF.java

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import io.opentdf.platform.sdk.nanotdf.ECKeyPair;
1414
import org.apache.commons.codec.DecoderException;
1515
import org.apache.commons.codec.binary.Hex;
16+
import org.bouncycastle.crypto.digests.SHA256Digest;
1617
import org.bouncycastle.jce.interfaces.ECPublicKey;
1718
import org.slf4j.Logger;
1819
import org.slf4j.LoggerFactory;
@@ -37,7 +38,19 @@
3738
*/
3839
public class TDF {
3940

40-
public static final byte[] GLOBAL_KEY_SALT = null;
41+
private static byte[] tdfECKeySaltCompute() {
42+
byte[] salt;
43+
try {
44+
MessageDigest digest = MessageDigest.getInstance("SHA-256");
45+
digest.update("TDF".getBytes());
46+
salt = digest.digest();
47+
} catch (NoSuchAlgorithmException e) {
48+
throw new RuntimeException("failed to compute salt for TDF", e);
49+
}
50+
return salt;
51+
}
52+
53+
public static final byte[] GLOBAL_KEY_SALT = tdfECKeySaltCompute();
4154
private static final String EMPTY_SPLIT_ID = "";
4255
private static final String TDF_VERSION = "4.3.0";
4356
private static final String KEY_ACCESS_SECHMA_VERSION = "1.0";

0 commit comments

Comments
 (0)