ios - create a "Production" certificate programmatically
I am trying to make some automation with the iOS certificate creation. Therefor i am trying to make the whole process of adding/creating an iOS certificate programmatically.
I mainly use Node.js with my projects, and already succeeded in making .pem files, the only problem is somehow sending it to Apple and then downloading the Key to the Keychain Access.
I would like to know if there is a way to communicate with apple developer site/server and do the whole key exchange programmatically.
Let me know if i did not give enough Information or if you have any idea of solving the problem,
Thanks, giorge.
See also questions close to this topic
-
<select> tag doesn't keep background color on iphone
So, basically, I can change the background color of a tag on my computer but when I open the website through and iPhone (doesn't matter if I'm using Safari or Chrome) the background color is that default gradient gray.
I also tried to do it through the javascript, didn't work.
NOTE: i am NOT talking about the menu, only about the box we see without the options below, the one that if we click it shows the menu.
-
Best Tools and Technologies to develop Metro App
I am new to Application Development. I want to know which are the best tools and technologies in the market to develop a Metro App where I can incorporate below functionalities :
- Search - To and From
- Show the Map -
GIF
File - Show Direction and Time.
- Show different points in Maps along with details.
Thanks.
-
All interface orientations must be supported unless the app requires full screen, uploading to appstore gives error
I've read other questions so it's not a duplicate. My issue is different.
In my previous version of live app on app store I ticked landscape orientation for iPad. I want to make my app in portrait mode only for all devices. I've unticked all orientations except Portrait for iPad.
Deployment Info With this settings I get following warning
warning: All interface orientations must be supported unless the app requires full screen.
The solution as suggested by other questions is to tick Requires full screen option which I did but this doesn't allow me to upload app on appstore and it gives error which is my other question ERROR ITMS-90101: This bundle does not support one or more of the devices supported
How do I get it fixed so that I don't get warning and upload app on appstore.
-
Mongoose Save Nested Array of Objects - Node.js
I've created my model and can save an array of objects by manually listing them out, however this won't work in production because my array will not always be the same size.
Below is an example of my code. The issue I'm having when saving an array of objects under the stackRank field.
If anyone has any suggestions that would be great and a life saver!
Mongoose Model
const MySchema = mongoose.Schema({ userId: {type: mongoose.Schema.Types.ObjectId, ref: 'User', require: true}, startDate: {type: Date, require: true}, endDate: {type: Date, require: false}, length: {type: Number, require: true}, inProgress: {type: Boolean, require: true, default: true}, stackRank:[{ appUsers: {type: mongoose.Schema.Types.ObjectId, ref: 'Users', require: true} }] });
Saving Code in Express
const mySchema = new MySchema({ userId: req.body.userId, startDate: today, length: req.body.startLength, stackRank: [ //TODO this is the part I need to change {appUsers: Array[0]}, {appUsers: Array[1]}, {appUsers: Array[2]} ] }); instantComp.save() .then((result) => { console.log('result from save', result) }) .catch(err => console.log('error promise all', err))
Desired Functionality
Instead of saving each value of the array individually for the field appUsers nested in stackRank, I want to be able to save the entire array at once because it will not always have a length of three. It will almost always vary in length so while the code I've written works for an array of this size, it won't actually function properly for me.
-
Hls.js 'Access-Control-Allow-Origin' error
I'm trying to set up a video streaming using HLS capabilities but I'm having trouble getting Hls.js to send my credential request to my server.
This is the code i have in my
app.use(cors({ origin:[config.webAppUrl], methods:['GET','POST'], credentials: true }))
As you can see i give access to my client to request to my server.
but when i want to use Hls.js to load some video from my server i got
No 'Access-Control-Allow-Origin' header is present on the requested resource.
This is my code in client side :
this.hls.loadSource('http://localhost:8585/files/test/test.m3u8');
Please help me .
-
Heroku Http redirect
I'm trying to redirect http to https on my site mostly because Lighthouse brought it to my attention. Below is my index.js file and I'm using express-sslify. And the app on heroku is not actually redirecting. The console log shows no errors but the heroku logs show the error below:
19-02-14T22:02:49.750836+00:00 app[web.1]: Error: Not Found 2019-02-14T22:02:49.750847+00:00 app[web.1]: at /app/index.js:38:17 2019-02-14T22:02:49.750851+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2019-02-14T22:02:49.750853+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13) 2019-02-14T22:02:49.750855+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7 2019-02-14T22:02:49.750857+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12) 2019-02-14T22:02:49.750858+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10) 2019-02-14T22:02:49.750860+00:00 app[web.1]: at /app/node_modules/express-sslify/index.js:60:4 2019-02-14T22:02:49.750862+00:00 app[web.1]: at Layer.handle [as handle_request] (/app/node_modules/express/lib/router/layer.js:95:5) 2019-02-14T22:02:49.750863+00:00 app[web.1]: at trim_prefix (/app/node_modules/express/lib/router/index.js:317:13) 2019-02-14T22:02:49.750865+00:00 app[web.1]: at /app/node_modules/express/lib/router/index.js:284:7 2019-02-14T22:02:49.750866+00:00 app[web.1]: at Function.process_params (/app/node_modules/express/lib/router/index.js:335:12) 2019-02-14T22:02:49.750868+00:00 app[web.1]: at next (/app/node_modules/express/lib/router/index.js:275:10) 2019-02-14T22:02:49.750870+00:00 app[web.1]: at cors (/app/node_modules/cors/lib/index.js:188:7) 2019-02-14T22:02:49.750871+00:00 app[web.1]: at /app/node_modules/cors/lib/index.js:224:17 2019-02-14T22:02:49.750873+00:00 app[web.1]: at originCallback (/app/node_modules/cors/lib/index.js:214:15) 2019-02-14T22:02:49.750874+00:00 app[web.1]: at /app/node_modules/cors/lib/index.js:219:13
const express = require('express'); const path = require('path'); const bodyParser = require('body-parser'); const cors = require('cors'); const mongoose = require('mongoose'); const config = require('./API/config/database') const port = process.env.PORT || 3000; //Declare port //Bring in the routes for the API (delete the default routes) const routesApi = require('./API/routes/index'); const enforce = require('express-sslify'); const app = express(); /*express.static is a built in middleware function to serve static files. We are telling express server public folder is the place to look for the static files*/ app.use(express.static(path.join(__dirname, 'public'))); app.use(bodyParser.json()); app.use(bodyParser.urlencoded({ extended: true })); app.use(cors()); app.use(enforce.HTTPS({ trustProtoHeader: true })) //Use the API routes when path starts with /api app.use('/api', routesApi); // catch 404 and forward to error handler app.use(function (req, res, next) { const err = new Error('Not Found'); err.status = 404; next(err); }); //connect to db mongoose.connect(config.database, { useNewUrlParser: true }); //Starts the server to host static files app.listen(port, () => { console.log(`Express Server listening on port:${port}`) });
edit: Strangely enough, I've noticed if I navigate to another route in the app and refresh it will then redirect to https.
-
URL Requests with SSL Pinning in iOS App are failing for few websites
I have an iOS app which has SSL pinning feature for few particular requests. As SSL Pinning is not working due to some reason, I have downloaded SSL Certificates for 3 sites using Firefox browser (or
openssl
command in mac terminal app) and kept in project local folder. Below are the results, when I run from the iOS app.URL:
https://www.google.com/
RESULT:WORKING with ssl enabled
- I could see some response as HTML data in the console
URL:
https://www.google.com/
RESULT:cancelled 2019-02-14 15:30:27.702813+0530 CertPinning[30996:733590] Task <B7EEA492-BE74-4E2A-9F47-2F8C964B8539>.<1> finished with error - code: -999 2019-02-14 15:30:27.704132+0530 CertPinning[30996:733596] Task <B7EEA492-BE74-4E2A-9F47-2F8C964B8539>.<1> HTTP load failed (error code: -999 [1:89])
URL:
https://api.sendgrid.com/
RESULT
Error Domain=NSURLErrorDomain Code=-999 "(null)" UserInfo={NSUnderlyingError=0x600001c7dd10 {Error Domain=NSURLErrorDomain Code=-999 "cancelled" UserInfo={NSErrorFailingURLStringKey=https://api.sendgrid.com/v3/mail/send, NSErrorFailingURLKey=https://api.sendgrid.com/v3/mail/send, _NSURLErrorRelatedURLSessionTaskErrorKey=( "LocalDataTask <F7FF95D3-ADC7-474C-8B38-0ABA09058AA8>.<1>" ), _NSURLErrorFailingURLSessionTaskErrorKey=LocalDataTask <F7FF95D3-ADC7-474C-8B38-0ABA09058AA8>.<1>, NSLocalizedDescription=cancelled}}, StatusCode=0, ResponseText=, ServiceType=Login, URL=https://api.sendgrid.com/v3/mail/send}
Code from dowloaded from GITHUB
import Foundation import UIKit class ViewController: UIViewController, URLSessionDelegate { override func touchesBegan(_ touches: Set<UITouch>, with event: UIEvent?) { let config = URLSessionConfiguration.default let session = URLSession(configuration: config, delegate: self, delegateQueue: nil) guard let url = URL(string: "https://www.google.com/") else { return } let task = session.dataTask(with: url) { (data, response, error) in if let error = error { print(error.localizedDescription) return } if let data = data, let contents = String(data: data, encoding: String.Encoding.utf8) { print(contents) } } task.resume() } func urlSession(_ session: URLSession, didReceive challenge: URLAuthenticationChallenge, completionHandler: @escaping (URLSession.AuthChallengeDisposition, URLCredential?) -> Void) { guard challenge.protectionSpace.authenticationMethod == NSURLAuthenticationMethodServerTrust, let serverTrust = challenge.protectionSpace.serverTrust, SecTrustEvaluate(serverTrust, nil) == errSecSuccess, let serverCert = SecTrustGetCertificateAtIndex(serverTrust, 0) else { reject(with: completionHandler) return } let serverCertData = SecCertificateCopyData(serverCert) as Data guard let localCertPath = Bundle.main.path(forResource: "wwwgooglecom", ofType: "crt"), let localCertData = NSData(contentsOfFile: localCertPath) as Data?, localCertData == serverCertData else { reject(with: completionHandler) return } accept(with: serverTrust, completionHandler) } func reject(with completionHandler: ((URLSession.AuthChallengeDisposition, URLCredential?) -> Void)) { completionHandler(.cancelAuthenticationChallenge, nil) } func accept(with serverTrust: SecTrust, _ completionHandler: ((URLSession.AuthChallengeDisposition, URLCredential?) -> Void)) { completionHandler(.useCredential, URLCredential(trust: serverTrust)) } }
Why the the errors are seen in the later two requests ?
While sending email using
SendGrid API
, mail isn't being sent, as SSL Pinning is failing. I am not sure where I am going wrong. If I don't go for SSL Pinning, everything works as expected. Any one faced the same problem before? -
Could not create SSL/TLS secure channel using webApplication deployed on IIS
I have added Client certificate in UAT machine (Testing Server). I am facing issue on IIS server , my desktop test app and SoapUI tool receive response successfully but when i deployed my web application on IIS server it causes exception that "Could not create SSL/TLS secure channel". i added certificate in Trusted Root Certification Authorities. and in my code i get this by
ServicePointManager.ServerCertificateValidationCallback = new RemoteCertificateValidationCallback(delegate { return true; }); X509Certificates.X509Store store = new X509Certificates.X509Store(X509Certificates.StoreName.Root, X509Certificates.StoreLocation.LocalMachine); X509Certificates.X509Certificate2 cert4 = store.Certificates.Find(X509Certificates.X509FindType.FindByThumbprint, "60 0c 63 d0 54 6f 80 21 de 10 5e 9f bd 5a 8d 78 1f 9f 6c 62", false)[0]; store.Close();
-
Dask Client can't connect to dask-scheduler
I'm on dask 1.1.1 (latest version) and I have started a dask scheduler at the commandline with this command:
$ dask-scheduler --port 9796 --bokeh-port 9797 --bokeh-prefix my_project distributed.scheduler - INFO - ----------------------------------------------- distributed.scheduler - INFO - Clear task state distributed.scheduler - INFO - Scheduler at: tcp://10.1.0.107:9796 distributed.scheduler - INFO - bokeh at: :9797 distributed.scheduler - INFO - Local Directory: /tmp/scheduler-pdnwslep distributed.scheduler - INFO - ----------------------------------------------- distributed.scheduler - INFO - Register tcp://10.1.25.4:36310 distributed.scheduler - INFO - Starting worker compute stream, tcp://10.1.25.4:36310 distributed.core - INFO - Starting established connection
then... I tried to start up a client to connect to the scheduler using this code:
from dask.distributed import Client c = Client('10.1.0.107:9796', set_as_default=False)
but upon trying to do that, I get an error:
... File "/root/anaconda3/lib/python3.7/site-packages/tornado/concurrent.py", line 238, in result raise_exc_info(self._exc_info) File "<string>", line 4, in raise_exc_info tornado.gen.TimeoutError: Timeout During handling of the above exception, another exception occurred: ... File "/root/anaconda3/lib/python3.7/site-packages/distributed/comm/core.py", line 195, in _raise raise IOError(msg) OSError: Timed out trying to connect to 'tcp://10.1.0.107:9796' after 10 s: connect() didn't finish in time
This has been hardcoded in a system that's been running for months now. So I'm just writing this question to verify I'm not doing anything wrong programmatically right? I think it must be something wrong with the environment. Does everything look right to you? what kind of things could be stopping this outside of dask and python? certificates? differing versions of packages? thoughts