Skip to content

Commit fb5c9df

Browse files
committed
Merge remote-tracking branch 'origin/develop' into release/8.6.0
2 parents 092a750 + 1edd65a commit fb5c9df

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file.
1313
- Configure Gradle JVM Test Suite Plugin. (#259)
1414
- Replace `SECURE_SESSION_NO_TEE_PROVIDER` with `SECURE_SESSION_NO_TEE_FRAMEWORK`
1515
in `TeeSessionGenerationError`. (#265)
16+
- Add `final` keyword in `EncryptionService`. (#268)
1617

1718
### Dependency Upgrades
1819

src/main/java/com/iexec/sms/encryption/EncryptionService.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,10 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
7171
throw new ExceptionInInitializerError("Failed to get aesKeyPath");
7272
}
7373

74-
boolean shouldGenerateKey = !new File(aesKeyPath).exists();
74+
final boolean shouldGenerateKey = !new File(aesKeyPath).exists();
7575

7676
if (shouldGenerateKey) {
77-
byte[] newAesKey = CipherHelper.generateAesKey();
77+
final byte[] newAesKey = CipherHelper.generateAesKey();
7878

7979
if (newAesKey == null) {
8080
throw new ExceptionInInitializerError("Failed to generate AES key");
@@ -84,7 +84,7 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
8484
}
8585
}
8686

87-
byte[] aesKey = FileHelper.readFileBytes(aesKeyPath);
87+
final byte[] aesKey = FileHelper.readFileBytes(aesKeyPath);
8888

8989
if (aesKey == null) {
9090
throw new ExceptionInInitializerError("Failed to load AES key");
@@ -98,7 +98,7 @@ private byte[] getOrCreateAesKey(String aesKeyPath) {
9898

9999
public String encrypt(String data) {
100100
if (StringUtils.isNotBlank(data)) {
101-
byte[] encryptedData = CipherHelper.aesEncrypt(data.getBytes(), aesKey);
101+
final byte[] encryptedData = CipherHelper.aesEncrypt(data.getBytes(), aesKey);
102102
if (encryptedData != null) {
103103
return new String(encryptedData);
104104
}
@@ -108,7 +108,7 @@ public String encrypt(String data) {
108108

109109
public String decrypt(String encryptedData) {
110110
if (StringUtils.isNotBlank(encryptedData)) {
111-
byte[] decryptedData = CipherHelper.aesDecrypt(encryptedData.getBytes(), aesKey);
111+
final byte[] decryptedData = CipherHelper.aesDecrypt(encryptedData.getBytes(), aesKey);
112112
if (decryptedData != null) {
113113
return new String(decryptedData);
114114
}

0 commit comments

Comments
 (0)