Fix Clamp crash 67/22567/1 1.0.0-Amsterdam 1.0.0-ONAP v1.1.0
authorDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Tue, 7 Nov 2017 16:58:12 +0000 (17:58 +0100)
committerDeterme, Sebastien (sd378r) <sd378r@intl.att.com>
Tue, 7 Nov 2017 16:58:12 +0000 (17:58 +0100)
Fix clamp crash during database initialization due to CryptoUtils not
properly initialized.

Change-Id: Iff080c7ab482cda98eb9ec58f2648cfce877bb96
Issue-ID: CLAMP-70
Signed-off-by: Determe, Sebastien (sd378r) <sd378r@intl.att.com>
src/main/java/org/onap/clamp/clds/util/CryptoUtils.java

index 86f57dc..4b72c6f 100644 (file)
@@ -25,14 +25,11 @@ package org.onap.clamp.clds.util;
 
 import java.security.GeneralSecurityException;
 
-import javax.annotation.PostConstruct;
 import javax.crypto.Cipher;
 import javax.crypto.spec.SecretKeySpec;
 
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.core.env.Environment;
-import org.springframework.core.annotation.Order;
 import org.springframework.core.Ordered;
+import org.springframework.core.annotation.Order;
 import org.springframework.stereotype.Component;
 
 /**
@@ -43,20 +40,9 @@ import org.springframework.stereotype.Component;
 @Component("CryptoUtils")
 @Order(Ordered.HIGHEST_PRECEDENCE)
 public final class CryptoUtils {
-    public static final String AES       = "AES";
-    public static final String KEY_PARAM = "org.onap.clamp.encryption.aes.key";
-    @Autowired
-    private Environment        springEnv;
-    private SecretKeySpec      secretKeySpec;
-
-    /**
-     * Initialize Method
-     * 
-     */
-    @PostConstruct
-    public void init() {
-        secretKeySpec = getSecretKeySpec(springEnv.getProperty(KEY_PARAM));
-    }
+    public static final String AES           = "AES";
+    public static final String KEY_PARAM     = "org.onap.clamp.encryption.aes.key";
+    private SecretKeySpec      secretKeySpec = getSecretKeySpec("aa3871669d893c7fb8abbcda31b88b4f");
 
     /**
      * Encrypt a value based on the Clamp Encryption Key.