mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-05-27 03:55:29 +08:00
GP-0 Corrected Ghidra Server tests to include subject alternative names
This commit is contained in:
+20
-2
@@ -20,7 +20,7 @@ import java.net.*;
|
||||
import java.rmi.registry.LocateRegistry;
|
||||
import java.rmi.registry.Registry;
|
||||
import java.security.KeyStore.PrivateKeyEntry;
|
||||
import java.util.ArrayList;
|
||||
import java.util.*;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipInputStream;
|
||||
@@ -955,7 +955,25 @@ public class ServerTestUtil {
|
||||
TEST_PKI_SERVER_PASSPHRASE + "): " + serverKeystorePath);
|
||||
|
||||
PKIUtils.createKeyEntry("test-sig", TEST_PKI_SERVER_DN, 2, caEntry, serverKeystoreFile,
|
||||
"PKCS12", null, TEST_PKI_SERVER_PASSPHRASE.toCharArray());
|
||||
"PKCS12", getLocalHostnames(), TEST_PKI_SERVER_PASSPHRASE.toCharArray());
|
||||
}
|
||||
|
||||
private static Collection<String> getLocalHostnames() throws SocketException {
|
||||
|
||||
// Collect alternate hostnames for inclusion in certificate
|
||||
Set<String> altNames = new TreeSet<>();
|
||||
Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
|
||||
while (nets.hasMoreElements()) {
|
||||
NetworkInterface netint = nets.nextElement();
|
||||
Enumeration<InetAddress> addrs = netint.getInetAddresses();
|
||||
while (addrs.hasMoreElements()) {
|
||||
InetAddress addr = addrs.nextElement();
|
||||
altNames.add(addr.getHostAddress());
|
||||
altNames.add(addr.getHostName());
|
||||
altNames.add(addr.getCanonicalHostName());
|
||||
}
|
||||
}
|
||||
return altNames;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user