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(); }
private byte[] getExpectedAlternativeNames() throws IOException { return new GeneralNamesBuilder() .addName(new GeneralName(GeneralName.dNSName, alternateNames[0])) .addName(new GeneralName(GeneralName.dNSName, alternateNames[1])).build().getEncoded(); }