|
28 | 28 | import com.adyen.model.terminal.security.SecurityTrailer; |
29 | 29 | import com.adyen.terminal.security.exception.NexoCryptoException; |
30 | 30 | import org.apache.commons.codec.binary.Base64; |
31 | | - |
32 | 31 | import javax.crypto.BadPaddingException; |
33 | 32 | import javax.crypto.Cipher; |
34 | 33 | import javax.crypto.IllegalBlockSizeException; |
@@ -64,7 +63,7 @@ public NexoCrypto(SecurityKey securityKey) throws NexoCryptoException { |
64 | 63 | * @param messageHeader the message header for encryption |
65 | 64 | * @return encrypted SaleToPOISecuredMessage |
66 | 65 | */ |
67 | | - public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeader messageHeader) throws GeneralSecurityException { |
| 66 | + public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeader messageHeader) throws Exception { |
68 | 67 | NexoDerivedKey derivedKey = getNexoDerivedKey(); |
69 | 68 | byte[] saleToPoiMessageByteArray = saleToPoiMessageJson.getBytes(StandardCharsets.UTF_8); |
70 | 69 |
|
@@ -100,7 +99,7 @@ public SaleToPOISecuredMessage encrypt(String saleToPoiMessageJson, MessageHeade |
100 | 99 | * @param saleToPoiSecuredMessage the encrypted message |
101 | 100 | * @return the decrypted SaleToPOI message as a JSON string |
102 | 101 | */ |
103 | | - public String decrypt(SaleToPOISecuredMessage saleToPoiSecuredMessage) throws GeneralSecurityException, NexoCryptoException { |
| 102 | + public String decrypt(SaleToPOISecuredMessage saleToPoiSecuredMessage) throws Exception { |
104 | 103 | NexoDerivedKey derivedKey = getNexoDerivedKey(); |
105 | 104 |
|
106 | 105 | // Decode the encrypted blob |
@@ -205,7 +204,7 @@ private byte[] generateRandomIvNonce() { |
205 | 204 | SecureRandom secureRandom; |
206 | 205 | try { |
207 | 206 | secureRandom = SecureRandom.getInstance("NativePRNGNonBlocking"); |
208 | | - } catch (NoSuchAlgorithmException e) { |
| 207 | + } catch (Exception NoSuchAlgorithmException) { |
209 | 208 | // Fallback to default SecureRandom implementation |
210 | 209 | secureRandom = new SecureRandom(); |
211 | 210 | } |
|
0 commit comments