[MSO-8] Update the maven dependency
[so.git] / bpmn / MSOCommonBPMN / src / main / java / org / openecomp / mso / bpmn / common / util / CryptoHandler.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * OPENECOMP - MSO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.mso.bpmn.common.util;
22
23 import java.security.GeneralSecurityException;
24
25 public class CryptoHandler implements ICryptoHandler {
26
27         private static String msoKey = "aa3871669d893c7fb8abbcda31b88b4f";
28         //private static String msoAaiPwd = "mso0206";
29         private static String msoAaiEncryptedPwd = "C1FC4A39E16419DD41DFC1212843F440";
30
31         public String getMsoAaiPassword() {
32                 try {
33                         return CryptoUtils.decrypt(msoAaiEncryptedPwd, msoKey);
34                 } catch (GeneralSecurityException e) {
35                         return null;
36                 }
37         }
38
39
40         public String encryptMsoPassword(String plainMsoPwd) {
41                 try {
42                         return CryptoUtils.encrypt(plainMsoPwd, msoKey);
43                 } catch (GeneralSecurityException e) {
44                         return null;
45                 }
46         }
47
48
49         public String decryptMsoPassword(String encryptedPwd) {
50                 try {
51                         return CryptoUtils.decrypt(encryptedPwd, msoKey);
52                 } catch (GeneralSecurityException e) {
53                         return null;
54                 }
55         }
56
57 }