-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add interfaces to hide implementation details more
- Loading branch information
Showing
52 changed files
with
994 additions
and
927 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
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
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
29 changes: 29 additions & 0 deletions
29
src/main/java/nl/ictu/service/crypto/AesGcmCryptographerService.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,29 @@ | ||
package nl.ictu.service.crypto; | ||
|
||
import javax.crypto.BadPaddingException; | ||
import javax.crypto.IllegalBlockSizeException; | ||
import javax.crypto.NoSuchPaddingException; | ||
import javax.crypto.SecretKey; | ||
import java.security.InvalidAlgorithmParameterException; | ||
import java.security.InvalidKeyException; | ||
import java.security.NoSuchAlgorithmException; | ||
|
||
public interface AesGcmCryptographerService { | ||
String encrypt(String plaintext, String salt) | ||
throws IllegalBlockSizeException, | ||
BadPaddingException, | ||
InvalidAlgorithmParameterException, | ||
InvalidKeyException, | ||
NoSuchAlgorithmException, | ||
NoSuchPaddingException; | ||
|
||
SecretKey createSecretKey(String salt); | ||
|
||
String decrypt(String ciphertextWithIv, String salt) | ||
throws NoSuchPaddingException, | ||
NoSuchAlgorithmException, | ||
InvalidAlgorithmParameterException, | ||
InvalidKeyException, | ||
IllegalBlockSizeException, | ||
BadPaddingException; | ||
} |
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
18 changes: 18 additions & 0 deletions
18
src/main/java/nl/ictu/service/crypto/AesGcmSivCryptographerService.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,18 @@ | ||
package nl.ictu.service.crypto; | ||
|
||
import lombok.SneakyThrows; | ||
import nl.ictu.model.Identifier; | ||
import org.bouncycastle.crypto.InvalidCipherTextException; | ||
import org.bouncycastle.crypto.params.AEADParameters; | ||
|
||
import java.io.IOException; | ||
|
||
public interface AesGcmSivCryptographerService { | ||
AEADParameters createSecretKey(String salt); | ||
|
||
String encrypt(Identifier identifier, String salt) | ||
throws InvalidCipherTextException, IOException; | ||
|
||
@SneakyThrows | ||
Identifier decrypt(String ciphertextString, String salt); | ||
} |
Oops, something went wrong.