How to Validate IDP metadata in SP app

Hi, I want to validate whether the IDP metadata (SSO URL, certificate and issuer) configured in services provider are valid or not programmatically. Is there any way to achieve this?