def test_cert(thumbprint, context=_DEFAULT_CONTEXT, store=_DEFAULT_STORE, untrusted_root=False, dns_name='', eku=''):
 cmd = list()
 thumbprint = thumbprint.upper()
 cert_path = 'Cert:\\{0}\\{1}\\{2}'.format(context, store, thumbprint)
 cmd.append("Test-Certificate -Cert '{0}'".format(cert_path))
 _validate_cert_path(name=cert_path)
 if untrusted_root:
  cmd.append(' -AllowUntrustedRoot')
 if dns_name:
  cmd.append(" -DnsName '{0}'".format(dns_name))
 if eku:
  cmd.append(" -EKU '{0}'".format(eku))
 cmd.append(' -ErrorAction SilentlyContinue')
 return ast.literal_eval(_cmd_run(cmd=str().join(cmd)))

def test_cert ( thumbprint , context = _DEFAULT_CONTEXT , store = _DEFAULT_STORE , untrusted_root = False , dns_name = '' , eku = '' ) : cmd = list ( ) thumbprint = thumbprint . upper ( ) cert_path = 'Cert:\\{0}\\{1}\\{2}' . format ( context , store , thumbprint ) cmd . append ( "Test-Certificate -Cert '{0}'" . format ( cert_path ) ) _validate_cert_path ( name = cert_path ) if untrusted_root : cmd . append ( ' -AllowUntrustedRoot' ) if dns_name : cmd . append ( " -DnsName '{0}'" . format ( dns_name ) ) if eku : cmd . append ( " -EKU '{0}'" . format ( eku ) ) cmd . append ( ' -ErrorAction SilentlyContinue' ) return ast . literal_eval ( _cmd_run ( cmd = str ( ) . join ( cmd ) ) )
check the certificate for validity .