Title: error javax.net.ssl.SSLHandshakeException: · Issue #33 · nativescript-community/https · GitHub
Open Graph Title: error javax.net.ssl.SSLHandshakeException: · Issue #33 · nativescript-community/https
X Title: error javax.net.ssl.SSLHandshakeException: · Issue #33 · nativescript-community/https
Description: I need really your support. I have a big problem that I don't understand why happens. I used this plugin because I want to communicate with protocol https. So, Firstly I install this plugin, and write in component.ts this code: enableSSL...
Open Graph Description: I need really your support. I have a big problem that I don't understand why happens. I used this plugin because I want to communicate with protocol https. So, Firstly I install this plugin, and wr...
X Description: I need really your support. I have a big problem that I don't understand why happens. I used this plugin because I want to communicate with protocol https. So, Firstly I install this plugin, an...
Opengraph URL: https://github.com/nativescript-community/https/issues/33
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"error javax.net.ssl.SSLHandshakeException:","articleBody":"I need really your support.\r\n\r\nI have a big problem that I don't understand why happens.\r\n\r\nI used this plugin because I want to communicate with protocol https.\r\n\r\nSo, Firstly I install this plugin, and write in component.ts this code:\r\n\r\n enableSSLpinning() {\r\n let certificate: any;\r\n Https.enableSSLPinning({ host: 'xx.xxx.xx.xx:3333', certificate, allowInvalidCertificates: true, validatesDomainName: false })\r\n Https.request({\r\n url: 'https://xx.xxx.xx.xx:3333/user',\r\n method: 'GET',\r\n headers: {\r\n \"Content-type\": \"application/x-www-form-urlencoded\",\r\n },\r\n }).then(function (response) {\r\n console.log('Https.request response', response);\r\n }).catch(function (error) {\r\n console.error('Https.request error', error);\r\n })\r\n }\r\n\r\n\r\n\r\nin https.android.js I modify only certificate in this part:\r\n \r\n\r\n function enableSSLPinning(options) {\r\n if (!peer.host \u0026\u0026 !peer.certificate\r\n ) {\r\n var certificate = void 0;\r\n var InputSteram = void 0;\r\n try {\r\n var inputStream = new java.io.ByteArrayInputStream(new java.lang.String(\"-----BEGIN CERTIFICATE-----\\n\"\r\n + \"MIIFjDCCA3SgAwIBAgIJAMOXpEn+QQSVMA0GCSqGSIb3DQEBCwUAMIGBMQswCQYD\\n\"\r\n + \"VQQGEwJVUzELMAkGA1UECAwCTUExDzANBgNVBAcMBkJvc3RvbjETMBEGA1UECgwK\\n\"\r\n ..................\r\n + \"1AYJwo2yFqmetdmOYaFh6Cli8OerUERDqPB1UKPmYQE=\\n\"\r\n + \"-----END CERTIFICATE-----\").getBytes(\"UTF-8\"));\r\n var x509Certificate = java.security.cert.CertificateFactory.getInstance('X.509').generateCertificate(inputStream);\r\n peer.x509Certificate = x509Certificate;\r\n certificate = okhttp3.CertificatePinner.pin(x509Certificate);\r\n inputStream.close();\r\n }\r\n catch (error) {\r\n try {\r\n if (inputStream) {\r\n console.log('inputStream', inputStream)\r\n inputStream.close();\r\n }\r\n }\r\n catch (e) { }\r\n console.error('nativescript-https \u003e enableSSLPinning error', error);\r\n return;\r\n }\r\n peer.host = options.host;\r\n peer.certificate = certificate;\r\n if (options.allowInvalidCertificates == true) {\r\n peer.allowInvalidCertificates = true;\r\n }\r\n if (options.validatesDomainName == false) {\r\n peer.validatesDomainName = false;\r\n }\r\n }\r\n peer.enabled = true;\r\n getClient(true);\r\n console.log('nativescript-https \u003e Enabled SSL pinning');\r\n}\r\n\r\nThis parts execute correct, in console print `'nativescript-https \u003e Enabled SSL pinning'`\r\n\r\nError show in this part: `console.error('Https.request error', error);`\r\n\r\n\u003e JS: Https.request error javax.net.ssl.SSLHandshakeException:\r\n\u003e java.security.cert.CertPathValidatorException: Trust anchor for\r\n\u003e certification path not found.\r\n\r\nAnd in `https.android.js` call this function\r\n\r\n function request(opts) {\r\n console.log('opts', opts)\r\n return new Promise(function (resolve, reject) {\r\n try {\r\n var client = getClient();\r\n var request_1 = new okhttp3.Request.Builder();\r\n request_1.url(opts.url);\r\n var reqheads_1 = opts.headers;\r\n Object.keys(reqheads_1).forEach(function (key) {\r\n request_1.addHeader(key, reqheads_1[key]);\r\n });\r\n if (opts.method == 'GET') {\r\n request_1.get();\r\n }\r\n else if (opts.method == 'POST') {\r\n var type = okhttp3.MediaType.parse('application/json');\r\n var body = okhttp3.RequestBody.create(type, opts.content);\r\n request_1.post(body);\r\n }\r\n client.newCall(request_1.build()).enqueue(new okhttp3.Callback({\r\n onResponse: function (task, response) {\r\n var content;\r\n try {\r\n content = JSON.parse(response.body().string());\r\n }\r\n catch (error) {\r\n return reject(error);\r\n }\r\n var statusCode = response.code();\r\n var headers = {};\r\n var heads = response.headers();\r\n var i, len = heads.size();\r\n for (i = 0; i \u003c len; i++) {\r\n var key = heads.name(i);\r\n var value = heads.value(i);\r\n headers[key] = value;\r\n }\r\n resolve({ content: content, statusCode: statusCode, headers: headers });\r\n },\r\n onFailure: function (task, error) {\r\n reject(error);\r\n },\r\n }));\r\n }\r\n catch (error) {\r\n reject(error);\r\n }\r\n });\r\n }\r\n\r\n\r\nPlease, can you ask me any idea, which is the problem in my code? Thank you\r\n\r\nThanks!\r\n\r\nUpdate:\r\n\r\nI think that a problem is in this part of code:\r\n\r\n onResponse: function (task, response) {\r\n console.load('testfdsfsdfsdfsd')\r\n var content;\r\n console.log('content', content)\r\n try {\r\n content = JSON.parse(response.body().string());\r\n console.log('content1', content)\r\n }\r\n catch (error) {\r\n console.log('error111111', error)\r\n return reject(error);\r\n }\r\n var statusCode = response.code();\r\n var headers = {};\r\n var heads = response.headers();\r\n var i, len = heads.size();\r\n for (i = 0; i \u003c len; i++) {\r\n var key = heads.name(i);\r\n var value = heads.value(i);\r\n headers[key] = value;\r\n }\r\n resolve({ content: content, statusCode: statusCode, headers: headers });\r\n },\r\n\r\nbecause this part is not executed, it passes directly to onFailure\r\n\r\n \r\n\r\n onFailure: function (task, error) {\r\n reject(error);\r\n },","author":{"url":"https://github.com/2adi","@type":"Person","name":"2adi"},"datePublished":"2018-08-15T15:20:08.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/33/https/issues/33"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:90eb7cb4-3b4f-7276-2759-3698bfe5922a |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9270:7F630:25E3E7E:34161A7:698CE70F |
| html-safe-nonce | 4e0d9189ed8d3fb4182a66d5ed17fadbbc146562473b2444a62f94a608677107 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MjcwOjdGNjMwOjI1RTNFN0U6MzQxNjFBNzo2OThDRTcwRiIsInZpc2l0b3JfaWQiOiI3Mzk3ODAzNjI0MDQ5MjA3MDU1IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | a0d59859878b0f54cf2d18d6f9abff607892b2bca5117d93d34dd201360a9351 |
| hovercard-subject-tag | issue:350850856 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/nativescript-community/https/33/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b9c93bb42faed132fcb6d7554595330454265f434f75d02b104ccfe47bff2d61/nativescript-community/https/issues/33 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b9c93bb42faed132fcb6d7554595330454265f434f75d02b104ccfe47bff2d61/nativescript-community/https/issues/33 |
| og:image:alt | I need really your support. I have a big problem that I don't understand why happens. I used this plugin because I want to communicate with protocol https. So, Firstly I install this plugin, and wr... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | 2adi |
| hostname | github.com |
| expected-hostname | github.com |
| None | 640eeb7b6ff4d8d106235d228c0c286e82592d4d2403227b5b2b4fc5832297a4 |
| turbo-cache-control | no-preview |
| go-import | github.com/nativescript-community/https git https://github.com/nativescript-community/https.git |
| octolytics-dimension-user_id | 50633791 |
| octolytics-dimension-user_login | nativescript-community |
| octolytics-dimension-repository_id | 77530217 |
| octolytics-dimension-repository_nwo | nativescript-community/https |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 77530217 |
| octolytics-dimension-repository_network_root_nwo | nativescript-community/https |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 3d444f0a47beeeac94cddbb51c91ab408befe8d4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width