String hostName = windowController.getHostName();
Map urls = ContactUtil.getURLs(hostName);
if (hostName == null || urls == null) {
throw new SignOnException(mh.getMessage("invalid_hostname"));
}
SignOnSessionController mgr = new SignOnSessionController();
mgr.setFirstUrl((String) urls.get(ContactUtil.FIRST_URL));
mgr.setSecondUrl((String) urls.get(ContactUtil.SECOND_URL));
mgr.setLegacyProxy(windowController.isLegacyProxy());
/* valility of term */
long certTerm = -1L;
certTerm = CertTermUtil.checkCertTerm(windowController.getDays(),
windowController.getHours());
mgr.setCertTerm(certTerm);
SSLContext ctx = null;
String cn = (String) windowController.getSubject();
String passphrase = windowController.getPassPhrase();
if (passphrase == null) {
throw new SignOnException(mh.getMessage("passphrase_null"));
}
jp.go.aist.sot.client.security.KeyStore ks = null;
ks = storage.getTrustStore(new SubjectName(null, null),
passphrase.toCharArray());
KeyStore caks = jp.go.aist.sot.client.security.KeyStore.convert(ks);
if (caks == null || caks.size() == 0) {
throw new SignOnException(mh.getMessage("check_trustca"));
}
KeyStore uks = null;
try {
ks = storage.getKeyStore(new SubjectName(cn, null),
passphrase.toCharArray());
uks = jp.go.aist.sot.client.security.KeyStore.convert(ks);
} catch (jp.go.aist.sot.client.security.KeyStoreException e) {
throw new SignOnException(e, mh.getMessage("invalid_passphrase"));
}
if (uks == null || uks.size() == 0) {
throw new SignOnException(mh.getMessage("invalid_passphrase"));
}
PKCS12 pkcs12 = jp.go.aist.sot.client.security.KeyStore.convertKeyStoreToPKCS12(
ks, cn, passphrase.toCharArray());