【问题标题】:How to setting default Default SSLContext for simple https downloads in powershell?如何在powershell中为简单的https下载设置默认的默认SSLContext?
【发布时间】:2016-12-08 14:14:52
【问题描述】:

这个问题来自征兵http://www.foundweekends.org/conscript/setup.html 当我尝试通过运行官方脚本(setup.ps1script source code)在我的 Windows 10 上安装征兵时,我遇到了其他问题:

 :::: ERRORS
    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://dl.bintray.com/foundweekends/maven-releases/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.pom

    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://dl.bintray.com/foundweekends/maven-releases/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.jar

    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://oss.sonatype.org/content/repositories/releases/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.pom

    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://oss.sonatype.org/content/repositories/releases/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.jar

    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://repo1.maven.org/maven2/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.pom

    Server access Error: java.security.NoSuchAlgorithmException: Default SSLContext not available url=https://repo1.maven.org/maven2/org/foundweekends/conscript/conscript_2.11/0.5.0/conscript_2.11-0.5.0.jar

我认为问题出在:

$wc = New-Object System.Net.WebClient
...
$wc.DownloadFile($url, "$CS/$LJ")

这里有 wc 对象,但它们没有为下载对象组装 SSLContext。

你能给我举个例子,如何给 $wc 默认 SSLContext 并让它下载 https 链接吗?

【问题讨论】:

  • 您的 java.security 错误不是来自 PowerShell,它不能在 Java/JVM 上运行,也不能使用 Java 库。下载 "https://oss.sonatype.org/content/repositories/public/org/scala-sbt/launcher/1.0.0/launcher-1.0.0.jar" 的脚本中的 WebClient 行在我的 Windows 10 安装的 PowerShell 中运行良好。我认为您的 Java 安装更有可能没有为较新的 SSL 站点配置,也许 - 这些站点配置为 high SSL security settings

标签: powershell ssl webclient webclient-download


【解决方案1】:

试着把它放在你的脚本的顶部

[System.Net.ServicePointManager]::ServerCertificateValidationCallback = {$true}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-12-05
    • 2012-02-04
    • 2011-12-31
    • 1970-01-01
    • 1970-01-01
    • 2012-04-11
    • 2020-07-01
    • 1970-01-01
    相关资源
    最近更新 更多