如何在PowerShell中为简单的https下载设置默认默认SSLContext?

问题描述:

这从征兵http://www.foundweekends.org/conscript/setup.html 当我尝试通过运行该脚本官方在我的Windows 10安装征兵(setup.ps1 script source code)的问题,我遇见了问题:如何在PowerShell中为简单的https下载设置默认默认SSLContext?

:::: 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 defalult SSLContext并且可以让它下载https链接?

+0

你'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站点进行配置,可能 - 这些站点已配置为[高SSL安全设置](https://www.ssllabs.com/ssltest/analyze.html?d=oss .sonatype.org&s = 52.22.249.229&latest) – TessellatingHeckler

尝试把这个在你的脚本

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

这是没用的,我已经这么做了。 – user504909