@Override public String value(String name) { return underlying.value(name); }
@Override public String value(String name) { return underlying.value(name); }
public String getConfValue(String name) { return confPairs.value(name); }
public static CertRevocationInfo fromEncoded(String encoded) { ConfPairs pairs = new ConfPairs(encoded); CrlReason reason = CrlReason.forNameOrText(pairs.value("reason")); Date revocationTime = new Date(1000L * Long.parseLong(pairs.value("revocationTime"))); String str = pairs.value("invalidityTime"); Date invalidityTime = null; if (str != null) { invalidityTime = new Date(1000L * Long.parseLong(pairs.value("invalidityTime"))); } return new CertRevocationInfo(reason, revocationTime, invalidityTime); }
private static int getInteger(ConfPairs props, String propKey, int dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { try { return Integer.parseInt(str.trim()); } catch (NumberFormatException ex) { throw new InvalidConfException(propKey + " does not have numeric value: " + str); } } return dfltValue; }
private static int getInteger(ConfPairs props, String propKey, int dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { try { return Integer.parseInt(str.trim()); } catch (NumberFormatException ex) { throw new InvalidConfException(propKey + " does not have numeric value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static boolean getBoolean(ConfPairs props, String propKey, boolean dfltValue) throws InvalidConfException { String str = props.value(propKey); if (str != null) { str = str.trim(); if ("true".equalsIgnoreCase(str)) { return Boolean.TRUE; } else if ("false".equalsIgnoreCase(str)) { return Boolean.FALSE; } else { throw new InvalidConfException(propKey + " does not have boolean value: " + str); } } return dfltValue; }
private static int getInt(ConfPairs pairs, String key, int defaultValue) { String str = pairs.value(key); int ret = StringUtil.isBlank(str) ? defaultValue : Integer.parseInt(str); pairs.putPair(key, Integer.toString(ret)); return ret; }
public static CaUris decode(String encoded) { ConfPairs pairs = new ConfPairs(encoded); return new CaUris( StringUtil.split(pairs.value(NAME_CACERT_URIS), "|"), StringUtil.split(pairs.value(NAME_OCSP_URIS), "|"), StringUtil.split(pairs.value(NAME_CRL_URIS), "|"), StringUtil.split(pairs.value(NAME_DELTACRL_URIS), "|")); }
private static boolean getBoolean(ConfPairs pairs, String key, boolean defaultValue) { String str = pairs.value(key); boolean ret = StringUtil.isBlank(str) ? defaultValue : Boolean.parseBoolean(str); pairs.putPair(key, Boolean.toString(ret)); return ret; }
private static int getInt(ConfPairs pairs, String key, int defaultValue) { String str = pairs.value(key); int ret = StringUtil.isBlank(str) ? defaultValue : Integer.parseInt(str); pairs.putPair(key, Integer.toString(ret)); return ret; }
private static boolean getBoolean(ConfPairs pairs, String key, boolean defaultValue) { String str = pairs.value(key); boolean ret = StringUtil.isBlank(str) ? defaultValue : Boolean.parseBoolean(str); pairs.putPair(key, Boolean.toString(ret)); return ret; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof ConfPairs)) { return false; } ConfPairs other = (ConfPairs) obj; Set<String> thisNames = names(); Set<String> otherNames = other.names(); if (!thisNames.equals(otherNames)) { return false; } for (String name : thisNames) { if (!CompareUtil.equalsObject(value(name), other.value(name))) { return false; } } return true; }
@Override public boolean equals(Object obj) { if (this == obj) { return true; } else if (!(obj instanceof ConfPairs)) { return false; } ConfPairs other = (ConfPairs) obj; Set<String> thisNames = names(); Set<String> otherNames = other.names(); if (!thisNames.equals(otherNames)) { return false; } for (String name : thisNames) { if (!CompareUtil.equalsObject(value(name), other.value(name))) { return false; } } return true; }
public static String eraseSensitiveData(String conf) { if (conf == null || !conf.toLowerCase().contains("password")) { return conf; } try { ConfPairs pairs = new ConfPairs(conf); for (String name : pairs.names()) { if (name.toLowerCase().contains("password")) { String value = pairs.value(name); if (value != null && !StringUtil.startsWithIgnoreCase(value, "PBE:")) { pairs.putPair(name, "<sensitive>"); } } } return pairs.getEncoded(); } catch (Exception ex) { return conf; } }
public static AccessDescription createAccessDescription(String accessMethodAndLocation) throws BadInputException { Args.notNull(accessMethodAndLocation, "accessMethodAndLocation"); ConfPairs pairs; try { pairs = new ConfPairs(accessMethodAndLocation); } catch (IllegalArgumentException ex) { throw new BadInputException("invalid accessMethodAndLocation " + accessMethodAndLocation); } Set<String> oids = pairs.names(); if (oids == null || oids.size() != 1) { throw new BadInputException("invalid accessMethodAndLocation " + accessMethodAndLocation); } String accessMethodS = oids.iterator().next(); String taggedValue = pairs.value(accessMethodS); ASN1ObjectIdentifier accessMethod = new ASN1ObjectIdentifier(accessMethodS); GeneralName location = createGeneralName(taggedValue); return new AccessDescription(accessMethod, location); }
@Override public void init(String conf) throws PasswordResolverException { Args.notBlank(conf, "conf"); ConfPairs pairs = new ConfPairs(conf); passwordFile = pairs.value("file"); if (StringUtil.isBlank(passwordFile)) { throw new PasswordResolverException("invalid configuration " + conf + ", no file is specified"); } passwordFile = IoUtil.expandFilepath(passwordFile); }