summaryrefslogtreecommitdiffstats
path: root/cadi
diff options
context:
space:
mode:
authorInstrumental <jonathan.gathman@att.com>2018-10-23 17:40:47 -0500
committerInstrumental <jonathan.gathman@att.com>2018-10-23 17:43:09 -0500
commit9fe1153c6bad63922e026d1db86e51b95a92c6cc (patch)
tree4e48cbbbb3c9e5f1a37c6089726490ea24c601f7 /cadi
parent50245adc23b914bc627925cf8557948f25927a5b (diff)
Client updates
Issue-ID: AAF-558 Change-Id: I2c12b3cf46924b784e3af54bb643e6341dadf165 Signed-off-by: Instrumental <jonathan.gathman@att.com>
Diffstat (limited to 'cadi')
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java4
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java9
-rw-r--r--cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java24
3 files changed, 21 insertions, 16 deletions
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
index f4651eca..3facc930 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/Agent.java
@@ -146,7 +146,7 @@ public class Agent {
public Properties process(String[] args, Properties props) {
if (args.length>1) {
if (!args[0].equals("keypairgen")) {
- props.put("aaf_id", args[1]);
+ props.put(Config.AAF_APPID, args[1]);
}
}
return props;
@@ -758,7 +758,7 @@ public class Agent {
cred.addEnc(Config.AAF_APPPASS, pa, null);
app.add(Config.AAF_LOCATE_URL, pa, null);
- app.add(Config.AAF_APPID, pa, fqi);
+ app.add(Config.AAF_APPID, fqi);
app.add(Config.AAF_URL, pa, Defaults.AAF_URL);
String cts = pa.getProperty(Config.CADI_TRUSTSTORE);
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
index 4525b8da..7256af40 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PlaceArtifactInKeystore.java
@@ -50,7 +50,8 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
@Override
public boolean _place(Trans trans, CertInfo certInfo, Artifact arti) throws CadiException {
- File fks = new File(dir,arti.getNs()+'.'+(kst==Agent.PKCS12?"p12":kst));
+ final String ext = (kst==Agent.PKCS12?"p12":kst);
+ File fks = new File(dir,arti.getNs()+'.'+ext);
try {
KeyStore jks = KeyStore.getInstance(kst);
if (fks.exists()) {
@@ -86,7 +87,11 @@ public class PlaceArtifactInKeystore extends ArtifactDir {
// Set Keystore Password
props.add(Config.CADI_KEYSTORE,fks.getAbsolutePath());
String keystorePass = Symm.randomGen(Agent.PASS_SIZE);
- props.addEnc(Config.CADI_KEYSTORE_PASSWORD,keystorePass);
+ String encP = props.addEnc(Config.CADI_KEYSTORE_PASSWORD,keystorePass);
+ // Since there are now more than one Keystore type, the keystore password property might
+ // be overwritten, making the store useless without key. So we write it specifically
+ // as well.
+ props.add(Config.CADI_KEYSTORE_PASSWORD+'_'+ext,encP);
char[] keystorePassArray = keystorePass.toCharArray();
jks.load(null,keystorePassArray); // load in
diff --git a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
index 7feacb89..0f9666ca 100644
--- a/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
+++ b/cadi/aaf/src/main/java/org/onap/aaf/cadi/configure/PropHolder.java
@@ -31,7 +31,6 @@ import java.util.TreeMap;
import org.onap.aaf.cadi.Access;
import org.onap.aaf.cadi.Symm;
-import org.onap.aaf.cadi.config.Config;
import org.onap.aaf.cadi.util.Chmod;
import org.onap.aaf.misc.env.util.Chrono;
@@ -93,27 +92,28 @@ public class PropHolder {
return keyfile.getAbsolutePath();
}
- public void add(final String tag, final String value) {
- if(value==null) {
- props.put(tag,"");
- } else {
- props.put(tag, value);
- }
+ public String add(final String tag, final String value) {
+ final String rv = value==null?"":value;
+ props.put(tag, rv);
+ return rv;
}
- public void add(final String tag, Access orig, final String def) {
- add(tag, orig.getProperty(tag, def));
+ public String add(final String tag, Access orig, final String def) {
+ return add(tag, orig.getProperty(tag, def));
}
- public void addEnc(final String tag, final String value) throws IOException {
+ public String addEnc(final String tag, final String value) throws IOException {
+ String rv;
if(value==null) {
- props.put(tag,"");
+ rv = "";
} else {
if(symm==null) { // Lazy Instantiations... on a few PropFiles have Security
symm = ArtifactDir.getSymm(keyfile);
}
- props.put(tag, "enc:"+symm.enpass(value));
+ rv = "enc:"+symm.enpass(value);
}
+ props.put(tag, rv);
+ return rv;
}
public void addEnc(final String tag, Access orig, final String def) throws IOException {