private String getValue(FileOrValue fileOrValue, Map<String, byte[]> zipEntries) throws IOException { if (fileOrValue == null) { return null; } if (fileOrValue.getValue() != null) { return expandConf(fileOrValue.getValue()); } String fileName = fileOrValue.getFile(); byte[] binary = zipEntries.get(fileName); if (binary == null) { throw new IOException("could not find ZIP entry " + fileName); } return expandConf(new String(binary, "UTF-8")); }
private String getBase64Binary(FileOrBinary fileOrBinary, Map<String, byte[]> zipEntries) throws IOException { byte[] binary = getBinary(fileOrBinary, zipEntries); return (binary == null) ? null : Base64.encodeToString(binary); }
conf = new CaConf(zippedConfStream, securityFactory); } catch (IOException | InvalidConfException ex) { throw new CaMgmtException("could not parse the CA configuration", ex); for (String name : conf.getSignerNames()) { MgmtEntry.Signer entry = conf.getSigner(name); MgmtEntry.Signer entryB = signerDbEntries.get(name); if (entryB != null) { for (String name : conf.getRequestorNames()) { MgmtEntry.Requestor entry = conf.getRequestor(name); MgmtEntry.Requestor entryB = requestorDbEntries.get(name); if (entryB != null) { for (String name : conf.getPublisherNames()) { MgmtEntry.Publisher entry = conf.getPublisher(name); MgmtEntry.Publisher entryB = publisherDbEntries.get(name); if (entryB != null) { for (String name : conf.getCertprofileNames()) { MgmtEntry.Certprofile entry = conf.getCertprofile(name); MgmtEntry.Certprofile entryB = certprofileDbEntries.get(name); if (entryB != null) { for (String name : conf.getUserNames()) { Object obj = conf.getUser(name); MgmtEntry.User entryB = queryExecutor.getUser(name, true); for (String caName : conf.getCaNames()) {
MgmtEntry.Signer en = new MgmtEntry.Signer(m.getName(), expandConf(m.getType()), getValue(m.getConf(), zipEntries), getBase64Binary(m.getCert(), zipEntries)); addSigner(en); String conf; if (m.getConf() != null) { conf = getValue(m.getConf(), zipEntries); } else { conf = getBase64Binary(m.getBinaryConf(), zipEntries); addRequestor(en); MgmtEntry.AddUser en = new MgmtEntry.AddUser(new NameId(null, m.getName()), active, password); addUser(en); } else { MgmtEntry.User en = new MgmtEntry.User(new NameId(null, m.getName()), active, m.getHashedPassword()); addUser(en); for (CaConfType.NameTypeConf m : root.getPublishers()) { MgmtEntry.Publisher en = new MgmtEntry.Publisher(new NameId(null, m.getName()), expandConf(m.getType()), getValue(m.getConf(), zipEntries)); addPublisher(en); for (CaConfType.NameTypeConf m : root.getProfiles()) { MgmtEntry.Certprofile en = new MgmtEntry.Certprofile(new NameId(null, m.getName()), expandConf(m.getType()), getValue(m.getConf(), zipEntries)); addProfile(en);