IT박스

인증서는 PC에서 신뢰하지만 Android에서는 신뢰하지 않습니다.

itboxs 2020. 10. 8. 07:49
반응형

인증서는 PC에서 신뢰하지만 Android에서는 신뢰하지 않습니다.


오늘 아침부터 내 인증서는 더 이상 Android에서 신뢰되지 않으며 내 애플리케이션은 더 이상 연결할 수 없습니다.

 Catch exception while startHandshake: javax.net.ssl.SSLHandshakeException: java.security.cert.CertPathValidatorException: Trust anchor for certification path not found.
 return an invalid session with invalid cipher suite of SSL_NULL_WITH_NULL_NULL
 javax.net.ssl.SSLPeerUnverifiedException: No peer certificate
    at org.apache.harmony.xnet.provider.jsse.SSLSessionImpl.getPeerCertificates(SSLSessionImpl.java:137)
    at org.apache.http.conn.ssl.AbstractVerifier.verify(AbstractVerifier.java:93)
    at org.apache.http.conn.ssl.SSLSocketFactory.createSocket(SSLSocketFactory.java:381)
    at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:165)
    at org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)
    at org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)
    at org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:591)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:807)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:781)
    at org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:770)

Google Chrome (PC)에서 시도하면 문제가없고 인증서를 신뢰할 수 있지만 Android의 Chrome 브라우저에서 시도하면 인증서를 신뢰할 수 없다는 메시지가 표시됩니다. 어떡해?


인증서 파일에 중간 인증서가 누락되었을 수 있습니다. 동일한 인증서 판매자가있는 다른 웹 사이트를 이미 방문한 경우 중간 인증서가 브라우저에 기억됩니다. 이것은 웹 사이트를 방문하는 모든 방문자에게 해당되지 않을 수도 있습니다. SSL 연결에서 누락 된 중간 인증서를 해결하려면 자체 인증서 파일에 중간 인증서를 추가해야합니다.

GoDaddy에는 중간 인증서에 대한 몇 가지 정보가 있습니다 (하지만 가장 좋은 출처는 항상 인증서 제공 업체입니다) : http://support.godaddy.com/help/article/868/what-is-an-intermediate-certificate

나는 한때 (Comodo와 함께) 중간 인증서 문제가 있었고 내 자신의 인증서 파일을 중간 CA와 결합해야했습니다. 완료되면 더 이상 오류가 발생하지 않았습니다.

Godaddy의 웹 서버 별 설치 지침 : http://support.godaddy.com/help/article/5346/installing-an-ssl-server-instructions?locale=en

그리고 다음은 Commodo 자체에서 제공하는 가장 일반적인 설치 가이드 목록입니다. https://support.comodo.com/index.php?/Default/Knowledgebase/Article/View/1145/0/how-do-i-make- crt 파일에서 내 자신의 번들 파일

사용중인 웹 서버에 따라 모든 인증서 (도메인 인증서, 중간 및 루트)를 지정하거나 순서대로 하나로 결합 (예 : Nginx)해야합니다.

  1. 도메인 인증서
  2. 중간 인증서
  3. 루트 인증서

SSH 터미널에서이 작업을 수행하는 쉬운 방법은 다음을 입력하는 것입니다.

cat domainfile intermediatefile rootfile > targetfile

인증서 테스트 도구

추가 문제가 발생하거나 인증서가 올바른지 확실하지 않은 경우 온라인 도구를 사용하여 SSL 인증서를 확인하십시오. 예 : network4all.com/en/ssl+certificates/quickscan

Android 2.2 이하에 대한 SNI 지원

Android 2.2 (및 이전 버전)는 SNI를 지원하지 않으므로 단일 IP 주소에서 문제없이 서로 다른 호스트 이름에 대한 여러 SSL 인증서가 작동 할 수 있습니다. 해당 정보를 제공해 주신 @technyquist에게 감사드립니다. 이 문제에 대한 자세한 내용 은 SNI에 대한 이 SO 질문을 검토 하십시오 .


crt 번들을 만들어야합니다. 그러면 괜찮습니다. 세 개의 crt 파일을 받게됩니다. 모두 사용하세요! domain.crt 만 사용한 경우 Android에서는 경고가 표시되지만 PC에서는 표시되지 않습니다.

나는 nginx에 있습니다. domain_name.crt를 연 다음 positivesslca2.crt를 열고 모두 선택하고 domain_name.crt의 끝에 복사합니다. 그런 다음 AddTrustExternalCARoot.crt를 열고 domain_name.crt의 끝에 다시 복사합니다. 그런 다음 domain_name.crt를 설치하십시오.

잘 작동합니다.


누군가에게 도움이 될 수 있으므로 여기에 추가하십시오. 팝업 및 잘못된 인증서 오류를 표시하는 Android에 문제가 있습니다.

