diff --git a/Snowflake.Data/Core/Authenticator/AuthenticationPropertiesValidator.cs b/Snowflake.Data/Core/Authenticator/AuthenticationPropertiesValidator.cs index 74b372b9d..8a7188199 100644 --- a/Snowflake.Data/Core/Authenticator/AuthenticationPropertiesValidator.cs +++ b/Snowflake.Data/Core/Authenticator/AuthenticationPropertiesValidator.cs @@ -29,10 +29,12 @@ public static void Validate(SFSessionProperties properties) valid = true; break; case KeyPairAuthenticator.AUTH_NAME: - valid = !string.IsNullOrEmpty(properties[SFSessionProperty.PRIVATE_KEY]) || - !string.IsNullOrEmpty(properties[SFSessionProperty.PRIVATE_KEY]); + valid = (properties.TryGetValue(SFSessionProperty.PRIVATE_KEY, out var privateKey) + && !string.IsNullOrEmpty(privateKey)) || + (properties.TryGetValue(SFSessionProperty.PRIVATE_KEY_FILE, out var privateKeyFile) && + !string.IsNullOrEmpty(privateKeyFile)); if (!valid) - error = $"PRIVATE_KEY or PRIVATE_KEY should be provided for Authenticator={authenticator}"; + error = $"PRIVATE_KEY or PRIVATE_KEY_FILE should be provided for Authenticator={authenticator}"; break; case OAuthAuthenticator.AUTH_NAME: valid = !string.IsNullOrEmpty(properties[SFSessionProperty.TOKEN]);