2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

stunnelを使ってiOSシミュレータでルート未信頼の外部SSL/TLS通信をする

Last updated at Posted at 2012-12-26

この記事は最終更新から1年以上経過しています。 気をつけてね。

iOSで外部APIとSSL/TLS通信をするアプリを開発する場合、相手方がルートの信頼が無い証明書を使っていると何らかの方法でVerifyを回避する必要がある。

iPhone実機でテストするには適当なCA証明書を入れ、サーバ側にはそれで署名したサーバ証明書を使えばいい。

iOSシミュレータで未信頼CAの証明書を使うのは手間らしいのでSSL/TLSのレイヤをstunnelを使って下記のような設定をする。
シミュレータから見ればただの平文通信ということになる。

stunnel.conf
-- snip --
[remote_https]
client = yes
accept = 127.0.0.1:10443
connect = your_domain:443
-- snip --

これでlocalhost:10443がListenされ、通信の転送先がリモートHTTPSサーバ宛になる。

ちなみに

"~/Library/Application Support/iPhone Simulator/5.0/Library/Keychains/TrustStore.sqlite3"

がiOSシミュレータの証明書ストアのようなので、ここにCA証明を入れれば良いのかもしれないがうまくいかない。

2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?