Comodo Extended Validation 인증서가 있으며 4 개의 파일이 포함 된 zip 파일을 받았습니다.

  • AddTrustExternalCARoot.crt
  • COMODORSAAddTrustCA.crt
  • COMODORSAExtendedValidationSecureServerCA.crt
  • www_mydomain_com.crt

다음과 같이 모두 한 줄에 연결했습니다.

cat www_mydomain_com.crt COMODORSAExtendedValidationSecureServerCA.crt COMODORSAAddTrustCA.crt AddTrustExternalCARoot.crt >www.mydomain.com.ev-ssl-bundle.crt

그런 다음 해당 번들 파일을 ssl_certificate_keynginx에서 내로 사용했습니다. 이제 작동합니다.

이 요점에서 영감을 얻었습니다 : https://gist.github.com/ipedrazas/6d6c31144636d586dcc3


Comodo PositiveSSL로 우리는 4 개의 파일을 받았습니다.

  • AddTrustExternalCARoot.crt
  • COMODORSAAddTrustCA.crt
  • COMODORSADomainValidationSecureServerCA.crt
  • our_domain.crt

comodo 사이트의 지침을 따랐을 때 인증서에 중간 인증서 파일이 없다는 오류가 표시됩니다.

Basically the syntax is

cat our_domain.crt COMODORSADomainValidationSecureServerCA.crt COMODORSAAddTrustCA.crt  AddTrustExternalCARoot.crt > domain-ssl_bundle.crt

I've recently ren into this issue with Commodo cert I bought on ssls.com and I've had 3 files:

domain-name.ca-bundle domain-name.crt and domain-name.p7b

I've had to set it up on Nginx and this is the command I ran:

cat domain-name.ca-bundle domain-name.crt > commodo-ssl-bundle.crt

I then used commodo-ssl-bundle.crt inside the Nginx config file and works like a charm.


I had the same issue and my issue was the device not having the right date and time. Once I fixed that the certificate is being trusted.


I had the same error because I didn't issued a Let's Encrypt cert for the www.my-domain.com, only for my-domain.com

Issuing also for the www. and configuring the vhost to load certificates for www.my-domain.com before redirecting to https://my-domain.com did the trick.


I encountered this same issue under Apache 2.2 when I was trying to use multiple SSLCertificateChainFile directives for each intermediate cert; instead I needed to concatenate all three into a single file. Coming from GoDaddy where they'd done this for me as a "bundle" this extra step was new to me, but a re-reading of the Apache documentation made this apparent.

Worth noting, this directive is deprecated as of Apache 2.4.8 since you can now concatenate all the intermediates with the actual cert.


I hope i am not too late, this solution here worked for me, i am using COMODO SSL, the above solutions seem invalid over time, my website lifetanstic.co.ke

Instead of contacting Comodo Support and gain a CA bundle file You can do the following:

When You get your new SSL cert from Comodo (by mail) they have a zip file attached. You need to unzip the zip-file and open the following files in a text editor like notepad:

AddTrustExternalCARoot.crt
COMODORSAAddTrustCA.crt
COMODORSADomainValidationSecureServerCA.crt

Then copy the text of each ".crt" file and paste the texts above eachother in the "Certificate Authority Bundle (optional)" field.

After that just add the SSL cert as usual in the "Certificate" field and click at "Autofil by Certificate" button and hit "Install".


With Godaddy certs you most likely will have a domain.key, gd_bundle_something.crt and (random alphanumeric string) 4923hg4k23jh4.crt

You'll need to: cat gd_bundle_something.crt >> 4923hg4k23jh4.crt

And then, on nginx, you will use

ssl                  on;
ssl_certificate      /etc/ssl/certs/4923hg4k23jh4.crt;
ssl_certificate_key  /etc/ssl/certs/domain.key;

I had the same problem. Another way to generate the correct .crt file is like this:

Sometimes you get a .PEM file with an entire certificate chain inside. The file may look like this....

-----BEGIN RSA PRIVATE KEY-----
blablablabase64private...
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
blablablabase64CRT1...
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
blablablabase64CRT2...
-----END CERTIFICATE-----
...

If you remove the entire private key section, you will have a valid chained .crt


Make sure you also use your intermediate crt (.crt file with a bundle.. some providers also call it bundle or ca certificate). then in your ssl.conf,

SSLCertificateFile </path/for/actual/certificate>

SSLCACertificateFile </path/for/actual/intermediate_certificate>

then restart your webserver :ex for apache use :

sudo service httpd restart

could be that you're missing the certificate on your device.

try looking at this answer: How to install trusted CA certificate on Android device? to see how to install the CA on your own device.


I had a similar problem and wrote a detailed article about it. If anyone has the same problem, feel free to read my article.

https://developer-blog.net/administration/ssl-zertifikat-installieren/

It is a detailed problem description in German language.

참고URL : https://stackoverflow.com/questions/11340298/certificate-is-trusted-by-pc-but-not-by-android

반응형