public List<char[]> getPasswords(PasswordResolver passwordResolver) throws PasswordResolverException { if (passwords == null) { return null; } List<char[]> ret = new ArrayList<char[]>(passwords.size()); for (String password : passwords) { if (passwordResolver == null) { ret.add(password.toCharArray()); } else { ret.add(passwordResolver.resolvePassword(password)); } } return ret; }
@Override public void addRequestor(MgmtEntry.Requestor requestorEntry) throws CaMgmtException { Args.notNull(requestorEntry, "requestorEntry"); asssertMasterMode(); String name = requestorEntry.getIdent().getName(); if (requestorDbEntries.containsKey(name)) { throw new CaMgmtException(concat("Requestor named ", name, " exists")); } // encrypt the password PasswordResolver pwdResolver = securityFactory.getPasswordResolver(); if (MgmtEntry.Requestor.TYPE_PBM.equalsIgnoreCase(requestorEntry.getType())) { String conf = requestorEntry.getConf(); if (!StringUtil.startsWithIgnoreCase(conf, "PBE:")) { String encryptedPassword; try { encryptedPassword = pwdResolver.protectPassword("PBE", conf.toCharArray()); } catch (PasswordResolverException ex) { throw new CaMgmtException("could not encrypt requestor " + name, ex); } requestorEntry = new MgmtEntry.Requestor(requestorEntry.getIdent(), requestorEntry.getType(), encryptedPassword); } } RequestorEntryWrapper requestor = new RequestorEntryWrapper(); requestor.setDbEntry(requestorEntry, pwdResolver); queryExecutor.addRequestor(requestorEntry); idNameMap.addRequestor(requestorEntry.getIdent()); requestorDbEntries.put(name, requestorEntry); requestors.put(name, requestor); } // method addRequestor
RequestorEntryWrapper changeRequestor(NameId nameId, String type, String conf, PasswordResolver passwordResolver) throws CaMgmtException { Args.notNull(nameId, "nameId"); RequestorEntryWrapper requestor = new RequestorEntryWrapper(); if (MgmtEntry.Requestor.TYPE_PBM.equalsIgnoreCase(type)) { if (!StringUtil.startsWithIgnoreCase(conf, "PBE:")) { try { conf = passwordResolver.protectPassword("PBE", conf.toCharArray()); } catch (PasswordResolverException ex) { throw new CaMgmtException("could not encrypt requestor " + nameId.getName(), ex); } } } requestor.setDbEntry(new MgmtEntry.Requestor(nameId, type, conf), passwordResolver); if (requestor.getDbEntry().isFaulty()) { throw new CaMgmtException("invalid requestor configuration"); } changeIfNotNull("REQUESTOR", col(INT, "ID", nameId.getId()), col(STRING, "TYPE", type), col(STRING, "CONF", conf)); return requestor; } // method changeRequestor
public List<char[]> getPasswords(PasswordResolver passwordResolver) throws PasswordResolverException { if (passwords == null) { return null; } List<char[]> ret = new ArrayList<char[]>(passwords.size()); for (String password : passwords) { if (passwordResolver == null) { ret.add(password.toCharArray()); } else { ret.add(passwordResolver.resolvePassword(password)); } } return ret; }
public List<char[]> getPasswords(final PasswordResolver passwordResolver) throws PasswordResolverException { if (passwords == null) { return null; } List<char[]> ret = new ArrayList<char[]>(passwords.size()); for (String password : passwords) { if (passwordResolver == null) { ret.add(password.toCharArray()); } else { ret.add(passwordResolver.resolvePassword(password)); } } return ret; }
password = new String(passwordResolver.resolvePassword(password));
if (password != null) { if (passwordResolver != null) { password = new String(passwordResolver.resolvePassword(password)); if (password != null) { if (passwordResolver != null) { password = new String(passwordResolver.resolvePassword(password));
password = passwordHint.toCharArray(); } else { password = passwordResolver.resolvePassword(passwordHint);
password = passwordHint.toCharArray(); } else { password = passwordResolver.resolvePassword(passwordHint);
public void setDbEntry(MgmtEntry.Requestor dbEntry, PasswordResolver passwordResolver) { this.dbEntry = Args.notNull(dbEntry, "dbEntry"); String type = dbEntry.getType(); String conf = dbEntry.getConf(); dbEntry.setFaulty(true); if (MgmtEntry.Requestor.TYPE_CERT.equalsIgnoreCase(type)) { try { X509Certificate x509Cert = X509Util.parseCert(conf.getBytes()); dbEntry.setFaulty(false); this.cert = new CertWithDbId(x509Cert); } catch (CertificateException ex) { LogUtil.error(LOG, ex, "error while parsing certificate of requestor" + dbEntry.getIdent()); } } else if (MgmtEntry.Requestor.TYPE_PBM.equalsIgnoreCase(type)) { try { this.keyId = HashAlgo.SHA1.hash(dbEntry.getIdent().getName().getBytes("UTF-8")); this.password = passwordResolver.resolvePassword(conf); dbEntry.setFaulty(false); } catch (PasswordResolverException | UnsupportedEncodingException ex) { LogUtil.error(LOG, ex, "error while resolve password of requestor" + dbEntry.getIdent()); } } }
char[] password = securityFactory.getPasswordResolver().resolvePassword(passwordHint); ksBytes = securityFactory.extractMinimalKeyStore(keystoreType, ksBytes, keyLabel, password, certChain);
} else { try { password = passwordResolver.resolvePassword(passwordHint); } catch (PasswordResolverException ex) { throw new ObjectCreationException(
} else { try { password = passwordResolver.resolvePassword(passwordHint); } catch (PasswordResolverException ex) { throw new ObjectCreationException(