use of org.xipki.common.ConfPairs in project xipki by xipki.
the class HttpsHostnameVerifier method setCommonnameHostMap.
public void setCommonnameHostMap(String commonnameHostMap) {
hostnameMap.clear();
if (StringUtil.isBlank(commonnameHostMap)) {
return;
}
ConfPairs pairs = new ConfPairs(commonnameHostMap);
Set<String> commonNames = pairs.names();
for (String commonName : commonNames) {
String str = pairs.value(commonName);
Set<String> hosts = StringUtil.splitAsSet(str, ",; \t");
hostnameMap.put(commonName, hosts);
}
}
use of org.xipki.common.ConfPairs in project xipki by xipki.
the class P12CertUpdateCmd method assertMatch.
private void assertMatch(X509Certificate cert, String password) throws ObjectCreationException {
ConfPairs pairs = new ConfPairs("keystore", "file:" + p12File);
if (password != null) {
pairs.putPair("password", new String(password));
}
SignerConf conf = new SignerConf(pairs.getEncoded(), HashAlgo.SHA256, null);
securityFactory.createSigner("PKCS12", conf, cert);
}
use of org.xipki.common.ConfPairs in project xipki by xipki.
the class DemoX509Certprofile method getExtraExtensions.
@Override
public ExtensionValues getExtraExtensions(Map<ASN1ObjectIdentifier, ExtensionControl> extensionOccurences, X500Name requestedSubject, X500Name grantedSubject, Extensions requestedExtensions, Date notBefore, Date notAfter, PublicCaInfo caInfo) throws CertprofileException, BadCertTemplateException {
ExtensionValues extnValues = new ExtensionValues();
if (addCaExtraControl) {
ASN1ObjectIdentifier type = id_demo_ca_extra_control;
ExtensionControl extnControl = extensionOccurences.get(type);
if (extnControl != null) {
ConfPairs caExtraControl = caInfo.getExtraControl();
String name = "name-a";
String value = null;
if (caExtraControl != null) {
value = caExtraControl.value(name);
}
if (value == null) {
value = "UNDEF";
}
ExtensionValue extnValue = new ExtensionValue(extnControl.isCritical(), new DERUTF8String(name + ": " + value));
extnValues.addExtension(type, extnValue);
}
}
if (addSequence) {
ASN1ObjectIdentifier type = id_demo_other_namespace;
ExtensionControl extnControl = extensionOccurences.get(type);
if (extnControl != null) {
if (sequence == null) {
throw new IllegalStateException("CertProfile is not initialized");
}
ExtensionValue extnValue = new ExtensionValue(extnControl.isCritical(), sequence);
extnValues.addExtension(type, extnValue);
}
}
return extnValues.size() == 0 ? null : extnValues;
}
use of org.xipki.common.ConfPairs in project xipki by xipki.
the class ConfPairsTest method test7.
@Test
public void test7() {
ConfPairs pairs = new ConfPairs("key-a=value-a\\=\\?");
String expEncoded = "key-a=value-a\\=?";
Map<String, String> expNameValues = new HashMap<>();
expNameValues.put("key-a", "value-a=?");
check(pairs, expEncoded, expNameValues);
}
use of org.xipki.common.ConfPairs in project xipki by xipki.
the class ConfPairsTest method test2.
@Test
public void test2() {
ConfPairs pairs = new ConfPairs("key-a=value-a");
String expEncoded = "key-a=value-a";
Map<String, String> expNameValues = new HashMap<>();
expNameValues.put("key-a", "value-a");
check(pairs, expEncoded, expNameValues);
}
Aggregations