URLRequest add certificate .cert for Hue light

Hello, I'm trying to control my Phillips hue lights from my app. Anyway they have an Api where we can control all of that. The issue is that on the software Postman (to test) they say to disable "SSL Certificate Verification". When I try to call with URLRequest in my app the same url which is: "https://<ip_address_of_Hue_bridge>/clip/v2/resource/device" well, I get this error:

Domain=kCFErrorDomainCFNetwork Code=-1202 NSLocalizedDescription=The certificate for this server is invalid. You might be connecting to a server that is pretending to be “<ip_address_of_Hue_bridge>” which could put your confidential information at risk.

On the the Phillips Hue Developer portal they gave me something that look like the .cert certificate, but I don't know how to use it with Xcode.

Thank you for your help

Answered by Antoinette in 715823022

Here in the attachment the full content of it. I read the articles you sent, I understand more how TLS is working, but I still don't concretely know how to implement an api request with the certificate. Also something that might be interesting to know is that the url I'll use, will never be the same. It's to connect to hue bridge (so every home will have a hue bridge with a different IP address).

Disabling all HTTPS server trust evaluation is easy, but it’s also super insecure. Your goal should be to customise the trust evaluation to let the connection through while staying as secure as possible.

Lemme start you out with a pointer to the following posts:

The first explains terms that I’m going to use a lot. You’ll definitely need to read it. The second is more targeted at folks creating accessories, so it’s probably less helpful.

The best way to set this up depends on how accessory implements TLS. You wrote:

On the the Phillips Hue Developer portal they gave me something that look like the .cert certificate

Can you post that here so I can take a look? Or post the URL where I can download it?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you for your answer, I will take a look right now at the links you sent me. Here the link to the certificate: https://developers.meethue.com/develop/application-design-guidance/using-https/ but you need to create a Phillips Hue developer account. It looks like that: -----BEGIN CERTIFICATE----- MIICMjCCAdigAwIBAgIUO7FSLbaxikuXAljzVaurLXWmFw4wCgYIKoZIzj0EAwIw OTELMAkGA1UEBhMCTkwxFDASBgNVBAoMC1BoaWxpcHMgSHVlMRQwEgYDVQQDDAty ........ ........ ........ MAoGCCqGSM49BAMCA0gAMEUCIEBYYEOsa07TH7E5MJnGw557lVkORgit2Rm1h3B2 sFgDAiEA1Fj/C3AN5psFMjo0//mrQebo0eKd3aWRx+pQY08mk48= -----END CERTIFICATE-----

but you need to create a Phillips Hue developer account.

That is, alas, a showstopper for me.

It looks like that

OK, that’s a certificate in PEM format, which is not unexpected. However, I need to see the full contents. Please post it as a text attachment.

Note DevForums’s text attachment feature wants you to use a .txt extension, so rename the file with that before trying to attach it.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Accepted Answer

Here in the attachment the full content of it. I read the articles you sent, I understand more how TLS is working, but I still don't concretely know how to implement an api request with the certificate. Also something that might be interesting to know is that the url I'll use, will never be the same. It's to connect to hue bridge (so every home will have a hue bridge with a different IP address).

Thank you for your reply, I attached the full content to this message. One thing to know is that the api url I'm using won't be the same between each user of my app, because it will connect to a hue bridge, so the IP address will change.

Accidentally close this question Create new one here: https://developer.apple.com/forums/thread/707602

URLRequest add certificate .cert for Hue light
 
 
Q