Get Certificate Information from Url Android Programmatically

Manohar Perepa

Is it possible to get the certificate information from the Url ? In iOS, it has NSURLAuthenticationChallengewhich gives the information if the url contains https.

The same way do we have any way to get the certificate information for the particular url through Code?

Manohar Perepa
X509TrustManager trustManager = new X509TrustManager() {
                @Override
                public void checkClientTrusted(X509Certificate[] chain,
                        String authType) throws CertificateException {
                    for (TrustManager tm : managers) {
                        if (tm instanceof X509TrustManager) {
                            ((X509TrustManager) tm).checkClientTrusted(
                                    chain, authType);
                        }
                    }
                }

                @Override
                public void checkServerTrusted(X509Certificate[] chain,
                        String authType) throws CertificateException {
                    for (X509Certificate cert : chain) {
                        // cert gives the server Certificate Information.
                        if (cert.getIssuerX500Principal().equals(
                                trustedRoot.getIssuerX500Principal())) {
                            return;
                        }
                    }
                    for (TrustManager tm : managers) {
                        if (tm instanceof X509TrustManager) {
                            ((X509TrustManager) tm).checkServerTrusted(
                                    chain, authType);
                        }
                    }
                }

                @Override
                public X509Certificate[] getAcceptedIssuers() {
                    ArrayList<X509Certificate> issuers = new ArrayList<>();
                    for (TrustManager tm : managers) {
                        if (tm instanceof X509TrustManager) {
                            issuers.addAll(Arrays
                                    .asList(((X509TrustManager) tm)
                                            .getAcceptedIssuers()));
                        }
                    }
                    return issuers.toArray(new X509Certificate[issuers
                            .size()]);
                }

            };

Check for this // cert gives the server Certificate Information. in the above code.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

Get information from URL

From Dev

Get information from URL

From Dev

Add Server Certificate Information to Trust Manager Android Programmatically

From Dev

Get information from custom url

From Dev

Get information from Facebook with Android

From Dev

How to get the Certificate information from clickonce deployment manifest xml file

From Dev

how to programmatically get all available information from a Wikidata entity?

From Dev

How do I get certificate information from p12 certificate using javascripts forge?

From Dev

How to get whatsapp Contacts from Android Programmatically?

From Dev

How to get information from the Android notification bar?

From Dev

How to get information from the Android notification bar?

From Dev

Android - How to store certificate in keystore programmatically?

From Dev

Extract certificate (.cer) from installer programmatically

From Dev

Python requests library - get SSL certificate information

From Dev

Get certificate information after connection error

From Dev

Get url of certificate parent (JAVA)

From Dev

Android - How to Represent JSON Information from URL through GSON

From Dev

Programmatically get OSX Fusion Drive information

From Dev

Get All Images from R file in Android programmatically

From Dev

Get IP Address of pc from android device programmatically

From Dev

Android how to get information from intent when using requestLocationUpdates()

From Dev

How to get information from my Android Fragment to MyActivity.java

From Dev

get all the information from a marker google maps-android studio

From Dev

get android release Certificate Fingerprints

From Dev

Get routing information about a URL

From Dev

Get routing information about a URL

From Dev

How to get AuthorityKeyIdentifier from Certificate

From Dev

How to get a certificate from a CA?

From Dev

Android Get Image From URL stored in JSONObject

Related Related

  1. 1

    Get information from URL

  2. 2

    Get information from URL

  3. 3

    Add Server Certificate Information to Trust Manager Android Programmatically

  4. 4

    Get information from custom url

  5. 5

    Get information from Facebook with Android

  6. 6

    How to get the Certificate information from clickonce deployment manifest xml file

  7. 7

    how to programmatically get all available information from a Wikidata entity?

  8. 8

    How do I get certificate information from p12 certificate using javascripts forge?

  9. 9

    How to get whatsapp Contacts from Android Programmatically?

  10. 10

    How to get information from the Android notification bar?

  11. 11

    How to get information from the Android notification bar?

  12. 12

    Android - How to store certificate in keystore programmatically?

  13. 13

    Extract certificate (.cer) from installer programmatically

  14. 14

    Python requests library - get SSL certificate information

  15. 15

    Get certificate information after connection error

  16. 16

    Get url of certificate parent (JAVA)

  17. 17

    Android - How to Represent JSON Information from URL through GSON

  18. 18

    Programmatically get OSX Fusion Drive information

  19. 19

    Get All Images from R file in Android programmatically

  20. 20

    Get IP Address of pc from android device programmatically

  21. 21

    Android how to get information from intent when using requestLocationUpdates()

  22. 22

    How to get information from my Android Fragment to MyActivity.java

  23. 23

    get all the information from a marker google maps-android studio

  24. 24

    get android release Certificate Fingerprints

  25. 25

    Get routing information about a URL

  26. 26

    Get routing information about a URL

  27. 27

    How to get AuthorityKeyIdentifier from Certificate

  28. 28

    How to get a certificate from a CA?

  29. 29

    Android Get Image From URL stored in JSONObject

HotTag

Archive