Skip to content

Commit f5e80e1

Browse files
committed
Revert the previous Exception method
1 parent 5af45ad commit f5e80e1

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/main/java/com/adyen/terminal/security/NexoCrypto.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
import com.adyen.model.terminal.security.SecurityTrailer;
2929
import com.adyen.terminal.security.exception.NexoCryptoException;
3030
import org.apache.commons.codec.binary.Base64;
31-
3231
import javax.crypto.BadPaddingException;
3332
import javax.crypto.Cipher;
3433
import javax.crypto.IllegalBlockSizeException;
@@ -64,7 +63,7 @@ public NexoCrypto(SecurityKey securityKey) throws NexoCryptoException {
6463
* @param messageHeader the message header for encryption
6564
* @return encrypted SaleToPOISecuredMessage
6665
*/
67-
public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeader messageHeader) throws GeneralSecurityException {
66+
public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeader messageHeader) throws Exception {
6867
NexoDerivedKey derivedKey = getNexoDerivedKey();
6968
byte[] saleToPoiMessageByteArray = saleToPoiMessageJson.getBytes(StandardCharsets.UTF_8);
7069

@@ -100,7 +99,7 @@ public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeade
10099
* @param saleToPoiSecuredMessage the encrypted message
101100
* @return the decrypted SaleToPOI message as a JSON string
102101
*/
103-
public String decrypt(SaleToPOISecuredMessage saleToPoiSecuredMessage) throws GeneralSecurityException, NexoCryptoException {
102+
public String decrypt(SaleToPOISecuredMessage saleToPoiSecuredMessage) throws Exception {
104103
NexoDerivedKey derivedKey = getNexoDerivedKey();
105104

106105
// Decode the encrypted blob
@@ -205,7 +204,7 @@ private byte[] generateRandomIvNonce() {
205204
SecureRandom secureRandom;
206205
try {
207206
secureRandom = SecureRandom.getInstance("NativePRNGNonBlocking");
208-
} catch (NoSuchAlgorithmException e) {
207+
} catch (Exception NoSuchAlgorithmException) {
209208
// Fallback to default SecureRandom implementation
210209
secureRandom = new SecureRandom();
211210
}

0 commit comments

Comments
 (0)