Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support HTTPS #13

Open
KaneCheshire opened this issue Dec 2, 2019 · 4 comments
Open

Support HTTPS #13

KaneCheshire opened this issue Dec 2, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@KaneCheshire
Copy link
Owner

No description provided.

@KaneCheshire KaneCheshire added the enhancement New feature or request label Dec 2, 2019
@KaneCheshire
Copy link
Owner Author

So this is more of a challenge than I anticipated because it's difficult to get the CA cert into the simulator.

@Ashraf-Ali-aa
Copy link

@KaneCheshire this is the bash script Charles proxy uses

#/bin/bash
#
# Installs the Charles Root certificate into the iOS Simulators for the current user.

SHA1=$1
SUBJ=$2
TSET=$3
DATA=$4

install() {
if [ -f "$SQLITEDBPATH" ]; then
cp -n "$SQLITEDBPATH" "$SQLITEDBPATH.charlesbackup"
sqlite3 "$SQLITEDBPATH" <<EOF
INSERT INTO "tsettings" VALUES(X'$SHA1',X'$SUBJ',X'$TSET',X'$DATA');
EOF
fi
}

for SQLITEDBPATH in ~/Library/Application\ Support/iPhone\ Simulator/3.*/Library/Keychains/TrustStore.sqlite3
do install
done

for SQLITEDBPATH in ~/Library/Application\ Support/iPhone\ Simulator/4.*/Library/Keychains/TrustStore.sqlite3
do install
done

for SQLITEDBPATH in ~/Library/Developer/CoreSimulator/Devices/*/data/Library/Keychains/TrustStore.sqlite3
do install
done

SQLITEDBPATH=~/Library/Application\ Support/iPhone\ Simulator/User/Library/Keychains/TrustStore.sqlite3
install

echo "The Charles Root Certificate has been installed for the iPhone Simulator"

@ChaosCoder
Copy link
Contributor

Xcode 11.4 now supports adding certificates, so this could be a solution, right?

simctl supports a keychain subcommand. This command can add certificates to the trusted root store or the keychain. It can also reset the keychain, deleting all saved items. For example, to install “my-selfsigned.cer” to the trusted root store:
xcrun simctl keychain <device> add-root-cert my-selfsigned.cer
Adding a certificate to the trusted root store causes TLS/SSL connections to trust the certificate. (56213319)

Xcode 11.4 Release Notes

@KaneCheshire
Copy link
Owner Author

Oh nice, I'll try and find some time to revisit this! Sounds very promising.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants