Skip to content

Commit 85c57b4

Browse files
committed
Use updated method for removing system-trusted certiciate
1 parent 8fc6448 commit 85c57b4

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

integration-tests/macos.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ ANY_CA_PEM=integration-tests/one-existing-ca.pem
66
ANY_CA_SUBJECT="OU=GlobalSign Root CA - R3, O=GlobalSign, CN=GlobalSign"
77

88
reset() {
9-
security remove-trusted-cert -d $ANY_CA_PEM || true
10-
list | grep "$ANY_CA_SUBJECT"
9+
printf "\n*** Remove test CA ***\n"
10+
CERT_HASH=$(openssl x509 -in $ANY_CA_PEM -noout -fingerprint -sha1 | cut -d= -f2 | tr -d :)
11+
security delete-certificate -Z "$CERT_HASH" /Library/Keychains/System.keychain || true
12+
list | grep "$ANY_CA_SUBJECT" || true
1113
}
1214

1315
list() {
@@ -28,12 +30,14 @@ assert_exists() {
2830

2931
test_distrust_existing_root() {
3032
assert_exists "$ANY_CA_SUBJECT"
33+
printf "\n*** Add test CA ***\n"
3134
security add-trusted-cert -d -r deny $ANY_CA_PEM
3235
assert_missing "$ANY_CA_SUBJECT"
3336
reset
3437
}
3538

3639
# https://developer.apple.com/forums/thread/671582?answerId=693632022#693632022
40+
printf "\n*** Enable trust settings ***\n"
3741
security authorizationdb write com.apple.trust-settings.admin allow
3842

3943
reset

0 commit comments

Comments
 (0)