'Unable to connect to Kafka using p12 file in .net core application

I have a .net core application that needs to connect to Kafka using SSL protocol. I have a p12 file which I need to use for authentication with the broker but I am unable to do so. The producer configuration am using are

_producerConfig = new ProducerConfig
           {
                BootstrapServers = _appSettings.EarnPublisher.Server,
                ClientId = _appSettings.ClientId,
                Partitioner = Partitioner.Consistent,
                SecurityProtocol = SecurityProtocol.Ssl,
                SslCaLocation = <filename>.p12
            };


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source