小编Mar*_*kus的帖子

使用BouncyCastle接受过期的CRL

我正在使用充气城堡离线验证X509证书,并且遇到了旧版CRL的问题.我还没有发现有可能接受已过期的CRL,我认为如果证书被撤销,它应该在CRL到期后保持撤销.另外如果CRL是空的我只想接受这个,我现在无法获得更新的CRL.

只是为了澄清,这将是用例:

  1. 2015年创建证书,有效期为2015-2020
  2. 在2017年以CRL撤销证书,密钥被盗,仅创建CRL 1年,因为我犯了一个错误或计划滚动并且永远无法绕过它
  3. 在2019年检查证书,CRL已过期,充气城堡再次接受撤销证书 - 这显然不是我想要的

目前我将撤销检查设置为false并自行执行检查.我在网上找不到任何关于此的信息.

这是我的代码:

final X509CertSelector endConstraints = new X509CertSelector();
endConstraints.setSerialNumber(signer.getSID().getSerialNumber());

final PKIXBuilderParameters buildParams = new PKIXBuilderParameters(trustAnchors, endConstraints);
//a CertStore object with Certificates and CRLs
buildParams.addCertStore(certificates);
//currently deactivated
buildParams.setRevocationEnabled(false);

final CertPathBuilder builder = CertPathBuilder.getInstance(SignedFileVerifier.CERTIFICATE_PATH_ALGORITHM, SignedFileVerifier.PROVIDER);
final CertPathBuilderResult result = builder.build(buildParams);

//here I manually check the CRLs, which I don't want to do
checkRevocation(result.getCertPath().getCertificates(), certificates, trustAnchors);

//if this passes I return the found certificate
return (X509Certificate) result.getCertPath().getCertificates().get(0);
Run Code Online (Sandbox Code Playgroud)

确切的例外是:

Caused by: org.bouncycastle.jce.exception.ExtCertPathValidatorException: No CRLs found for …
Run Code Online (Sandbox Code Playgroud)

java bouncycastle certificate-revocation x509

7
推荐指数
1
解决办法
947
查看次数

在谓词中使用冒号的SPARQL查询

我试图从linkedgeodata.org查询一个国家内的国家的RDF数据.在RDF中,它表示如下:

<http://linkedgeodata.org/triplify/node1055351027>  <http://linkedgeodata.org/property/is_in%3Acountry> "LT" .
Run Code Online (Sandbox Code Playgroud)

您可能会注意到,谓词包含一个转义冒号,所以"%3A"而不是":"我无法为此找到合适的SPARQL查询,这些是我的一些尝试

?node lgdp:is_in "LT".
?node lgdp:is_in:country "LT".
?node lgdp:is_in%3Acountry "LT".
?node lgdp:is_in\u003Acountry "LT".
?node lgdp:is_in"\u003A"country "LT".
Run Code Online (Sandbox Code Playgroud)

我使用开源版的virtuoso作为我的三重存储,这是我收到的错误消息,除了第一个表单:

    Virtuoso 37000 Error SP030: SPARQL compiler, line 0: Invalid character in SPARQL expression at '\'

SPARQL query:
define sql:big-data-const 0 
#output-format:text/html
define input:default-graph-uri  PREFIX lgdo: 
PREFIX lgdp: 
PREFIX lgd: 
PREFIX pos: 
PREFIX rdf: 

SELECT ?node, ?label
Where {
 ?node a lgdo:State .
 ?node lgdp:is_in\u003Acountry "LT".
 ?node rdfs:label ?label .
} 
Run Code Online (Sandbox Code Playgroud)

rdf sparql virtuoso

6
推荐指数
1
解决办法
2158
查看次数

Android中的自定义文件类型无效

我正在编写一个Android应用程序,它应该打开带有结尾.meetme的文件

实际上它应该直接从Gmail打开它们,但我不认为这是可能的.

这是我的AndroidManifest.xml的代码:

<activity android:name=".MeetingRequest" android:label="Meeting Request">
    <intent-filter>
        <action android:name="android.intent.action.VIEW" />
        <category android:name="android.intent.category.DEFAULT" />
        <category android:name="android.intent.category.BROWSABLE" />
        <data android:scheme="file" />
        <data android:mimeType="*/*" />
        <data android:host="*" />
        <data android:pathPattern=".*\\.meetme" />
    </intent-filter>
</activity>
Run Code Online (Sandbox Code Playgroud)

我已经尝试了很多变化,如果我在Astro中打开文件,长时间点击并打开文本,我的应用程序显示并可以正常打开它.将不胜感激任何帮助.

马库斯

android file-type android-manifest

5
推荐指数
1
解决办法
3735
查看次数

Java 缓存 SSL 失败 - 我可以以某种方式刷新这些失败吗

我正在尝试在单元测试中测试我的 SSL 实现,但有一种情况我不太理解。

当我连接到主机一次并失败时,后续的每个连接也会失败,即使它具有正确的证书。我假设在某个地方我必须刷新缓存。

这是我的代码,服务器和客户端都在本地运行。我对 trustStore 和 keyStore 使用一个 jks-File。无论最初的错误是什么,都会发生错误,下次我总是会收到第一个错误。

如果我不执行第一个请求,第二个请求就会起作用。

如果您想知道这里的用例是什么,我们有一些本地服务器使用来自内部 PKI 的 https 证书,当有人错误配置服务器或证书时,我们希望能够明显地更改它们,而无需关闭整个虚拟机。

    //attempt a connection without certificates, will fail
    try (final InputStream stream = new URL("https://localhost:" + port).openStream()){
        System.out.println(IOUtils.toString(stream, Charset.defaultCharset()));
    } catch (IOException e){
        System.out.println("Failed to load: " + StackTraceUtil.getStackTrace(e));
    }

    //copies the jks file to a temporary location
    final File jksFile = copyJKSFile();

    //ignore host names, running locally, won't use this in production
    HttpsURLConnection.setDefaultHostnameVerifier((hostname, sslSession) -> hostname.equalsIgnoreCase("localhost"));

    //set the system properties
    System.setProperty("javax.net.ssl.keyStore", jksFile.getAbsolutePath());
    System.setProperty("javax.net.ssl.keyStorePassword", password); …
Run Code Online (Sandbox Code Playgroud)

java ssl

3
推荐指数
1
解决办法
2475
查看次数