예제 #1
0
  imaxlength=string.atoi(dn_attr[i].get('max','40'))
  if imaxlength>40:
    isize=40
  else:
    isize=imaxlength
  policy_field = policy_section.get(i,'optional')
  if policy_field=='match':
    if type(dn_attr[i]['default'])==types.ListType:
      dn_attr[i]['default']=dn_attr[i]['default'][0]
    form.add(cgiforms.formHiddenInputClass(i,dn_attr[i]['comment'],imaxlength,dn_attr[i]['regex'],dn_attr[i]['default'],required=1,show=1))
  else:
    if type(dn_attr[i]['default'])==types.ListType:
      dn_attr[i]['default'].sort()
      form.add(cgiforms.formSelectClass(i,dn_attr[i]['comment'],dn_attr[i]['default'],required=policy_field=='supplied'))
    else:
      form.add(cgiforms.formInputClass(i,dn_attr[i]['comment'],imaxlength,dn_attr[i]['regex'],dn_attr[i]['default'],required=policy_field=='supplied',size=isize))

if not form.contentlength:

  import time

  if not ca.nsComment:
    ca.nsComment = 'No comment'
  if ca.nsCaPolicyUrl:
    nsCommentStr = '<A HREF="%s%s">%s</A>' % (ca.nsBaseUrl,ca.nsCaPolicyUrl,ca.nsComment)
  else:
    nsCommentStr = ca.nsComment

  htmlbase.PrintHeader('Input form for certificate request')
  htmlbase.PrintHeading('Input form for certificate request')
예제 #2
0
      print '</TR>'

  print '</TABLE>'

  return

form = cgiforms.formClass(charset='iso-8859-1')

alphanumregex = '[0-9a-zA-Z\344\366\374\304\326\334\337�.*?_ -]*'
mailadrregex = '[0-9a-zA-Z@.*?=/_ -]*'

form.add(cgiforms.formCheckboxClass('casesensitive','case sensitive','yes',0))
form.add(cgiforms.formCheckboxClass('onlyvalid','only valid','yes',1))
form.add(cgiforms.formCheckboxClass('emailcerts','search e-mail certificates','yes',1))
form.add(cgiforms.formCheckboxClass('servercerts','search server certificates','yes',0))
form.add(cgiforms.formInputClass('CN','Common Name',30,alphanumregex))
form.add(cgiforms.formInputClass('Email','E-Mail',40,mailadrregex))
form.add(cgiforms.formInputClass('OU','Organizational Unit',30,alphanumregex))
form.add(cgiforms.formInputClass('O','Organization',30,alphanumregex))
form.add(cgiforms.formInputClass('L','Location',30,alphanumregex))
form.add(cgiforms.formInputClass('ST','State / Province',30,alphanumregex))
form.add(cgiforms.formInputClass('C','Country',2,'[a-zA-Z?]'*2))

if not form.contentlength:

  htmlbase.PrintHeader('Search certificates')
  htmlbase.PrintHeading('Search certificates')
  print """You can search for certificates in the
certificate database.<P>Just type in substrings or
regular expressions as search criteria."""
  PrintEmptyForm(form)
예제 #3
0
# Path to openssl executable
OpenSSLExec = pyca_section.get('OpenSSLExec','/usr/bin/openssl')

form = cgiforms.formClass()
form.add(
  cgiforms.formSelectClass(
    'operation',
    'Operation',
    ['GetCACert','PKIOperation']
  )
)
form.add(
  cgiforms.formInputClass(
    'message',
    'Message',
    10000,
    (r'.*',re.M+re.S)
  )
)

form.getparams()

scep_operation = form.field['operation'][0].content
scep_message = form.field['message'][0].content

if scep_operation in ['GetCACert','GetCACertChain']:

  # *** Check parameter message again for being valid FQDN.

  # *** Set to pre-configured SCEP CA
  scep_message = 'SCEP'
예제 #4
0
form = cgiforms.formClass(charset='iso-8859-1')

alphanumregex = '[0-9a-zA-Z\344\366\374\304\326\334\337�.*?_ -]*'
mailadrregex = '[0-9a-zA-Z@.*?=/_ -]*'

form.add(
    cgiforms.formCheckboxClass('casesensitive', 'case sensitive', 'yes', 0))
form.add(cgiforms.formCheckboxClass('onlyvalid', 'only valid', 'yes', 1))
form.add(
    cgiforms.formCheckboxClass('emailcerts', 'search e-mail certificates',
                               'yes', 1))
form.add(
    cgiforms.formCheckboxClass('servercerts', 'search server certificates',
                               'yes', 0))
form.add(cgiforms.formInputClass('CN', 'Common Name', 30, alphanumregex))
form.add(cgiforms.formInputClass('Email', 'E-Mail', 40, mailadrregex))
form.add(
    cgiforms.formInputClass('OU', 'Organizational Unit', 30, alphanumregex))
form.add(cgiforms.formInputClass('O', 'Organization', 30, alphanumregex))
form.add(cgiforms.formInputClass('L', 'Location', 30, alphanumregex))
form.add(cgiforms.formInputClass('ST', 'State / Province', 30, alphanumregex))
form.add(cgiforms.formInputClass('C', 'Country', 2, '[a-zA-Z?]' * 2))

if not form.contentlength:

    htmlbase.PrintHeader('Search certificates')
    htmlbase.PrintHeading('Search certificates')
    print """You can search for certificates in the
certificate database.<P>Just type in substrings or
regular expressions as search criteria."""
예제 #5
0
  empty_DN_dict, \
  DB_type,DB_exp_date,DB_rev_date,DB_serial,DB_file,DB_name,DB_number, \
  DB_TYPE_REV,DB_TYPE_EXP,DB_TYPE_VAL, \
  dbtime2tuple,GetEntriesbyDN,SplitDN

sys.stdin.close()

# Path to openssl executable
OpenSSLExec = pyca_section.get('OpenSSLExec', '/usr/bin/openssl')

form = cgiforms.formClass()
form.add(
    cgiforms.formSelectClass('operation', 'Operation',
                             ['GetCACert', 'PKIOperation']))
form.add(
    cgiforms.formInputClass('message', 'Message', 10000, (r'.*', re.M + re.S)))

form.getparams()

scep_operation = form.field['operation'][0].content
scep_message = form.field['message'][0].content

if scep_operation in ['GetCACert', 'GetCACertChain']:

    # *** Check parameter message again for being valid FQDN.

    # *** Set to pre-configured SCEP CA
    scep_message = 'SCEP'

    ca = opensslcnf.getcadata(scep_message)