def parse_csr(csr_file, certificate_type, http_dc_validation=False):
 valid_certs = set(['QuickSSL Premium', 'RapidSSL', 'RapidSSL Wildcard', 'PremiumSSL', 'InstantSSL', 'PositiveSSL', 'PositiveSSL Wildcard', 'True BusinessID with EV', 'True BusinessID', 'True BusinessID Wildcard', 'True BusinessID Multi Domain', 'True BusinessID with EV Multi Domain', 'Secure Site', 'Secure Site Pro', 'Secure Site with EV', 'Secure Site Pro with EV', 'EssentialSSL', 'EssentialSSL Wildcard', 'InstantSSL Pro', 'PremiumSSL Wildcard', 'EV SSL', 'EV SSL SGC', 'SSL123', 'SSL Web Server', 'SGC Supercert', 'SSL Webserver EV', 'EV Multi Domain SSL', 'Multi Domain SSL', 'PositiveSSL Multi Domain', 'Unified Communications'])
 if (certificate_type not in valid_certs):
  salt.utils.namecheap.log.error(('Invalid option for certificate_type=' + certificate_type))
  raise Exception(('Invalid option for certificate_type=' + certificate_type))
 opts = salt.utils.namecheap.get_opts('namecheap.ssl.parseCSR')
 csr_handle = open(csr_file, 'rb')
 opts['csr'] = csr_handle.read()
 opts['CertificateType'] = certificate_type
 if http_dc_validation:
  opts['HTTPDCValidation'] = 'true'
 csr_handle.close()
 response_xml = salt.utils.namecheap.post_request(opts)
 sslparseresult = response_xml.getElementsByTagName('SSLParseCSRResult')[0]
 return salt.utils.namecheap.xml_to_dict(sslparseresult)

def parse_csr ( csr_file , certificate_type , http_dc_validation = False ) : valid_certs = set ( [ 'QuickSSL Premium' , 'RapidSSL' , 'RapidSSL Wildcard' , 'PremiumSSL' , 'InstantSSL' , 'PositiveSSL' , 'PositiveSSL Wildcard' , 'True BusinessID with EV' , 'True BusinessID' , 'True BusinessID Wildcard' , 'True BusinessID Multi Domain' , 'True BusinessID with EV Multi Domain' , 'Secure Site' , 'Secure Site Pro' , 'Secure Site with EV' , 'Secure Site Pro with EV' , 'EssentialSSL' , 'EssentialSSL Wildcard' , 'InstantSSL Pro' , 'PremiumSSL Wildcard' , 'EV SSL' , 'EV SSL SGC' , 'SSL123' , 'SSL Web Server' , 'SGC Supercert' , 'SSL Webserver EV' , 'EV Multi Domain SSL' , 'Multi Domain SSL' , 'PositiveSSL Multi Domain' , 'Unified Communications' ] ) if ( certificate_type not in valid_certs ) : salt . utils . namecheap . log . error ( ( 'Invalid option for certificate_type=' + certificate_type ) ) raise Exception ( ( 'Invalid option for certificate_type=' + certificate_type ) ) opts = salt . utils . namecheap . get_opts ( 'namecheap.ssl.parseCSR' ) csr_handle = open ( csr_file , 'rb' ) opts [ 'csr' ] = csr_handle . read ( ) opts [ 'CertificateType' ] = certificate_type if http_dc_validation : opts [ 'HTTPDCValidation' ] = 'true' csr_handle . close ( ) response_xml = salt . utils . namecheap . post_request ( opts ) sslparseresult = response_xml . getElementsByTagName ( 'SSLParseCSRResult' ) [ 0 ] return salt . utils . namecheap . xml_to_dict ( sslparseresult )
parses the csr returns a dictionary of result values required parameters: csr_file string certificate signing request file certificate_type string type of ssl certificate .