private static final String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;
private static final SecureRandom random = new SecureRandom();
-
@Autowired
Environment env;
private static final String encrypt(String key, String value) {
try {
-
- byte[] bytesIV = new byte[16];
- random.nextBytes(bytesIV);
- IvParameterSpec iv = new IvParameterSpec(bytesIV);
+ byte[] bytesIV = new byte[12];
+ random.nextBytes(bytesIV);
+ IvParameterSpec iv = new IvParameterSpec(bytesIV);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance(transformation);
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
private static final String decrypt(String key, String encrypted) {
try {
- byte[] bytesIV = new byte[16];
+ byte[] bytesIV = new byte[12];
random.nextBytes(bytesIV);
- IvParameterSpec iv = new IvParameterSpec(bytesIV);
- SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
+ IvParameterSpec iv = new IvParameterSpec(bytesIV);
+ SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance(transformation);
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
byte[] original = cipher.doFinal(Base64.getDecoder().decode(encrypted));
{
"swagger" : "2.0",
"info" : {
- "version" : "2.3.1-SNAPSHOT",
+ "version" : "2.3.2-SNAPSHOT",
"title" : "cmso-optimizer"
},
"basePath" : "/optimizer",
package org.onap.optf.cmso.utilities;
import org.onap.optf.cmso.optimizer.common.PropertiesManagement;
+import static org.junit.Assert.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertAll;
+import org.junit.jupiter.api.Test;
/**
* The Class PropertiesAdmin.
}
System.out.println(args[0] + " : " + value);
}
+ @Test
+ public void testEncryptionDecryption()
+ {
+ String encryptedInputData = PropertiesManagement.getEncryptedValue("Hello");
+ String decryptedData = PropertiesManagement.getDecryptedValue(encryptedInputData);
+ assertEquals(decryptedData,"Hello");
+ }
}
}\r
\r
private static final String encrypt(String key, String value) {\r
- try {\r
- byte[] bytesIV = new byte[16];\r
+ try{\r
+ byte[] bytesIV = new byte[12];\r
random.nextBytes(bytesIV);\r
IvParameterSpec iv = new IvParameterSpec(bytesIV);\r
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");\r
\r
private static final String decrypt(String key, String encrypted) {\r
try {\r
- byte[] bytesIV = new byte[16];\r
- random.nextBytes(bytesIV);\r
+ byte[] bytesIV = new byte[12];\r
+ random.nextBytes(bytesIV);\r
IvParameterSpec iv = new IvParameterSpec(bytesIV);\r
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");\r
Cipher cipher = Cipher.getInstance(transformation);\r
{
"swagger" : "2.0",
"info" : {
- "version" : "2.3.1-SNAPSHOT",
+ "version" : "2.3.2-SNAPSHOT",
"title" : "cmso-service"
},
"basePath" : "/cmso",
"format" : "int32",
"description" : "Maximum number of VNF changes to schedule concurrently"
},
- "changeWindows" : {
- "type" : "array",
- "description" : "Lists of desired change windows to schedule the elements.",
- "items" : {
- "$ref" : "#/definitions/Change Window"
- }
- },
- "policies" : {
- "type" : "array",
- "description" : "List of the policies to control optimization.",
- "items" : {
- "$ref" : "#/definitions/Supported Policy Information"
- }
+ "policyId" : {
+ "type" : "string",
+ "description" : "Name of schedule optimization policy used by the change management cmso optimizer to determine available time slot"
},
- "elements" : {
+ "vnfDetails" : {
"type" : "array",
"description" : "Lists of the VNFs to be changed and the desired change windows",
"items" : {
- "$ref" : "#/definitions/Optimizer Element"
+ "$ref" : "#/definitions/VNF Details"
}
}
},
"properties" : {
"startTime" : {
"type" : "string",
- "format" : "date-time",
- "description" : "Earliest time for which changes may begin."
+ "description" : "Earliest time that a set of changes may begin."
},
"endTime" : {
"type" : "string",
- "format" : "date-time",
- "description" : "Latest time by which all changes must be completed."
+ "description" : "Latest time by which all changes must be completed"
}
},
- "description" : "Time window for which tickets are to returned"
+ "description" : "Time window within which the scheduler optimizer can schedule the changes for the group of NVFs"
},
"CmDetailsMessage" : {
"type" : "object",
private static final String encrypt(String key, String value) {
try {
- byte[] bytesIV = new byte[16];
- random.nextBytes(bytesIV);
- IvParameterSpec iv = new IvParameterSpec(bytesIV);
+ byte[] bytesIV = new byte[12];
+ random.nextBytes(bytesIV);
+ IvParameterSpec iv = new IvParameterSpec(bytesIV);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance(transformation);
cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
private static final String decrypt(String key, String encrypted) {
try {
-
- byte[] bytesIV = new byte[16];
- random.nextBytes(bytesIV);
+ byte[] bytesIV = new byte[12];
+ random.nextBytes(bytesIV);
IvParameterSpec iv = new IvParameterSpec(bytesIV);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance(transformation);
{
"swagger" : "2.0",
"info" : {
- "version" : "2.3.1-SNAPSHOT",
+ "version" : "2.3.2-SNAPSHOT",
"title" : "cmso-ticketmgt"
},
"basePath" : "/ticketmgt",
private static final String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;
private static final SecureRandom random = new SecureRandom();
+
@Autowired
Environment env;
private static final String encrypt(String key, String value) {
try {
- byte[] bytesIV = new byte[16];
+ byte[] bytesIV = new byte[12];
random.nextBytes(bytesIV);
IvParameterSpec iv = new IvParameterSpec(bytesIV);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
private static final String decrypt(String key, String encrypted) {
try {
- byte[] bytesIV = new byte[16];
+ byte[] bytesIV = new byte[12];
random.nextBytes(bytesIV);
- IvParameterSpec iv = new IvParameterSpec(bytesIV);
+ IvParameterSpec iv = new IvParameterSpec(bytesIV);
SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes("UTF-8"), "AES");
Cipher cipher = Cipher.getInstance(transformation);
cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
{
"swagger" : "2.0",
"info" : {
- "version" : "2.3.1-SNAPSHOT",
+ "version" : "2.3.2-SNAPSHOT",
"title" : "cmso-topology"
},
"basePath" : "/topology",