Java 类org.bouncycastle.asn1.x509.GeneralNamesBuilder 实例源码

项目:credhub    文件:CertificateGenerationParameters.java   
private GeneralNames buildAlternativeNames(CertificateGenerationRequestParameters params) {
  String[] alternativeNamesList = params.getAlternativeNames();
  if (alternativeNamesList == null){
    return null;
  }
  GeneralNamesBuilder builder = new GeneralNamesBuilder();

  for (String name :alternativeNamesList) {
    if (InetAddresses.isInetAddress(name)) {
      builder.addName(new GeneralName(GeneralName.iPAddress, name));
    } else  {
      builder.addName(new GeneralName(GeneralName.dNSName, name));
    }
  }
  return builder.build();
}
项目:credhub    文件:SignedCertificateGeneratorTest.java   
private byte[] getExpectedAlternativeNames() throws IOException {
  return new GeneralNamesBuilder()
      .addName(new GeneralName(GeneralName.dNSName, alternateNames[0]))
      .addName(new GeneralName(GeneralName.dNSName, alternateNames[1])).build().getEncoded();
}