[MacPlatform] Fixed the logic for adding certificates to the keychain