0

Java에서 기본 CRL 경로를 설정하는 방법. 인증서와 나는 com.sun.security.enableCRLDP의의 조합을 시도했습니다Java가 CRL 경로의 기본값을 설정합니다.

PKIX path validation failed: java.security.cert.CertPathValidatorException: Could not determine revocation status 

com.sun.net.ssl.checkRevocation : 지금 CRL 배포 지점을 포함하지 않는 인증서 난이되는 때 CRLDP를 함유하고 있지 않다. 결론은 위에서 언급 한 속성을 설정할 때 CRLDP를 포함하지 않는 인증서가 있으면 예외가 발생한다는 것입니다. 즉, ' '은 현재 시스템에서 원하는 동작이 아닙니다.

+0

분명히 모든 인증서에 CRL DP를 지정해야합니다 (루트 CA 인증서 제외). 필자는 인터넷 기반 PKI에서 CDP/AIA 확장 기능을 설계하는 블로그 게시물을 작성했습니다. 이 기사는 Microsoft ADCS 전용이지만 PKI 개발에 사용하는 모든 소프트웨어에 적합합니다. https://www.sysadmins.lv/blog-en/designing-crl-distribution-points-and-authority-information -access-locations.aspx – Crypt32

+0

하지만 기본 경로를 지정하는 방법이 있어야합니다 – mdavid

답변

0

로컬 CRL 파일을 지정하는 방법을 찾은 것 같아 트릭을 수행하는 것 같습니다. 인증서가 예외를 던질하지 않습니다 내가 준 파일에서 해지 상태를 확인하려고합니다 CRL 배포 지점을 포함하지 않는 경우이 경우

 // initialize a new TMF with our keyStore 
     TrustManagerFactory tmf = TrustManagerFactory.getInstance("PKIX", "SunJSSE"); 

     CertPathParameters pkixParams = new PKIXBuilderParameters(keyStore, new X509CertSelector()); 

     // Activate certificate revocation checking 
     ((PKIXBuilderParameters) pkixParams).setRevocationEnabled(true); 

     List<CertStore> certStores = new ArrayList<>(1); 

     Collection<CRL> crls = new HashSet<>(1); 
     crls.add(CertificateFactory.getInstance("X.509").generateCRL(new java.io.FileInputStream("your_local_file.crl"))); 

     certStores.add(CertStore.getInstance("Collection", new CollectionCertStoreParameters(crls))); 
     ((PKIXBuilderParameters) pkixParams).setCertStores(certStores); 

     System.setProperty("com.sun.security.enableCRLDP", "true"); 
     tmf.init(new CertPathTrustManagerParameters(pkixParams)); 

     // acquire X509 trust manager from factory 
     TrustManager tms[] = tmf.getTrustManagers(); 
     for (TrustManager tm : tms) { 
      if (tm instanceof X509TrustManager) { 
       trustManager = (X509TrustManager) tm; 
       break; 
      } 
     } 

. 그러나 지정된 로컬 CRL 파일의 내용이 올바른 형식이 아닌 경우에도 건너 뛰지 않으며 인증서에 CRL 배포 지점이 포함되어 있어도 예외가 발생합니다.

어쨌든 좀 더 우아한 답변을 기다리고 있습니다.

+0

your_local_file.crl을 업데이트하는 메커니즘이 있다고 생각합니다. 이 접근법은 기존 CRL 파일을 새로운 것으로 대체하고 이미로드 된 CRL이 만료되면 your_local_file.crl을 다시로드 할 수 있습니까? – ramtech

관련 문제