return eSsl;
}
static SSLReq getSslReq(Element eSsl) {
SSLReqBean out = new SSLReqBean();
Elements eChildren = eSsl.getChildElements();
for(int i=0; i<eChildren.size(); i++) {
Element e = eChildren.get(i);
final String name = e.getLocalName();
if(null != name) switch (name) {
case "trust-self-signed-cert":
out.setTrustSelfSignedCert(true);
break;
case "hostname-verifier":
out.setHostNameVerifier(SSLHostnameVerifier.valueOf(e.getValue()));
break;
case "keystore":
final SSLKeyStoreBean keyStore = new SSLKeyStoreBean();
{ // type:
final String typeStr = e.getAttributeValue("type");
if(StringUtil.isNotEmpty(typeStr))
keyStore.setType(KeyStoreType.valueOf(typeStr));
}
keyStore.setFile(new File(e.getAttributeValue("file")));
keyStore.setPassword(Util.base64decode(e.getAttributeValue("password")).toCharArray());
out.setKeyStore(keyStore);
break;
case "truststore":
final SSLKeyStoreBean trustStore = new SSLKeyStoreBean();
{ // type:
final String typeStr = e.getAttributeValue("type");
if(StringUtil.isNotEmpty(typeStr))
trustStore.setType(KeyStoreType.valueOf(typeStr));
}
trustStore.setFile(new File(e.getAttributeValue("file")));
trustStore.setPassword(Util.base64decode(e.getAttributeValue("password")).toCharArray());
out.setTrustStore(trustStore);
break;
}
}
return out;