我正在尝试从 name="KeyStorePath" 属性中检索值,该属性位于“Set”元素内。见下文:
<?xml version="1.0" encoding="UTF-8"?>
<!-- ============================================================= --><!-- SSL ContextFactory configuration --><!-- ============================================================= --><!--
To configure Includes / Excludes for Cipher Suites or Protocols see tweak-ssl.xml example at
https://www.eclipse.org/jetty/documentation/current/configuring-ssl.html#configuring-sslcontextfactory-cipherSuites
--><!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_3.dtd">
<Configure class="org.eclipse.jetty.util.ssl.SslContextFactory$Server" id="sslContextFactory">
<!-- Eliminate Old / Insecure / Anonymous Ciphers -->
<Call name="addExcludeCipherSuites">
<Arg>
<Array type="String">
<Item>.*NULL.*</Item>
<Item>.*RC4.*</Item>
<Item>.*MD5.*</Item>
<Item>.*DES.*</Item>
<Item>.*DSS.*</Item>
</Array>
</Arg>
</Call>
<!-- Eliminate Insecure Protocols -->
<Call name="addExcludeProtocols">
<Arg>
<Array type="java.lang.String">
<Item>SSL</Item>
<Item>SSLv2</Item>
<Item>SSLv2Hello</Item>
<Item>SSLv3</Item>
</Array>
</Arg>
</Call>
<Set name="KeyStorePath">D:\VALUE\ADM\VALUE.keystore</Set>
<Set name="KeyStorePassword">REMOVED</Set>
</Configure>
下面是我的 PowerShell 脚本中的代码片段,我试图从中提取所需的信息:
[xml]$jetty = gc "$CADPathFull\bin\conf\jetty\jetty-ssl-context.xml"
$jettyPath = $jetty.Configure.Set | Where-Object Name -EQ 'KeyStorePath'
如果我尝试查看 $jettyPath 的值,它会显示空白。如果我尝试查看 $jetty.Configure.Set 的值,我会看到以下信息:
OverloadDefinitions
-------------------
void Set(int , System.Object )
XML 文件的结构是否存在问题或者我的方法是否不正确?
顺便说一下,我可以Call
使用以下方法毫无问题地检索元素$jetty.Configure.Call