private static GeneralNames getSubjectAlternativeNames() {
    final List<GeneralName> hostGeneralNames =
        sanHostNames.stream()
            .map(hostName -> new GeneralName(GeneralName.dNSName, hostName))
            .collect(Collectors.toList());
    final List<GeneralName> ipGeneralNames =
        sanIpAddresses.stream()
            .map(ipAddress -> new GeneralName(GeneralName.iPAddress, ipAddress))
            .collect(Collectors.toList());
    final GeneralName[] generalNames =
        Stream.of(hostGeneralNames, ipGeneralNames)
            .flatMap(Collection::stream)
            .toArray(GeneralName[]::new);

    return new GeneralNames(generalNames);
  }
Utility class to generate temporary self-signed certificates in PKCS12 format for testing
purposes using BouncyCastle APIs. The generated certificate supports SAN extension for multiple
DNS and IP addresses

<p>Note: DO NOT USE IN PRODUCTION. The generated stores and files are marked to be deleted on JVM
exit.
ethereum/api/src/test-support/java/org/hyperledger/besu/ethereum/api/tls/SelfSignedP12Certificate.java