aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjhh <jorge.hernandez-herrero@att.com>2019-10-16 21:25:57 -0500
committerjhh <jorge.hernandez-herrero@att.com>2019-10-16 21:29:57 -0500
commit824468c9138700f046e35e1faaf6dc78eef5d98d (patch)
tree4ec35bab05ece265e5a8ae00ca3d2cef7f2c27b9
parent00ab9f38e08643acda3b560e01236ced0d77d5c2 (diff)
Removed unthrown checked exceptions from CryptoUtils.
additional minor javadoc clean up Issue-ID: POLICY-1945 Signed-off-by: jhh <jorge.hernandez-herrero@att.com> Change-Id: I23927b8c4dd63ed658e8062c87b4884ea1d31825
-rw-r--r--utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java13
1 files changed, 3 insertions, 10 deletions
diff --git a/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java b/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
index 94b367ec..69d257ec 100644
--- a/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
+++ b/utils/src/main/java/org/onap/policy/common/utils/security/CryptoUtils.java
@@ -21,7 +21,6 @@
package org.onap.policy.common.utils.security;
import java.nio.charset.StandardCharsets;
-import java.security.GeneralSecurityException;
import java.util.Random;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
@@ -90,10 +89,8 @@ public class CryptoUtils {
* @param value
* The plain text string
* @return The encrypted String
- * @throws GeneralSecurityException
- * In case of issue with the encryption
*/
- public String encrypt(String value) throws GeneralSecurityException {
+ public String encrypt(String value) {
return encryptValue(value, secretKeySpec);
}
@@ -142,10 +139,8 @@ public class CryptoUtils {
* @param value
* The encrypted string that must be decrypted using the Policy Encryption Key
* @return The String decrypted if string begin with 'enc:'
- * @throws GeneralSecurityException
- * In case of issue with the encryption
*/
- public String decrypt(String value) throws GeneralSecurityException {
+ public String decrypt(String value) {
return decryptValue(value, secretKeySpec);
}
@@ -198,8 +193,6 @@ public class CryptoUtils {
* @param keyString
* The key as a string in base64 String
* @return The SecretKeySpec created
- * @throws DecoderException
- * In case of issues with the decoding of base64 String
*/
private static SecretKeySpec getSecretKeySpec(String keyString) {
byte[] key = DatatypeConverter.parseBase64Binary(keyString);
@@ -215,7 +208,7 @@ public class CryptoUtils {
*/
private static SecretKeySpec readSecretKeySpec(String secretKey) {
if (secretKey != null && !secretKey.isEmpty()) {
- SecretKeySpec keySpec = null;
+ SecretKeySpec keySpec;
try {
keySpec = getSecretKeySpec(secretKey);
return keySpec;