ó
GUc           @   sú  d  Z  d Z d Z d Z d Z d Z d Z y, d d l m Z m	 Z	 m
 Z
 m Z m Z WnX e k
 r° Z d	 e Z d d
 l Z e j e  d e f d     YZ e e   n Xd Z d e j f d     YZ d e f d     YZ d e j f d     YZ d e j f d     YZ d e j f d     YZ d e j f d     YZ d e j f d     YZ d e j f d     YZ  d e j f d     YZ! d  e j f d!     YZ" d" e j f d#     YZ# d$ e j f d%     YZ$ d& e$ f d'     YZ% d
 S((   sü   NDG HTTPS Client package

Use pyasn1 to provide support for parsing ASN.1 formatted subjectAltName
content for SSL peer verification.  Code based on:

http://stackoverflow.com/questions/5519958/how-do-i-parse-subjectaltname-extension-data-using-pyasn1
s   P J Kershaws   01/02/12s2   (C) 2012 Science and Technology Facilities Councils-   BSD - see LICENSE file in top-level directorys   Philip.Kershaw@stfc.ac.uks   $Id$i˙˙˙˙(   t   univt
   constraintt   chart	   namedtypet   tagsm   Error importing pyasn1, subjectAltName check for SSL peer verification will be disabled.  Import error is: %sNt   Pyasn1ImportErrorc           B   s   e  Z d  Z RS(   s   Raise for pyasn1 import error(   t   __name__t
   __module__t   __doc__(    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR      s   i@   t   DirectoryStringc           B   s(  e  Z d  Z e j e j d e j   j d e	 j
 d e    e j d e j   j d e	 j
 d e    e j d e j   j d e	 j
 d e    e j d e j   j d e	 j
 d e    e j d e j   j d e	 j
 d e    e j d e j   j d e	 j
 d e     Z RS(	   s   ASN.1 Directory string classt   teletexStringt   subtypeSpeci   t   printableStringt   universalStringt
   utf8Stringt	   bmpStringt	   ia5String(   R   R   R   R   t
   NamedTypest	   NamedTypeR   t   TeletexStringt   subtypeR   t   ValueSizeConstraintt   MAXt   PrintableStringt   UniversalStringt
   UTF8Stringt	   BMPStringt	   IA5Stringt   componentType(    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR	      s(   t   AttributeValuec           B   s   e  Z d  Z RS(   s   ASN.1 Attribute value(   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR   7   s   t   AttributeTypec           B   s   e  Z d  Z RS(   s   ASN.1 Attribute type(   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR   ;   s   t   AttributeTypeAndValuec           B   s>   e  Z d  Z e j e j d e    e j d e     Z RS(   s$   ASN.1 Attribute type and value classt   typet   value(	   R   R   R   R   R   R   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR   ?   s   t   RelativeDistinguishedNamec           B   s   e  Z d  Z e   Z RS(   s!   ASN.1 Realtive distinguished name(   R   R   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR"   G   s   t   RDNSequencec           B   s   e  Z d  Z e   Z RS(   s   ASN.1 RDN sequence class(   R   R   R   R"   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR#   K   s   t   Namec           B   s,   e  Z d  Z e j e j d e     Z RS(   s   ASN.1 name classt    (   R   R   R   R   R   R   R#   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR$   P   s   t	   Extensionc           B   s\   e  Z d  Z e j e j d e j    e j d e j	 d   e j d e j
     Z RS(   s   ASN.1 extension classt   extnIDt   criticalt   Falset	   extnValue(   R   R   R   R   R   R   R    t   ObjectIdentifiert   DefaultedNamedTypet   Booleant   OctetStringR   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR&   W   s
   t
   Extensionsc           B   s3   e  Z d  Z e   Z e j j e j	 d e
  Z RS(   s   ASN.1 extensions classi   (   R   R   R   R&   R   R    t
   SequenceOft   sizeSpecR   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR/   `   s   	t   AnotherNamec        
   B   s_   e  Z e j e j d  e j    e j d e j   j d e	 j
 e	 j e	 j d     Z RS(   s   type-idR!   t   explicitTagi    (   R   R   R   R   R   R    R+   t   AnyR   R   t   Tagt   tagClassContextt   tagFormatSimpleR   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR2   f   s
   t   GeneralNamec           B   s  e  Z d  Z e j e j d e   j d e j	 e j
 e j d    e j d e j   j d e j	 e j
 e j d    e j d e j   j d e j	 e j
 e j d    e j d e   j d e j	 e j
 e j d	    e j d
 e j   j d e j	 e j
 e j d    e j d e j   j d e j	 e j
 e j d    e j d e j   j d e j	 e j
 e j d     Z RS(   s@   ASN.1 configuration for X.509 certificate subjectAltNames fieldst	   otherNamet   implicitTagi    t
   rfc822Namei   t   dNSNamei   t   directoryNamei   t   uniformResourceIdentifieri   t	   iPAddressi   t   registeredIDi   (   R   R   R   R   R   R   R2   R   R   R5   R6   R7   R   R   R$   R    R.   R+   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyR8   o   s.   t   GeneralNamesc           B   s3   e  Z d  Z e   Z e j j e j	 d e
  Z RS(   s4   Sequence of names for ASN.1 subjectAltNames settingsi   (   R   R   R   R8   R   R    R0   R1   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyRA      s   	t   SubjectAltNamec           B   s   e  Z d  Z RS(   s0   ASN.1 implementation for subjectAltNames support(   R   R   R   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyRB      s   (&   R   t
   __author__t   __date__t   __copyright__t   __license__t   __contact__t   __revision__t   pyasn1.typeR    R   R   R   R   t   ImportErrort   et   import_error_msgt   warningst   warnR   R   t   ChoiceR	   R   R+   R   t   SequenceR   t   SetOfR"   R0   R#   R$   R&   R/   R2   R8   RA   RB   (    (    (    sA   /usr/lib/python2.7/dist-packages/ndg/httpsclient/subj_alt_name.pyt   <module>   s:   ,		!