
T6[c           @   s  d  Z  d d l m Z d d l m Z m Z d d l Z d d l Z d d l Z d d l	 m
 Z
 m Z d d l m Z m Z d d l m Z m Z m Z m Z d d l m Z d d	 l m Z d d
 l m Z m Z m Z m Z m Z d d l m Z m Z m Z m Z d d l m Z m Z m Z m  Z  d d l m! Z! m" Z" d d l m# Z# m$ Z$ d d l m% Z% m& Z& d d l m' Z' m( Z( m) Z) d d l m* Z* m+ Z+ d d l m, Z, m- Z- d d l m. Z. m/ Z/ d d l m0 Z0 m1 Z1 m2 Z2 d d l m3 Z3 m4 Z4 m5 Z5 d d l m6 Z6 m7 Z7 d d l m8 Z8 m9 Z9 m: Z: m; Z; d d l< m= Z= m> Z> m? Z? d d l@ mA ZA mB ZB d   ZC d   ZD d ZE d ZF d ZG d ZH e d   ZI e d!  ZJ e d"  ZK e d#  ZL e d$  ZM e d%  ZN eD e d&   ZO e d'  ZP e d(  ZQ e d)  ZR eD e d*   ZS e d!  ZT eD e d"   ZU e d+  ZV e d,  ZW e d-  ZX e d.  ZY e jZ d/  Z[ e d0  Z\ e d1  Z] e d2  Z^ d3 e> f d4     YZ_ d5 e> f d6     YZ` d7 e> f d8     YZa d9 f  d:     YZb d; e> eb f d<     YZc d= e> eb f d>     YZd d? e> f d@     YZe dA e> f dB     YZf e jg dC  Zh e jg dD  Zi dE   Zj dF   Zk dG   Zl dH e> f dI     YZm dJ e> f dK     YZn dL e> f dM     YZo dN e> eb f dO     YZp dP e> f dQ     YZq dR e> f dS     YZr dT e> f dU     YZs dV e> f dW     YZt dX e> f dY     YZu dZ ev f d[     YZw d\ e> e= f d]     YZx d^ e> f d_     YZy ez d` k re   n  d S(a   s*   
Unit tests for :py:mod:`OpenSSL.crypto`.
i(   t   main(   t   catch_warningst   simplefilterN(   t   PIPEt   Popen(   t   datetimet	   timedelta(   t   ut   bt   binary_typet   PY3(   R   (   R   (   t   TYPE_RSAt   TYPE_DSAt   Errort   PKeyt   PKeyType(   t   X509t   X509Typet   X509Namet   X509NameType(   t	   X509Storet   X509StoreTypet   X509StoreContextt   X509StoreContextError(   t   X509Reqt   X509ReqType(   t   X509Extensiont   X509ExtensionType(   t   load_certificatet   load_privatekey(   t   FILETYPE_PEMt   FILETYPE_ASN1t   FILETYPE_TEXT(   t   dump_certificatet   load_certificate_request(   t   dump_certificate_requestt   dump_privatekey(   t	   PKCS7Typet   load_pkcs7_data(   t   PKCS12t
   PKCS12Typet   load_pkcs12(   t   CRLt   Revokedt   load_crl(   t   NetscapeSPKIt   NetscapeSPKIType(   t   signt   verifyt   get_elliptic_curvet   get_elliptic_curves(   t   EqualityTestsMixint   TestCaset   WARNING_TYPE_EXPECTED(   t   nativet   libc         C   s   t  t t t |    S(   N(   R!   R   R   (   t   pem(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   normalize_certificate_pem)   s    c         C   s   t  t t t |    S(   N(   R$   R   R   (   R8   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   normalize_privatekey_pem-   s    t   blowfisht   zipperst   MD5t   monkeyss2  -----BEGIN CERTIFICATE-----
MIIC7TCCAlagAwIBAgIIPQzE4MbeufQwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UE
BhMCVVMxCzAJBgNVBAgTAklMMRAwDgYDVQQHEwdDaGljYWdvMRAwDgYDVQQKEwdU
ZXN0aW5nMRgwFgYDVQQDEw9UZXN0aW5nIFJvb3QgQ0EwIhgPMjAwOTAzMjUxMjM2
NThaGA8yMDE3MDYxMTEyMzY1OFowWDELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAklM
MRAwDgYDVQQHEwdDaGljYWdvMRAwDgYDVQQKEwdUZXN0aW5nMRgwFgYDVQQDEw9U
ZXN0aW5nIFJvb3QgQ0EwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAPmaQumL
urpE527uSEHdL1pqcDRmWzu+98Y6YHzT/J7KWEamyMCNZ6fRW1JCR782UQ8a07fy
2xXsKy4WdKaxy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XlxWjgI9de0mPVDDUlywcWze1q2kwaEPTM3hLAmD1PESA
oY/n8A/RXoeeRs9i/Pm/DGUS8ZPINXk/yOzsR/XvvkTVroIeLZqfmFpnZeF0cHzL
08LODkVJJ9zjLdT7SA4vnne4FEbAxDbKAq5qkYzaL4UCAwEAAaOB0DCBzTAMBgNV
HRMBAf8EAjAAMB0GA1UdDgQWBBSIWlXAUv9hzVKjNQ/qWpwkOCL3XDALBgNVHQ8E
BAMCBeAwgZAGA1UdEQSBiDCBhYIeYWx0bnVsbC5weXRob24ub3JnAGV4YW1wbGUu
Y29tgSBudWxsQHB5dGhvbi5vcmcAdXNlckBleGFtcGxlLm9yZ4YpaHR0cDovL251
bGwucHl0aG9uLm9yZwBodHRwOi8vZXhhbXBsZS5vcmeHBMAAAgGHECABDbgAAAAA
AAAAAAAAAAEwDQYJKoZIhvcNAQEFBQADggEBAKxPRe99SaghcI6IWT7UNkJw9aO9
i9eo0Fj2MUqxpKbdb9noRDy2CnHWf7EIYZ1gznXPdwzSN4YCjV5d+Q9xtBaowT0j
HPERs1ZuytCNNJTmhyqZ8q6uzMLoht4IqH/FBfpvgaeC5tBTnTT0rD5A/olXeimk
kX4LxlEx5RAvpGB2zZVRGr6LobD9rVK91xuHYNIxxxfEGE8tCCWjp0+3ksri9SXx
VHWBnbM9YaL32u3hxm8sYB/Yb8WSBavJCWJJqRStVRHM1koZlJmXNx2BX4vPo6iW
RFEIPQsFZRLrtnCAiEhyT8bC2s/Njlu6ly9gtJZWSV46Q3ZjBL4q9sHKqZQ=
-----END CERTIFICATE-----t   X509ExtTestsc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s=   
    Tests for :py:class:`OpenSSL.crypto.X509Extension`.
    c         C   s&  t  t |   j   t   |  _ |  j j t d  t   |  _ |  j j	 |  j  d |  j j
   _ t   |  _ |  j j
   |  _ |  j j
   j |  j _ |  j j |  j  |  j j	 |  j  t t j   j d   } t t j   t d d  j d   } |  j j |  |  j j |  d S(   s   
        Create a new private key and start a certificate request (for a test
        method to finish in one way or another).
        i  s   Yoda root CAs   %Y%m%d%H%M%SZt   daysid   N(   t   superR@   t   setUpR   t   pkeyt   generate_keyR   R   t   reqt
   set_pubkeyt   get_subjectt
   commonNameR   t   x509t   subjectt
   set_issuerR   R   t   nowt   strftimeR   t   set_notBeforet   set_notAfter(   t   selfRM   t   expire(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRC     s    (c         C   s5   d |  _ |  _ |  _ |  _ t t |   j   d S(   s   
        Forget all of the pyOpenSSL objects so they can be garbage collected,
        their memory released, and not interfere with the leak detection code.
        N(   t   NoneRD   RF   RJ   RK   RB   R@   t   tearDown(   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRT     s    c         C   s2   |  j  t t t d  t t d    d  d S(   s   
        The string representation of :py:class:`X509Extension` instances as returned by
        :py:data:`str` includes stuff.
        t   basicConstraintss   CA:falses   CA:FALSEN(   t   assertEqualst   strR   R   t   True(   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_str  s    !c         C   s9   |  j  t t  |  j t d t d  t t d   d S(   s   
        :py:class:`X509Extension` and :py:class:`X509ExtensionType` refer to the same type object
        and can be used to create instances of that type.
        R   RU   s   CA:trueN(   t   assertIdenticalR   R   t   assertConsistentTypeR   RX   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_type  s    c         C   s   t  t d  t t d   } |  j t | t  d | t |  t f  t  t d  t t d   } |  j t | t  d | t |  t f  d S(   s   
        :py:class:`X509Extension` accepts an extension type name, a critical flag,
        and an extension value and returns an :py:class:`X509ExtensionType` instance.
        RU   s   CA:trues   %r is of type %r, should be %rt	   nsComments   pyOpenSSL unit testN(   R   R   RX   t
   assertTruet
   isinstanceR   t   typet   False(   RQ   t   basict   comment(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_construction  s    c         C   ss   |  j  t t t d  t t d   |  j  t t t d  t t d   |  j  t t t d  t t d   d S(   ss   
        :py:class:`X509Extension` raises something if it is passed a bad extension
        name or value.
        t   thisIsMadeUpt   hiRU   s	   blah blaht   proxyCertInfos4   language:id-ppl-anyLanguage,pathlen:1,policy:text:ABN(   t   assertRaisesR   R   R   Ra   RX   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_extension  s    c         C   sf   t  t d  t t d   } |  j | j    t  t d  t t d   } |  j | j    d S(   sw   
        :py:meth:`X509ExtensionType.get_critical` returns the value of the
        extension's critical flag.
        RU   s   CA:trueN(   R   R   RX   R^   t   get_criticalRa   t   assertFalse(   RQ   t   ext(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_critical  s    c         C   sx   t  t d  t t d   } |  j | j   t d   t  t d  t t d   } |  j | j   t d   d S(   s   
        :py:meth:`X509ExtensionType.get_short_name` returns a string giving the short
        type name of the extension.
        RU   s   CA:trueR]   s   foo barN(   R   R   RX   t   assertEqualt   get_short_name(   RQ   Rl   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_short_name  s    c         C   s>   t  t d  t t d   } |  j | j   t d   d S(   sn   
        :py:meth:`X509Extension.get_data` returns a string giving the data of the
        extension.
        RU   s   CA:trues   0N(   R   R   RX   Rn   t   get_data(   RQ   Rl   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_data$  s    c         C   sd   t  t d  t t d   } |  j t | j d  |  j t | j d  |  j t | j d  d S(   sg   
        :py:meth:`X509Extension.get_data` raises :py:exc:`TypeError` if passed any arguments.
        RU   s   CA:truet   fooi   N(   R   R   RX   Rh   t	   TypeErrorRq   RS   (   RQ   Rl   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_data_wrong_args.  s    c         C   s   t  t d  t t d  d |  j } |  j j | g  |  j j |  j d  t t |  j  } |  j	 t d  | k  |  j	 t d  | k  d S(   s   
        The :py:data:`subject` parameter to :py:class:`X509Extension` may be provided for an
        extension which does not use it and is ignored in this case.
        RU   s   CA:TRUERK   t   sha1s   X509v3 Basic Constraints:N(
   R   R   Ra   RJ   t   add_extensionsR/   RD   R!   R    R^   (   RQ   t   ext1t   text(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_unused_subject8  s    $c         C   s   t  t d  t t d  d |  j } |  j j | g  |  j j |  j d  t t |  j  } |  j	 t d  | k  d S(   s   
        If an extension requires a subject, the :py:data:`subject` parameter to
        :py:class:`X509Extension` provides its value.
        t   subjectKeyIdentifiert   hashRK   Rv   s   X509v3 Subject Key Identifier:N(
   R   R   Ra   RJ   Rw   R/   RD   R!   R    R^   (   RQ   t   ext3Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_subjectG  s    $c         C   s)   |  j  t t t d  t t d   d S(   s   
        If an extension requires a subject and the :py:data:`subject` parameter is
        given no value, something happens.
        R{   R|   N(   Rh   R   R   R   Ra   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_missing_subjectT  s    c      	   C   sF   x? t  t   d g  |  g D]% } |  j t t d t d d | q Wd S(   s   
        If the :py:data:`subject` parameter is given a value which is not an
        :py:class:`X509` instance, :py:exc:`TypeError` is raised.
        t   helloRU   s   CA:TRUERK   N(   RX   t   objectRh   Rt   R   Ra   (   RQ   t   badObj(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_subject]  s
    c         C   s   t  t d  t t d  d |  j } |  j j | g  |  j j |  j d  t t |  j  } |  j	 t d  | k  |  j	 t d  | k  d S(   s   
        The :py:data:`issuer` parameter to :py:class:`X509Extension` may be provided for an
        extension which does not use it and is ignored in this case.
        RU   s   CA:TRUEt   issuerRv   s   X509v3 Basic Constraints:N(
   R   R   Ra   RJ   Rw   R/   RD   R!   R    R^   (   RQ   Rx   Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_unused_issueri  s    $c         C   s   t  t d  t t d  d |  j } |  j j | g  |  j j |  j d  t t |  j  } |  j	 t d  | k  |  j	 t d  | k  d S(   s   
        If an extension requires an issuer, the :py:data:`issuer` parameter to
        :py:class:`X509Extension` provides its value.
        t   authorityKeyIdentifiers   issuer:alwaysR   Rv   s    X509v3 Authority Key Identifier:s   DirName:/CN=Yoda root CAN(
   R   R   Ra   RJ   Rw   R/   RD   R!   R    R^   (   RQ   t   ext2Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_issuerw  s    c         C   s)   |  j  t t t d  t t d   d S(   s   
        If an extension requires an issue and the :py:data:`issuer` parameter is given
        no value, something happens.
        R   s   keyid:always,issuer:alwaysN(   Rh   R   R   R   Ra   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_missing_issuer  s
    c      	   C   sF   x? t  t   d g  |  g D]% } |  j t t d t d d | q Wd S(   s   
        If the :py:data:`issuer` parameter is given a value which is not an
        :py:class:`X509` instance, :py:exc:`TypeError` is raised.
        R   R   s   keyid:always,issuer:alwaysR   N(   RX   R   Rh   Rt   R   Ra   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_issuer  s    (   t   __name__t
   __module__t   __doc__RC   RT   RY   R\   Rd   Ri   Rm   Rp   Rr   Ru   Rz   R~   R   R   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR@     s&   										
	
								t	   PKeyTestsc           B   sh   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z RS(   s9   
    Unit tests for :py:class:`OpenSSL.crypto.PKey`.
    c         C   s$   |  j  t t  |  j t d  d S(   s   
        :py:class:`PKey` and :py:class:`PKeyType` refer to the same type object
        and can be used to create instances of that type.
        R   N(   RZ   R   R   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\     s    c         C   sL   |  j  t t d  t   } |  j t | t  d | t |  t f  d S(   sb   
        :py:class:`PKey` takes no arguments and returns a new :py:class:`PKey` instance.
        s   %r is of type %r, should be %rN(   Rh   Rt   R   RS   R^   R_   R   R`   (   RQ   t   key(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd     s
    	c         C   sL   t    } |  j | j   d  |  j | j   d  |  j t | j  d S(   s   
        :py:attr:`PKeyType.bits` and :py:attr:`PKeyType.type` return :py:data:`0` before the key is
        generated.  :py:attr:`PKeyType.check` raises :py:exc:`TypeError` before the key is
        generated.
        i    N(   R   Rn   R`   t   bitsRh   Rt   t   check(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_pregeneration  s    	c         C   s   t    } |  j t | j  |  j t | j d d d  |  j t | j d d  |  j t | j d d  |  j t | j t d  |  j t | j t d  d S(	   s  
        :py:meth:`PKeyType.generate_key` takes two arguments, the first giving the key
        type as one of :py:data:`TYPE_RSA` or :py:data:`TYPE_DSA` and the second giving the
        number of bits to generate.  If an invalid type is specified or
        generation fails, :py:exc:`Error` is raised.  If an invalid number of bits is
        specified, :py:exc:`ValueError` or :py:exc:`Error` is raised.
        i   i   i   Rs   t   barii    N(   R   Rh   Rt   RE   R   t
   ValueErrorR   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_failedGeneration  s    	c         C   sb   d } t    } | j t |  |  j | j   t  |  j | j   |  |  j | j    d S(   s   
        :py:meth:`PKeyType.generate_key` generates an RSA key when passed
        :py:data:`TYPE_RSA` as a type and a reasonable number of bits.
        i   N(   R   RE   R   Rn   R`   R   R^   R   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_rsaGeneration  s    	c         C   s#   d } t    } | j t |  d S(   s   
        :py:meth:`PKeyType.generate_key` generates a DSA key when passed
        :py:data:`TYPE_DSA` as a type and a reasonable number of bits.
        i   N(   R   RE   R   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dsaGeneration  s    	c         C   sr   t    } xb t d f t d f g D]H \ } } | j | |  |  j | j   |  |  j | j   |  q" Wd S(   s}   
        :py:meth:`PKeyType.generate_key` can be called multiple times on the same
        key to generate new keys.
        i   i@  N(   R   R   R   RE   Rn   R`   R   (   RQ   R   R`   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_regeneration  s
    	%c         C   s&   t  t t  } |  j t | j  d S(   s\   
        :py:`PKeyType.check` returns :py:exc:`Error` if the key is not consistent.
        N(   R   R   t   inconsistentPrivateKeyPEMRh   R   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_inconsistentKey  s    c         C   sR   |  j  t t   j d  |  j  t t   j t    |  j  t t   j d  d S(   sd   
        :py:meth:`PKeyType.check` raises :py:exc:`TypeError` if called with any arguments.
        i   N(   Rh   Rt   R   R   RS   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_check_wrong_args  s    c         C   sR   t    } | j t d  t   } | j |  | j   } |  j t | j  d S(   s   
        :py:meth:`PKeyType.check` raises :py:exc:`TypeError` if only the public
        part of the key is available.
        i   N(	   R   RE   R   R   RG   t
   get_pubkeyRh   Rt   R   (   RQ   R   t   certt   pub(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_check_public_key!  s    		(   R   R   R   R\   Rd   R   R   R   R   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR     s   					#						t   X509NameTestsc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z RS(   s=   
    Unit tests for :py:class:`OpenSSL.crypto.X509Name`.
    c         K   se   t    j   } t | j    } d   } | j d |  x$ | D] \ } } t | | |  qA W| S(   Nc         S   s   |  d S(   Ni   (    (   t   attr(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   9  s    R   (   R   RH   t   listt   itemst   sortt   setattr(   RQ   t   attrst   nameR   t   kt   v(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   _x509name4  s    	c         C   su   |  j  t t  |  j t j d  |  j t t t   |  j   } |  j t | t  d | t |  t f  d S(   sK   
        The type of X509Name objects is :py:class:`X509NameType`.
        R   s   %r is of type %r, should be %rN(	   RZ   R   R   Rn   R   R^   R_   R`   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   A  s    c         C   sB   |  j    } |  j t t | d d  |  j t t | d d  d S(   s   
        Attempting to set a non-:py:data:`str` attribute name on an :py:class:`X509NameType`
        instance causes :py:exc:`TypeError` to be raised.
        R   i   N(   R   Rh   Rt   R   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_onlyStringAttributesP  s    c         C   s)   |  j    } |  j t t | d d  d S(   s   
        Attempting to set any attribute name on an :py:class:`X509NameType` instance for
        which no corresponding NID is defined causes :py:exc:`AttributeError` to be
        raised.
        s   no such thingN(   R   Rh   t   AttributeErrorR   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_setInvalidAttributed  s    c         C   s   |  j    } d | _ |  j | j d  |  j | j d  d | _ |  j | j d  |  j | j d  d | _ |  j | j d  |  j | j d  d | _ |  j | j d  |  j | j d  d S(   sr   
        :py:class:`X509NameType` instances have attributes for each standard (?)
        X509Name field.
        Rs   t   bazR   t   quuxN(   R   RI   Rn   t   CN(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_attributesn  s    				c         C   s   |  j  d d d d  } t |  } |  j | j d  |  j | j d  d | _ |  j | j d  d | _ |  j | j d  d S(   s   
        :py:class:`X509Name` creates a new :py:class:`X509NameType` instance with all the same
        attributes as an existing :py:class:`X509NameType` instance when called with
        one.
        RI   Rs   t   emailAddresss   bar@example.comR   s   quux@example.comN(   R   R   Rn   RI   R   (   RQ   R   t   copy(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_copy  s    		c         C   s2   |  j  d d d d  } |  j t |  d  d S(   s   
        :py:func:`repr` passed an :py:class:`X509NameType` instance should return a string
        containing a description of the type and the NIDs which have been set
        on it.
        RI   Rs   R   R   s,   <X509Name object '/emailAddress=bar/CN=foo'>N(   R   Rn   t   repr(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_repr  s    	c            s  d        f d   }  j    } | | |  |  j     j     |  j  d d   j  d d   |  j  d d   j  d d   |  j  d d d d   j  d d d d      f d	   } |  j  d d   j  d d   |  j  d d   j  d d   d
      f d   } |  j  d d   j  d d     f d   } |  j  d d   j  d d   d S(   sX   
        :py:class:`X509NameType` instances should compare based on their NIDs.
        c         S   sQ   | |  | k d |  | f  | |  | k  | | |  k  | | |  k  d  S(   Ns   (%r == %r) --> False(    (   t   aR   R^   Rk   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   _equality  s    c            s     |  |  j   j  d  S(   N(   R^   Rk   (   R   R   (   R   RQ   (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRn     s    RI   Rs   R   t   organizationalUnitNameR   t   OUc            s     |  |  j   j  d  S(   N(   Rk   R^   (   R   R   (   R   RQ   (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   assertNotEqual  s    c         S   s   | |  | k   | |  | k  | | |  k  | | |  k  | |  | k  | |  | k  | | |  k   | | |  k  d  S(   N(    (   R   R   R^   Rk   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   _inequality  s    c            s     |  |  j   j  d  S(   N(   R^   Rk   (   R   R   (   R   RQ   (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   assertLessThan  s    t   abct   defc            s     |  |  j   j  d  S(   N(   Rk   R^   (   R   R   (   R   RQ   (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   assertGreaterThan  s    N(   R   (   RQ   Rn   R   R   R   R   (    (   R   R   RQ   s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_comparison  s.    		
c         C   si   |  j  d d  } |  j  d d  } |  j | j   | j    d | _ |  j | j   | j    d S(   sj   
        :py:meth:`X509Name.hash` returns an integer hash based on the value of the
        name.
        R   Rs   R   N(   R   Rn   R|   R   R   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_hash  s
    	c         C   s8   |  j  d d d d  } |  j | j   t d   d S(   sS   
        :py:meth:`X509Name.der` returns the DER encoded form of the name.
        R   Rs   t   Ct   USs   010	UUS10
UfooN(   R   Rn   t   derR   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_der  s    	c         C   s   |  j    } |  j | j   g   d | _ |  j | j   t d  t d  f g  d | _ |  j | j   t d  t d  f t d  t d  f g  d S(   s   
        :py:meth:`X509Name.get_components` returns a :py:data:`list` of
        two-tuples of :py:data:`str`
        giving the NIDs and associated values which make up the name.
        Rs   R   R   R   N(   R   Rn   t   get_componentsR   R   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_components  s    	+		c         C   s2   t  t t  } | j   } |  j d | j  d S(   s   
        An :py:class:`OpenSSL.crypto.X509Name` from an
        :py:class:`OpenSSL.crypto.X509` instance loaded from a file can have a
        NUL byte in the value of one of its attributes.
        s   null.python.org example.orgN(   R   R   t   nulbyteSubjectAltNamePEMRH   Rn   RI   (   RQ   R   RK   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_nul_byte_attribute  s    c         C   s-   |  j    } |  j t t | d d d  d S(   s   
        If the value of an attribute cannot be set for some reason then
        :py:class:`OpenSSL.crypto.Error` is raised.
        t   Ot   xi   N(   R   Rh   R   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_setAttributeFailure!  s    (   R   R   R   R   R\   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   0  s   				
				K				t   _PKeyInteractionTestsMixinc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s7   
    Tests which involve another thing and a PKey.
    c         C   s   t     d S(   s{   
        Return something with a :py:meth:`set_pubkey`, :py:meth:`set_pubkey`,
        and :py:meth:`sign` method.
        N(   t   NotImplementedError(   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   signable0  s    c         C   s2   |  j    } t   } |  j t | j | t  d S(   sy   
        :py:meth:`X509Req.sign` raises :py:exc:`ValueError` when pass a
        :py:class:`PKey` with no parts.
        N(   R   R   Rh   R   R/   t   GOOD_DIGEST(   RQ   t   requestR   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_signWithUngenerated8  s    	c         C   s[   |  j    } t   } | j t d  | j |  | j   } |  j t | j | t	  d S(   s   
        :py:meth:`X509Req.sign` raises :py:exc:`ValueError` when pass a
        :py:class:`PKey` with no private part as the signing key.
        i   N(
   R   R   RE   R   RG   R   Rh   R   R/   R   (   RQ   R   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_signWithPublicKeyB  s    	c         C   sB   |  j    } t   } | j t d  |  j t | j | t  d S(   s{   
        :py:meth:`X509Req.sign` raises :py:exc:`ValueError` when passed a digest name which is
        not known.
        i   N(   R   R   RE   R   Rh   R   R/   t
   BAD_DIGEST(   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_signWithUnknownDigestO  s    	c         C   s   |  j    } t   } | j t d  | j |  | j | t  t | d d  d k	 r | j	   } |  j
 | j |   t   } | j t d  |  j t | j |  n  d S(   s   
        :py:meth:`X509Req.sign` succeeds when passed a private key object and a valid
        digest function.  :py:meth:`X509Req.verify` can be used to check the signature.
        i   R0   N(   R   R   RE   R   RG   R/   R   t   getattrRS   R   R^   R0   Rh   R   (   RQ   R   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_signZ  s    		(   R   R   R   R   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   ,  s   		
		t   X509ReqTestsc           B   s   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z RS(   s7   
    Tests for :py:class:`OpenSSL.crypto.X509Req`.
    c         C   s   t    S(   s>   
        Create and return a new :py:class:`X509Req`.
        (   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   t  s    c         C   s$   |  j  t t  |  j t d  d S(   s   
        :py:obj:`X509Req` and :py:obj:`X509ReqType` refer to the same type object and can be
        used to create instances of that type.
        R   N(   RZ   R   R   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   {  s    c         C   s9   t    } |  j t | t  d | t |  t f  d S(   se   
        :py:obj:`X509Req` takes no arguments and returns an :py:obj:`X509ReqType` instance.
        s   %r is of type %r, should be %rN(   R   R^   R_   R   R`   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd     s    	c         C   si   t    } |  j | j   d  | j d  |  j | j   d  | j d  |  j | j   d  d S(   s   
        :py:obj:`X509ReqType.set_version` sets the X.509 version of the certificate
        request.  :py:obj:`X509ReqType.get_version` returns the X.509 version of
        the certificate request.  The initial value of the version is 0.
        i    i   i   N(   R   Rn   t   get_versiont   set_version(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_version  s    	c         C   se   t    } |  j t | j  |  j t | j d  |  j t | j d d  |  j t | j d  d S(   s  
        :py:obj:`X509ReqType.set_version` raises :py:obj:`TypeError` if called with the wrong
        number of arguments or with a non-:py:obj:`int` argument.
        :py:obj:`X509ReqType.get_version` raises :py:obj:`TypeError` if called with any
        arguments.
        Rs   i   i   N(   R   Rh   Rt   R   R   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_version_wrong_args  s
    	c         C   s   t    } | j   } |  j t | t  d | t |  t f  d | _ |  j | j   j d  ~ d | _ |  j | j d  d S(   s   
        :py:obj:`X509ReqType.get_subject` returns an :py:obj:`X509Name` for the subject of
        the request and which is valid even after the request object is
        otherwise dead.
        s   %r is of type %r, should be %rRs   R   N(   R   RH   R^   R_   R   R`   RI   Rn   (   RQ   R   RK   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_subject  s    			c         C   s#   t    } |  j t | j d  d S(   st   
        :py:obj:`X509ReqType.get_subject` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R   Rh   Rt   RH   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_subject_wrong_args  s    	c         C   s   t    } | j t t d  t t d   g  | j   } |  j t |  d  |  j | d j   t d   |  j | d j	   d  |  j | d j
   t d   d S(   s   
        :py:obj:`X509Req.add_extensions` accepts a :py:obj:`list` of :py:obj:`X509Extension`
        instances and adds them to the X509 request.
        RU   s   CA:falsei   i    t   0 N(   R   Rw   R   R   RX   t   get_extensionsRn   t   lenRo   Rj   Rq   (   RQ   R   t   exts(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_extensions  s    	" c         C   sB  t    } | j   } |  j | g   | j t t d  t t d   t t d  t t d   g  | j   } |  j t |  d  |  j | d j	   t d   |  j | d j
   d  |  j | d j   t d   |  j | d j	   t d   |  j | d j
   d  |  j | d j   t d	   d
 S(   s}   
        :py:obj:`X509Req.get_extensions` returns a :py:obj:`list` of
        extensions added to this X509 request.
        RU   s   CA:truet   keyUsaget   digitalSignaturei   i    i   s   0s   N(   R   R   Rn   Rw   R   R   RX   Ra   R   Ro   Rj   Rq   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_extensions  s    	"   c         C   sn   t    } |  j t | j  |  j t | j t    |  j t | j t   g  |  j t | j g  d  d S(   s4  
        :py:obj:`X509Req.add_extensions` raises :py:obj:`TypeError` if called with the wrong
        number of arguments or with a non-:py:obj:`list`.  Or it raises :py:obj:`ValueError`
        if called with a :py:obj:`list` containing objects other than :py:obj:`X509Extension`
        instances.
        N(   R   Rh   Rt   Rw   R   R   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_extensions_wrong_args  s
    	c         C   sX   t    } |  j t | j  |  j t | j t    |  j t | j t   t    d S(   s   
        :py:obj:`X509Req.verify` raises :py:obj:`TypeError` if called with zero
        arguments or more than one argument or if passed anything other than a
        :py:obj:`PKey` instance as its single argument.
        N(   R   Rh   Rt   R0   R   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_verify_wrong_args  s    	c         C   s,   t    } t   } |  j t | j |  d S(   s   
        :py:obj:`X509Req.verify` raises :py:obj:`OpenSSL.crypto.Error` if called
        with a :py:obj:`OpenSSL.crypto.PKey` which contains no key data.
        N(   R   R   Rh   R   R0   (   RQ   R   RD   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_verify_uninitialized_key  s    		c         C   sQ   t    } t t t  } | j | t  t t t  } |  j t | j	 |  d S(   s   
        :py:obj:`X509Req.verify` raises :py:obj:`OpenSSL.crypto.Error` if called
        with a :py:obj:`OpenSSL.crypto.PKey` which does not represent the public
        part of the key which signed the request.
        N(
   R   R   R   t   cleartextPrivateKeyPEMR/   R   t   client_key_pemRh   R   R0   (   RQ   R   RD   t   another_pkey(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_verify_wrong_key  s
    	c         C   sE   t    } t t t  } | j | t  |  j t | j |   d S(   s   
        :py:obj:`X509Req.verify` returns :py:obj:`True` if called with a
        :py:obj:`OpenSSL.crypto.PKey` which represents the public part of the key
        which signed the request.
        N(	   R   R   R   R   R/   R   Rn   RX   R0   (   RQ   R   RD   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_verify_success  s    	(   R   R   R   R   R\   Rd   R   R   R   R   R   R   R   R   R   R   R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   p  s   				
										
	t	   X509Testsc           B   s}  e  Z d  Z e e Z d Z d   Z d   Z d   Z	 d   Z
 d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! d   Z" d   Z# d   Z$ d    Z% d!   Z& d"   Z' d#   Z( d$   Z) d%   Z* d&   Z+ d'   Z, d(   Z- RS()   s2   
    Tests for :py:obj:`OpenSSL.crypto.X509`.
    s#  
-----BEGIN CERTIFICATE-----
MIIC3jCCAkegAwIBAgIJAJHFjlcCgnQzMA0GCSqGSIb3DQEBBQUAMEcxCzAJBgNV
BAYTAlNFMRUwEwYDVQQIEwxXZXN0ZXJib3R0b20xEjAQBgNVBAoTCUNhdGFsb2dp
eDENMAsGA1UEAxMEUm9vdDAeFw0wODA0MjIxNDQ1MzhaFw0wOTA0MjIxNDQ1Mzha
MFQxCzAJBgNVBAYTAlNFMQswCQYDVQQIEwJXQjEUMBIGA1UEChMLT3Blbk1ldGFk
aXIxIjAgBgNVBAMTGW5vZGUxLm9tMi5vcGVubWV0YWRpci5vcmcwgZ8wDQYJKoZI
hvcNAQEBBQADgY0AMIGJAoGBAPIcQMrwbk2nESF/0JKibj9i1x95XYAOwP+LarwT
Op4EQbdlI9SY+uqYqlERhF19w7CS+S6oyqx0DRZSk4Y9dZ9j9/xgm2u/f136YS1u
zgYFPvfUs6PqYLPSM8Bw+SjJ+7+2+TN+Tkiof9WP1cMjodQwOmdsiRbR0/J7+b1B
hec1AgMBAAGjgcQwgcEwCQYDVR0TBAIwADAsBglghkgBhvhCAQ0EHxYdT3BlblNT
TCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0OBBYEFIdHsBcMVVMbAO7j6NCj
03HgLnHaMB8GA1UdIwQYMBaAFL2h9Bf9Mre4vTdOiHTGAt7BRY/8MEYGA1UdEQQ/
MD2CDSouZXhhbXBsZS5vcmeCESoub20yLmV4bWFwbGUuY29thwSC7wgKgRNvbTJA
b3Blbm1ldGFkaXIub3JnMA0GCSqGSIb3DQEBBQUAA4GBALd7WdXkp2KvZ7/PuWZA
MPlIxyjS+Ly11+BNE0xGQRp9Wz+2lABtpgNqssvU156+HkKd02rGheb2tj7MX9hG
uZzbwDAZzJPjzDQDD7d3cWsrVcfIdqVU7epHqIadnOF+X0ghJ39pAm6VVadnSXCt
WpOdIpB8KksUTCzV591Nr1wd
-----END CERTIFICATE-----
    c         C   s   t    S(   s9   
        Create and return a new :py:obj:`X509`.
        (   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   A  s    c         C   s$   |  j  t t  |  j t d  d S(   s   
        :py:obj:`X509` and :py:obj:`X509Type` refer to the same type object and can be used
        to create instances of that type.
        R   N(   RZ   R   R   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   H  s    c         C   s   t    } |  j t | t  d | t |  t f  |  j t t  j d  |  j t |  j d  |  j t |  t  |  j t |  t   d S(   sb   
        :py:obj:`X509` takes no arguments and returns an instance of :py:obj:`X509Type`.
        s   %r is of type %r, should be %rR`   R   N(   R   R^   R_   R   R`   Rn   R   (   RQ   t   certificate(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd   Q  s    		c         C   s#   t    } |  j t | j d  d S(   sf   
        :py:obj:`X509.get_version` raises :py:obj:`TypeError` if invoked with any arguments.
        N(   R   Rh   Rt   R   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_version_wrong_argsa  s    	c         C   sO   t    } |  j t | j  |  j t | j d  |  j t | j d d  d S(   s   
        :py:obj:`X509.set_version` raises :py:obj:`TypeError` if invoked with the wrong number
        of arguments or an argument not of type :py:obj:`int`.
        i   N(   R   Rh   Rt   R   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_version_wrong_argsi  s    	c         C   s0   t    } | j d  |  j | j   d  d S(   s   
        :py:obj:`X509.set_version` sets the certificate version number.
        :py:obj:`X509.get_version` retrieves it.
        i  N(   R   R   RV   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   t  s    	c         C   s#   t    } |  j t | j d  d S(   st   
        :py:obj:`X509.get_serial_number` raises :py:obj:`TypeError` if invoked with any
        arguments.
        N(   R   Rh   Rt   t   get_serial_numberRS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt!   test_get_serial_number_wrong_args~  s    	c         C   s  t    } |  j t | j  |  j t | j d d  |  j t | j d  |  j t | j d  |  j | j   d  | j d  |  j | j   d  | j d  |  j | j   d  | j d  |  j | j   d  | j d  |  j | j   d  d	 S(   s   
        The serial number of an :py:obj:`X509Type` can be retrieved and modified with
        :py:obj:`X509Type.get_serial_number` and :py:obj:`X509Type.set_serial_number`.
        i   i   t   1g      @i    i    i@   i   NI       I      I       I      l            l           l            l           l	                    l	                   l	                    l	                   (   R   Rh   Rt   t   set_serial_numberRn   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_serial_number  s    	c         C   s%  t    } t | d |  } t | d |  } |  j |   d  t d  } | |  |  j |   |  t d  } | |  |  j |   |  t d  } | |  |  j |   |  |  j t | t d   |  j t |  |  j t | t d  t d   |  j t | t d   d S(   s   
        :py:obj:`X509Type.set_notBefore` takes a string in the format of an ASN1
        GENERALIZEDTIME and sets the beginning of the certificate's validity
        period to it.
        t   set_nott   get_nott   20040203040506Zs   20040203040506+0530s   20040203040506-0115s   foo barN(   R   R   Rn   RS   R   Rh   R   Rt   (   RQ   t   whichR   t   sett   gett   when(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   _setBoundTest  s"    	


"c         C   s   |  j  d  d S(   s   
        :py:obj:`X509Type.set_notBefore` takes a string in the format of an ASN1
        GENERALIZEDTIME and sets the beginning of the certificate's validity
        period to it.
        t   BeforeN(   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_notBefore  s    c         C   s   |  j  d  d S(   s   
        :py:obj:`X509Type.set_notAfter` takes a string in the format of an ASN1
        GENERALIZEDTIME and sets the end of the certificate's validity period
        to it.
        t   AfterN(   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_notAfter  s    c         C   s/   t  t t  } |  j | j   t d   d S(   s   
        :py:obj:`X509Type.get_notBefore` returns a string in the format of an ASN1
        GENERALIZEDTIME even for certificates which store it as UTCTIME
        internally.
        t   20090325123658ZN(   R   R   t   old_root_cert_pemRn   t   get_notBeforeR   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_notBefore  s    c         C   s/   t  t t  } |  j | j   t d   d S(   s   
        :py:obj:`X509Type.get_notAfter` returns a string in the format of an ASN1
        GENERALIZEDTIME even for certificates which store it as UTCTIME
        internally.
        t   20170611123658ZN(   R   R   R  Rn   t   get_notAfterR   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_notAfter  s    c         C   sO   t    } |  j t | j  |  j t | j d  |  j t | j d d  d S(   s   
        :py:obj:`X509Type.gmtime_adj_notBefore` raises :py:obj:`TypeError` if called with the
        wrong number of arguments or a non-:py:obj:`int` argument.
        i{   N(   R   Rh   Rt   t   gmtime_adj_notBeforeRS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt$   test_gmtime_adj_notBefore_wrong_args  s    	c         C   sa   t  t |  j  } t j   t d d  } | j d  |  j | j   t	 | j
 d    d S(   s   
        :py:obj:`X509Type.gmtime_adj_notBefore` changes the not-before timestamp to be
        the current time plus the number of seconds passed in.
        t   secondsid   s   %Y%m%d%H%M%SZN(   R   R   t   pemDataR   t   utcnowR   R  Rn   R  R   RN   (   RQ   R   RM   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_gmtime_adj_notBefore  s    c         C   sO   t    } |  j t | j  |  j t | j d  |  j t | j d d  d S(   s   
        :py:obj:`X509Type.gmtime_adj_notAfter` raises :py:obj:`TypeError` if called with the
        wrong number of arguments or a non-:py:obj:`int` argument.
        i{   N(   R   Rh   Rt   t   gmtime_adj_notAfterRS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt#   test_gmtime_adj_notAfter_wrong_args  s    	c         C   sa   t  t |  j  } t j   t d d  } | j d  |  j | j   t	 | j
 d    d S(   s   
        :py:obj:`X509Type.gmtime_adj_notAfter` changes the not-after timestamp to be
        the current time plus the number of seconds passed in.
        R  id   s   %Y%m%d%H%M%SZN(   R   R   R  R   R  R   R  Rn   R
  R   RN   (   RQ   R   RM   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_gmtime_adj_notAfter
  s    c         C   s#   t    } |  j t | j d  d S(   sq   
        :py:obj:`X509Type.has_expired` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R   Rh   Rt   t   has_expiredRS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_has_expired_wrong_args  s    	c         C   s-   t    } | j d  |  j | j    d S(   s   
        :py:obj:`X509Type.has_expired` returns :py:obj:`True` if the certificate's not-after
        time is in the past.
        iN(   R   R  R^   R  (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_has_expired  s    	c         C   s-   t    } | j d  |  j | j    d S(   s   
        :py:obj:`X509Type.has_expired` returns :py:obj:`False` if the certificate's not-after
        time is in the future.
        i   N(   R   R  Rk   R  (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_has_not_expired(  s    	c         C   s,   t  t t  } |  j | j d  d  d S(   s   
        :py:obj:`X509.digest` returns a string giving ":"-separated hex-encoded words
        of the digest of the certificate.
        R=   s/   19:B3:05:26:2B:F8:F2:FF:0B:8F:21:07:A8:28:B8:75N(   R   R   R  Rn   t   digest(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_digest2  s    c         C   s   t    } | j |  d | j   _ d | j   _ t t j   j d   } | j	 |  | j
 |  | j |  t t t t |   S(   Ns
   Unit Testss   %Y%m%d%H%M%SZ(   R   RG   RH   RI   t
   get_issuerR   R   RM   RN   RO   RP   Rw   R   R   R!   (   RQ   RD   t
   extensionsR   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   _extcertA  s    	c         C   s   t  t t  } t t d  t t d   } t t d  t t d   } t t d  t t d   } |  j | g   } |  j | j   d  |  j | | g  } |  j | j   d  |  j | | | | g  } |  j | j   d	  d
 S(   s   
        :py:obj:`X509.get_extension_count` returns the number of extensions that are
        present in the certificate.
        RU   s   CA:FALSER   R   t   subjectAltNames   DNS:example.comi    i   i   N(	   R   R   R   R   R   RX   R  Rn   t   get_extension_count(   RQ   RD   t   caR   R  t   c(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_extension_countO  s    c         C   s  t  t t  } t t d  t t d   } t t d  t t d   } t t d  t t d   } |  j | | | | g  } | j d  } |  j	 t
 | t   |  j	 | j    |  j | j   t d   | j d  } |  j	 t
 | t   |  j	 | j    |  j | j   t d   | j d	  } |  j	 t
 | t   |  j | j    |  j | j   t d   |  j t | j d
  |  j t | j d  |  j t | j d  d S(   s   
        :py:obj:`X509.get_extension` takes an integer and returns an :py:obj:`X509Extension`
        corresponding to the extension at that index.
        RU   s   CA:FALSER   R   R  s   DNS:example.comi    i   i   ii   R   N(   R   R   R   R   R   RX   Ra   R  t   get_extensionR^   R_   Rj   Rn   Ro   Rk   Rh   t
   IndexErrorRt   (   RQ   RD   R   R   R  R   Rl   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_extensiong  s*    c         C   s`   t  t t  } | j d  } |  j | j   t d   |  j t d  t t |    d S(   s   
        The fields of a `subjectAltName` extension on an X509 may contain NUL
        bytes and this value is reflected in the string representation of the
        extension object.
        i   R  s   DNS:altnull.python.org example.com, email:null@python.org user@example.org, URI:http://null.python.org http://example.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1
N(   R   R   R   R#  Rn   Ro   R   RW   (   RQ   R   Rl   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_nullbyte_subjectAltName  s    	c         C   s#   t    } |  j t | j t  d S(   sz   
        :py:obj:`X509.digest` raises :py:obj:`ValueError` if called with an unrecognized hash
        algorithm.
        N(   R   Rh   R   R  R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_digest_algorithm  s    	c         C   s#   t    } |  j t | j d  d S(   se   
        :py:obj:`X509.get_subject` raises :py:obj:`TypeError` if called with any arguments.
        N(   R   Rh   Rt   RH   RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR     s    	c      	   C   s   t  t |  j  } | j   } |  j t | t   |  j | j   t	 d  t	 d  f t	 d  t	 d  f t	 d  t	 d  f t	 d  t	 d  f t	 d	  t	 d
  f g  d S(   sT   
        :py:obj:`X509.get_subject` returns an :py:obj:`X509Name` instance.
        R   R   t   STt   ILt   Lt   ChicagoR   t   TestingR   s   Testing Root CAN(
   R   R   R  RH   R^   R_   R   RV   R   R   (   RQ   R   t   subj(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR     s    	?c         C   sU   t    } |  j t | j  |  j t | j d  |  j t | j | j   d  d S(   s   
        :py:obj:`X509.set_subject` raises a :py:obj:`TypeError` if called with the wrong
        number of arguments or an argument not of type :py:obj:`X509Name`.
        N(   R   Rh   Rt   t   set_subjectRS   RH   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_subject_wrong_args  s    	c         C   s~   t    } | j   } d | _ d | _ | j |  |  j | j   j   t d  t d  f t d  t d  f g  d S(   sq   
        :py:obj:`X509.set_subject` changes the subject of the certificate to the one
        passed in.
        t   AUs
   Unit TestsR   R   N(   R   RH   R   R   R.  RV   R   R   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_subject  s    			c         C   s#   t    } |  j t | j d  d S(   sd   
        :py:obj:`X509.get_issuer` raises :py:obj:`TypeError` if called with any arguments.
        N(   R   Rh   Rt   R  RS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_issuer_wrong_args  s    	c      	   C   s   t  t |  j  } | j   } |  j t | t   | j   } |  j | t	 d  t	 d  f t	 d  t	 d  f t	 d  t	 d  f t	 d  t	 d  f t	 d	  t	 d
  f g  d S(   sS   
        :py:obj:`X509.get_issuer` returns an :py:obj:`X509Name` instance.
        R   R   R(  R)  R*  R+  R   R,  R   s   Testing Root CAN(
   R   R   R  R  R^   R_   R   R   RV   R   (   RQ   R   R-  t   comp(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_issuer  s    ?c         C   sU   t    } |  j t | j  |  j t | j d  |  j t | j | j   d  d S(   s   
        :py:obj:`X509.set_issuer` raises a :py:obj:`TypeError` if called with the wrong
        number of arguments or an argument not of type :py:obj:`X509Name`.
        N(   R   Rh   Rt   RL   RS   R  (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_issuer_wrong_args  s    	c         C   s~   t    } | j   } d | _ d | _ | j |  |  j | j   j   t d  t d  f t d  t d  f g  d S(   so   
        :py:obj:`X509.set_issuer` changes the issuer of the certificate to the one
        passed in.
        R0  s
   Unit TestsR   R   N(   R   R  R   R   RL   RV   R   R   (   RQ   R   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_issuer  s    			c         C   s    t    } |  j t | j  d S(   s   
        When called on a certificate with no public key, :py:obj:`X509.get_pubkey`
        raises :py:obj:`OpenSSL.crypto.Error`.
        N(   R   Rh   R   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_pubkey_uninitialized  s    	c         C   s#   t    } |  j t | j d  d S(   ss   
        :py:obj:`X509.subject_name_hash` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R   Rh   Rt   t   subject_name_hashRS   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt!   test_subject_name_hash_wrong_args  s    	c         C   s2   t  t |  j  } |  j | j   d d g  d S(   sn   
        :py:obj:`X509.subject_name_hash` returns the hash of the certificate's subject
        name.
        I    I8Vp    N(   R   R   R  t   assertInR8  (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_subject_name_hash  s
    	c         C   s2   t  t |  j  } |  j t d  | j    d S(   s   
        :py:obj:`X509Type.get_signature_algorithm` returns a string which means
        the algorithm used to sign the certificate.
        t   sha1WithRSAEncryptionN(   R   R   R  Rn   R   t   get_signature_algorithm(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_signature_algorithm!  s    c         C   s2   t  d  } t t |  } |  j t | j  d S(   s   
        :py:obj:`X509Type.get_signature_algorithm` raises :py:obj:`ValueError` if the
        signature algorithm is undefined or unknown.
        sK  -----BEGIN CERTIFICATE-----
MIIC/zCCAmigAwIBAgIBATAGBgJ8BQUAMHsxCzAJBgNVBAYTAlNHMREwDwYDVQQK
EwhNMkNyeXB0bzEUMBIGA1UECxMLTTJDcnlwdG8gQ0ExJDAiBgNVBAMTG00yQ3J5
cHRvIENlcnRpZmljYXRlIE1hc3RlcjEdMBsGCSqGSIb3DQEJARYObmdwc0Bwb3N0
MS5jb20wHhcNMDAwOTEwMDk1MTMwWhcNMDIwOTEwMDk1MTMwWjBTMQswCQYDVQQG
EwJTRzERMA8GA1UEChMITTJDcnlwdG8xEjAQBgNVBAMTCWxvY2FsaG9zdDEdMBsG
CSqGSIb3DQEJARYObmdwc0Bwb3N0MS5jb20wXDANBgkqhkiG9w0BAQEFAANLADBI
AkEArL57d26W9fNXvOhNlZzlPOACmvwOZ5AdNgLzJ1/MfsQQJ7hHVeHmTAjM664V
+fXvwUGJLziCeBo1ysWLRnl8CQIDAQABo4IBBDCCAQAwCQYDVR0TBAIwADAsBglg
hkgBhvhCAQ0EHxYdT3BlblNTTCBHZW5lcmF0ZWQgQ2VydGlmaWNhdGUwHQYDVR0O
BBYEFM+EgpK+eyZiwFU1aOPSbczbPSpVMIGlBgNVHSMEgZ0wgZqAFPuHI2nrnDqT
FeXFvylRT/7tKDgBoX+kfTB7MQswCQYDVQQGEwJTRzERMA8GA1UEChMITTJDcnlw
dG8xFDASBgNVBAsTC00yQ3J5cHRvIENBMSQwIgYDVQQDExtNMkNyeXB0byBDZXJ0
aWZpY2F0ZSBNYXN0ZXIxHTAbBgkqhkiG9w0BCQEWDm5ncHNAcG9zdDEuY29tggEA
MA0GCSqGSIb3DQEBBAUAA4GBADv8KpPo+gfJxN2ERK1Y1l17sz/ZhzoGgm5XCdbx
jEY7xKfpQngV599k1xhl11IMqizDwu0855agrckg2MCTmOI9DZzDD77tAYb+Dk0O
PEVk0Mk/V0aIsDE9bolfCi/i/QWZ3N8s5nTWMNyBBBmoSliWCm4jkkRZRD0ejgTN
tgI5
-----END CERTIFICATE-----
N(   R   R   R   Rh   R   R=  (   RQ   t   certPEMR   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt&   test_get_undefined_signature_algorithm+  s    	(.   R   R   R   t   cleartextCertificatePEMR   R  t   extpemR   R\   Rd   R   R   R   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R"  R%  R&  R'  R   R   R/  R1  R2  R4  R5  R6  R7  R9  R;  R>  R@  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   '  sT   
							
				'					
	
							
	
				!																	
t   X509StoreTestsc           B   s2   e  Z d  Z d   Z d   Z d   Z d   Z RS(   s6   
    Test for :py:obj:`OpenSSL.crypto.X509Store`.
    c         C   s$   |  j  t t  |  j t d  d S(   s;   
        :py:obj:`X509StoreType` is a type object.
        R   N(   RZ   R   R   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   P  s    c         C   sX   t    } |  j t | j  |  j t | j t    |  j t | j t   t    d  S(   N(   R   Rh   Rt   t   add_certR   R   (   RQ   t   store(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_cert_wrong_argsX  s    	c         C   s)   t  t t  } t   } | j |  d S(   so   
        :py:obj:`X509Store.add_cert` adds a :py:obj:`X509` instance to the
        certificate store.
        N(   R   R   RA  R   RD  (   RQ   R   RE  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_cert_  s    	c         C   s?   t  t t  } t   } | j |  |  j t | j |  d S(   s   
        :py:obj:`X509Store.add_cert` raises :py:obj:`OpenSSL.crypto.Error` if an
        attempt is made to add the same certificate to the store more than once.
        N(   R   R   RA  R   RD  Rh   R   (   RQ   R   RE  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_cert_rejects_duplicatei  s    	(   R   R   R   R\   RF  RG  RH  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRC  L  s
   			
t   PKCS12Testsc           B   s&  e  Z d  Z e e Z d   Z d   Z d   Z d   Z	 d   Z
 d d d d d  Z d d d d d d  Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z  d   Z! RS(   s\   
    Test for :py:obj:`OpenSSL.crypto.PKCS12` and :py:obj:`OpenSSL.crypto.load_pkcs12`.
    c         C   s$   |  j  t t  |  j t d  d S(   s8   
        :py:obj:`PKCS12Type` is a type object.
        R'   N(   RZ   R'   R(   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   {  s    c         C   se   t    } |  j d | j    |  j d | j    |  j d | j    |  j d | j    d S(   s   
        :py:obj:`PKCS12` returns a new instance of :py:obj:`PKCS12` with no certificate,
        private key, CA certificates, or friendly name.
        N(   R'   Rn   RS   t   get_certificatet   get_privatekeyt   get_ca_certificatest   get_friendlyname(   RQ   t   p12(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_empty_construction  s
    	c         C   s$  t    } |  j t | j d  |  j t | j t    |  j t | j t  |  j t | j d  |  j t | j d  |  j t | j t    |  j t | j d  |  j t | j t    |  j t | j d  |  j t | j t   f  |  j t | j d  |  j t | j d	  d S(
   s  
        The :py:obj:`PKCS12` setter functions (:py:obj:`set_certificate`, :py:obj:`set_privatekey`,
        :py:obj:`set_ca_certificates`, and :py:obj:`set_friendlyname`) raise :py:obj:`TypeError`
        when passed objects of types other than those expected.
        i   t   legbonei   i   Rs   R   N(   i   i   (   s   foos   bar(	   R'   Rh   Rt   t   set_certificateR   R   t   set_privatekeyt   set_ca_certificatest   set_friendlyname(   RQ   RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_errors  s    	c         C   s   d } t    } t t t  } | j |  |  j d | j    |  j | | j    y" | j	 d | d d d d  } Wn t
 k
 r d SXt | |  } |  j d | j    |  j d | j    |  j t | j   t t d  f   d S(   s   
        A :py:obj:`PKCS12` with only a private key can be exported using
        :py:obj:`PKCS12.export` and loaded again using :py:obj:`load_pkcs12`.
        t   blaht
   passphraset   iteri   t   maciteri   N(   R'   R   R   R   RR  Rn   RS   RJ  RK  t   exportR   R)   RL  R^   R_   R   R`   (   RQ   t   passwdRN  RD   t
   dumped_p12(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_key_only  s    	"c         C   s  d } t    } t t t  } | j |  |  j | | j    |  j d | j    y" | j	 d | d d d d  } Wn t
 k
 r d SXt | |  } |  j d | j    |  j t | j   t t d  f   |  j t t t | j   d   d S(	   s   
        A :py:obj:`PKCS12` with only a certificate can be exported using
        :py:obj:`PKCS12.export` and loaded again using :py:obj:`load_pkcs12`.
        RV  RW  RX  i   RY  i   Ni    (   R'   R   R   RA  RQ  Rn   RJ  RS   RK  RZ  R   R)   R^   R_   R   R`   R!   RL  (   RQ   R[  RN  R   R\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_cert_only  s     	"(c         C   s   t    } | r: | j t t |   } |  j | d  n  | rk | j t t |   } |  j | d  n  | r | j t t |  f  } |  j | d  n  | r | j	 |  } |  j | d  n  | S(   sx   
        Generate a PKCS12 object with components from PEM.  Verify that the set
        functions return None.
        N(
   R'   RQ  R   R   Rn   RS   RR  R   RS  RT  (   RQ   t   cert_pemt   key_pemt   ca_pemt   friendly_nameRN  t   ret(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt
   gen_pkcs12  s    	t    c   	   	   C   s   | rF t  | d d d d d | |  } |  j | t |  |  n  | r t  | d d d d d | d |  } |  j | t |  |  n  | r t  | d d d d d | d |  } |  j | t |  |  n  d	 S(
   so   
        Use openssl program to confirm three components are recoverable from a
        PKCS12 string.
        t   pkcs12s   -nocertss   -nodess   -passins   pass:s   -clcertss   -nokeyss   -cacertsN(   t   _runopensslRn   R   (	   RQ   t   p12_strR   R   R   R[  t   extrat   recovered_keyt   recovered_cert(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   check_recovery  s    c         C   sV   t  t | j    } t t | j    } |  j t t d f | | | j	   f  d S(   s   
        Verify that the PKCS#12 container contains the correct client
        certificate and private key.

        :param p12: The PKCS12 instance to verify.
        :type p12: :py:class:`PKCS12`
        N(
   R!   R   RJ  R$   RK  Rn   t   client_cert_pemR   RS   RL  (   RQ   RN  R_  R`  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   verify_pkcs12_container  s
    c         C   sR   d } t  t } t | d d d d d |  } t | d | } |  j |  d S(	   s   
        A PKCS12 string generated using the openssl command line can be loaded
        with :py:obj:`load_pkcs12` and its components extracted and examined.
        t   whateverRf  s   -exports   -clcertss   -passouts   pass:RW  N(   R   Rm  Rg  R)   Rn  (   RQ   R[  R8   Rh  RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs12  s    
c      	   C   s   t  t } d } t | d d d d d |  } t d t  i } t d  t | d	 d j d
  } |  j d j	 t
  t | d j   |  j | d j t  Wd QX|  j |  d S(   s   
        A PKCS12 string generated using the openssl command line can be loaded
        with :py:obj:`load_pkcs12` and its components extracted and examined.
        Using text as passphrase instead of bytes. DeprecationWarning expected.
        Ro  Rf  s   -exports   -clcertss   -passouts   pass:t   recordt   alwaysRW  t   asciis3   {0} for passphrase is no longer accepted, use bytesiN(   R   Rm  Rg  R   RX   R   R)   t   decodeRn   t   formatR5   RW   t   messaget   assertIst   categoryt   DeprecationWarningRn  (   RQ   R8   R[  Rh  t   wRN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt    test_load_pkcs12_text_passphrase*  s    

c         C   sB   t  t } t | d d d d d  } t |  } |  j |  d S(   s   
        A PKCS12 string generated using openssl command line can be loaded with
        :py:obj:`load_pkcs12` without a passphrase and its components extracted
        and examined.
        Rf  s   -exports   -clcertss   -passouts   pass:N(   R   Rm  Rg  R)   Rn  (   RQ   R8   Rh  RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs12_no_passphraseC  s
    
c         C   s@   |  j  t t  } | j d | d d d d  } t | d | S(   sC   
        A helper method to dump and load a PKCS12 object.
        RW  RX  i   RY  i   (   Rd  Rm  R   RZ  R)   (   RQ   t   dump_passphraset   load_passphraseRN  R\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   _dump_and_loadP  s    c         C   s#   |  j  |  j d d d d   d S(   s   
        A PKCS12 string can be dumped with a null passphrase, loaded with an
        empty passphrase with :py:obj:`load_pkcs12`, and its components
        extracted and examined.
        R}  R~  Re  N(   Rn  R  RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt+   test_load_pkcs12_null_passphrase_load_emptyY  s    c         C   s#   |  j  |  j d d d d   d S(   s   
        A PKCS12 string can be dumped with a null passphrase, loaded with a
        null passphrase with :py:obj:`load_pkcs12`, and its components
        extracted and examined.
        R}  R~  N(   Rn  R  RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt*   test_load_pkcs12_null_passphrase_load_nullc  s    c         C   s#   |  j  |  j d d d d   d S(   s   
        A PKCS12 string can be dumped with an empty passphrase, loaded with an
        empty passphrase with :py:obj:`load_pkcs12`, and its components
        extracted and examined.
        R}  Re  R~  N(   Rn  R  (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt,   test_load_pkcs12_empty_passphrase_load_emptym  s    c         C   s#   |  j  |  j d d d d   d S(   s   
        A PKCS12 string can be dumped with an empty passphrase, loaded with a
        null passphrase with :py:obj:`load_pkcs12`, and its components
        extracted and examined.
        R}  Re  R~  N(   Rn  R  RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt+   test_load_pkcs12_empty_passphrase_load_nullw  s    c         C   sb   d } |  j  t t d |  } |  j | j d d d d  |  j t | j d d  d  d S(   s   
        :py:obj:`load_pkcs12` raises :py:obj:`OpenSSL.crypto.Error` when passed a string
        which is not a PKCS12 dump.
        Ro  s   fruit loopsi    s   asn1 encoding routinesi   N(   Rh   R   R)   Rn   t   argsR   (   RQ   R[  t   e(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs12_garbage  s    c         C   s  |  j  t t t  } | j t t t   | j t	 t t
   t t t  } t t t  } | j | g  |  j d t | j     |  j | | j   d  | j | | g  |  j d t | j     |  j | | j   d  |  j | | j   d  d S(   s   
        :py:obj:`PKCS12.set_certificate` replaces the certificate in a PKCS12 cluster.
        :py:obj:`PKCS12.set_privatekey` replaces the private key.
        :py:obj:`PKCS12.set_ca_certificates` replaces the CA certificates.
        i   i    i   N(   Rd  Rm  R   t   root_cert_pemRQ  R   R   t   server_cert_pemRR  R   t   server_key_pemRS  Rn   R   RL  (   RQ   RN  t	   root_certt   client_cert(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_replace  s    c         C   s   d } |  j  t t t  } x t d  d t d  g D] } | j |  |  j | j   |  | j	 d | d d d d  } t
 | |  } |  j | j   | j    |  j | d	 t d
 t d t d | q7 Wd S(   s  
        The *friendlyName* of a PKCS12 can be set and retrieved via
        :py:obj:`PKCS12.get_friendlyname` and :py:obj:`PKCS12_set_friendlyname`, and a
        :py:obj:`PKCS12` with a friendly name set can be dumped with :py:obj:`PKCS12.export`.
        s$   Dogmeat[]{}!@#$%^&*()~`?/.,<>-_+=";:t   Serverliciouss   ###RW  RX  i   RY  i   R   R   R   R[  N(   Rd  R  R  R  R   RS   RT  Rn   RM  RZ  R)   Rl  (   RQ   R[  RN  Rb  R\  t   reloaded_p12(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_friendly_name  s    "c         C   s   |  j  t t t  } d } | j d d d d d |  } | j d d d d d d  } | j d d d d	  } x< | | | g D]+ } |  j | d
 t d t d t d | q Wd S(   sf   
        Test that missing, None, and '' passphrases are identical for PKCS12
        export.
        Re  RX  i   RY  i    RW  i   i	   i   R   R   R   R[  N(   Rd  Rm  R   R  RZ  RS   Rl  (   RQ   RN  R[  t   dumped_p12_emptyt   dumped_p12_nonet   dumped_p12_nopwR\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_various_empty_passphrases  s    c         C   s<   |  j  t t t  } | j d  |  j d | j    d S(   su   
        Passing :py:obj:`None` to :py:obj:`PKCS12.set_ca_certificates` removes all CA
        certificates.
        N(   Rd  R  R  R  RS  RS   Rn   RL  (   RQ   RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_removing_ca_cert  s    c      
   C   sb   d } |  j  t t t  } | j d d d | d d  } |  j | d t d t d	 | d
 d d S(   sj   
        Exporting a PKCS12 with a :py:obj:`maciter` of ``-1`` excludes the MAC
        entirely.
        s   Lake MichiganRY  iRW  RX  i   R   R   R[  Ri  s	   -nomacverN(   s	   -nomacver(   Rd  R  R  R  RZ  Rl  (   RQ   R[  RN  R\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_without_mac  s    c         C   sz   d } |  j  t t t  } | j d d d | d d  } y) t | |  } |  j t | t   Wn t	 k
 ru n Xd S(   sQ   
        Loading a PKCS12 without a MAC does something other than crash.
        s   Lake MichiganRY  iRW  RX  i   N(
   Rd  R  R  R  RZ  R)   R^   R_   R'   R   (   RQ   R[  RN  R\  t   recovered_p12(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_without_mac  s    c         C   s   d } |  j  t t  } d S(   sN   
        A PKCS12 with an empty CA certificates list can be exported.
        s   Hobie 18N(   Rd  R  R  (   RQ   R[  RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_zero_len_list_for_ca  s    c         C   sD   |  j  t t t  } | j   } |  j | d t d t d d d S(   sL   
        All the arguments to :py:obj:`PKCS12.export` are optional.
        R   R   R[  Re  N(   Rd  R  R  R  RZ  Rl  (   RQ   RN  R\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_without_args	  s    c      	   C   s   |  j  t t t  } t d t  i } t d  | j d d j d   } |  j	 d j
 t  t | d j   |  j | d j t  Wd QX|  j | d	 t d
 t d d d S(   sP   
        Test :py:obj:`PKCS12.export` with text not bytes as passphrase
        Rq  Rr  RW  t
   randomtextRs  s3   {0} for passphrase is no longer accepted, use bytesiNR   R   R[  (   Rd  R  R  R  R   RX   R   RZ  Rt  Rn   Ru  R5   RW   Rv  Rw  Rx  Ry  Rl  (   RQ   RN  Rz  R\  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_without_bytes	  s    
c         C   s,   |  j  t t t  } |  j t | j  d S(   sj   
        :py:obj:`PKCS12.export` raises an exception when a key and certificate
        mismatch.
        N(   Rd  R  R   R  Rh   R   RZ  (   RQ   RN  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_key_cert_mismatch 	  s    N(    ("   R   R   R   RA  R   R  R\   RO  RU  R]  R^  RS   Rd  Rl  Rn  Rp  R{  R|  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRI  u  s<   
					#							
	
	
	
					
				
	s   (\\*)"s   (\\+)\Zc         C   s*   t  j d t j d |    }  d |  d S(   sE  
    Internal method for quoting a single command-line argument.

    See http://www.perlmonks.org/?node_id=764004

    :type: :py:obj:`str`
    :param s: A single unquoted string to quote for something that is expecting
        cmd.exe-style quoting

    :rtype: :py:obj:`str`
    :return: A cmd.exe-style quoted string
    s   \1\1s   \1\1\\"t   "(   t   _cmdLineQuoteRe2t   subt   _cmdLineQuoteRe(   t   s(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   cmdLineQuote-	  s    c         C   s   d j  t t |    S(   s  
    Quote an iterable of command-line arguments for passing to CreateProcess or
    a similar API.  This allows the list passed to :py:obj:`reactor.spawnProcess` to
    match the child process's :py:obj:`sys.argv` properly.

    :type arguments: :py:obj:`iterable` of :py:obj:`str`
    :param arguments: An iterable of unquoted arguments to quote

    :rtype: :py:obj:`str`
    :return: A space-delimited string containing quoted versions of :py:obj:`arguments`
    t    (   t   joint   mapR  (   t	   arguments(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   quoteArguments?	  s    c         G   s   t  j d k rL d d j g  | D]  } d | j d d  d ^ q  } n d t |  } t t |  d t d t d t } | j	 j
 |   | j	 j   | j j   } | j j   | j   | S(	   s   
    Run the command line openssl tool with the given arguments and write
    the given PEM to its stdin.  Not safe for quotes.
    t   posixs   openssl R  t   's   '\''t   shellt   stdint   stdout(   t   osR   R  t   replaceR  R   R6   RX   R   R  t   writet   closeR  t   readt   wait(   R8   R  t   argt   commandt   proct   output(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRg  O	  s    	1$
t   FunctionTestsc           B   s
  e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sJ   
    Tests for free-functions in the :py:obj:`OpenSSL.crypto` module.
    c         C   s   |  j  t t d t  d S(   sf   
        :py:obj:`load_privatekey` raises :py:obj:`ValueError` if passed an unknown filetype.
        id   N(   Rh   R   R   t   root_key_pem(   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt#   test_load_privatekey_invalid_formati	  s    c         C   s    |  j  t t t t t    d S(   s   
        :py:obj:`load_privatekey` raises :py:obj:`TypeError` if passed a passphrase that is
        neither a :py:obj:`str` nor a callable.
        N(   Rh   Rt   R   R   t    encryptedPrivateKeyPEMPassphraseR   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt,   test_load_privatekey_invalid_passphrase_typep	  s    c         C   s   |  j  t t  d S(   s|   
        :py:obj:`load_privatekey` raises :py:obj:`TypeError` if called with the wrong number
        of arguments.
        N(   Rh   Rt   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_privatekey_wrong_args{	  s    c         C   s#   |  j  t t t t t d   d S(   s   
        :py:obj:`load_privatekey` raises :py:obj:`OpenSSL.crypto.Error` when it is passed an
        encrypted PEM and an incorrect passphrase.
        t   quackN(   Rh   R   R   R   t   encryptedPrivateKeyPEMR   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt$   test_load_privatekey_wrongPassphrase	  s    c         C   s;   t  t t  } t t |  } |  j t t  t | d  d S(   s   
        :py:obj:`load_privatekey` raises :py:obj:`ValueError` when it is passed a passphrase
        with a private key encoded in a format, that doesn't support
        encryption.
        t   secretN(   R   R   R   R$   R   Rh   R   (   RQ   R   t   blob(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt(   test_load_privatekey_passphraseWrongType	  s    	c         C   s,   t  t t t  } |  j t | t   d S(   s   
        :py:obj:`load_privatekey` can create a :py:obj:`PKey` object from an encrypted PEM
        string if given the passphrase.
        N(   R   R   R  R  R^   R_   R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_privatekey_passphrase	  s    	c         C   s&   d   } |  j  t t t t |  d S(   s   
        If the passphrase callback raises an exception, that exception is raised
        by :py:obj:`load_privatekey`.
        c         S   s
   t   d  S(   N(   t   ArithmeticError(   t   ignored(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   cb	  s    N(   Rh   R  R   R   R  (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt)   test_load_privatekey_passphrase_exception	  s    		c            s?   g      f d   } |  j  t t t t |  |  j    d S(   s   
        :py:obj:`load_privatekey` raises :py:obj:`OpenSSL.crypto.Error` when it
        is passed an encrypted PEM and a passphrase callback which returns an
        incorrect passphrase.
        c             s     j  d   t d  S(   NR  (   t   appendRS   R   (   R   (   t   called(    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  	  s    N(   Rh   R   R   R   R  R^   (   RQ   R  (    (   R  s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt,   test_load_privatekey_wrongPassphraseCallback	  s    c            sT   g      f d   } t  t t |  } |  j t | t   |  j   t g  d S(   s   
        :py:obj:`load_privatekey` can create a :py:obj:`PKey` object from an encrypted PEM
        string if given a passphrase callback which returns the correct
        password.
        c            s     j  |   t S(   N(   R  R  (   t   writing(   R  (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  	  s    N(   R   R   R  R^   R_   R   Rn   Ra   (   RQ   R  R   (    (   R  s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt'   test_load_privatekey_passphraseCallback	  s
    c         C   s    |  j  t t t t d    d S(   s   
        :py:obj:`load_privatekey` raises :py:obj:`ValueError` if the passphrase
        callback returns something other than a byte string.
        c          W   s   d S(   Ni   (    (   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   <lambda>	  s    N(   Rh   R   R   R   R  (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt1   test_load_privatekey_passphrase_wrong_return_type	  s    c         C   s0   |  j  t t  |  j  t t t t   t  d S(   s|   
        :py:obj:`dump_privatekey` raises :py:obj:`TypeError` if called with the wrong number
        of arguments.
        N(   Rh   Rt   R$   R   R   t   GOOD_CIPHER(   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_privatekey_wrong_args	  s    c         C   s9   t    } | j t d  |  j t t t | t d  d S(   s{   
        :py:obj:`dump_privatekey` raises :py:obj:`ValueError` if called with an unrecognized
        cipher name.
        i   RW  N(   R   RE   R   Rh   R   R$   R   t
   BAD_CIPHER(   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt#   test_dump_privatekey_unknown_cipher	  s
    	c         C   s<   t    } | j t d  |  j t t t | t t    d S(   s   
        :py:obj:`dump_privatekey` raises :py:obj:`TypeError` if called with a passphrase which
        is neither a :py:obj:`str` nor a callable.
        i   N(	   R   RE   R   Rh   Rt   R$   R   R  R   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt,   test_dump_privatekey_invalid_passphrase_type	  s
    	c         C   s3   t    } | j t d  |  j t t d |  d S(   sx   
        :py:obj:`dump_privatekey` raises :py:obj:`ValueError` if called with an unrecognized
        filetype.
        i   id   N(   R   RE   R   Rh   R   R$   (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt%   test_dump_privatekey_invalid_filetype	  s    	c         C   s&   d   } |  j  t t t t |  d S(   s   
        :py:obj:`crypto.load_privatekey` should raise an error when the passphrase
        provided by the callback is too long, not silently truncate it.
        c         S   s   d d S(   NR   i  (    (   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s    N(   Rh   R   R   R   R  (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt-   test_load_privatekey_passphraseCallbackLength
  s    		c         C   s   t  d  } t t t  } t t | t |  } |  j t | t   t t | |  } |  j t | t	   |  j
 | j   | j    |  j
 | j   | j    d S(   s\   
        :py:obj:`dump_privatekey` writes an encrypted PEM when given a passphrase.
        Rs   N(   R   R   R   R   R$   R  R^   R_   R	   R   Rn   R`   R   (   RQ   RW  R   R8   t	   loadedKey(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_privatekey_passphrase
  s    c         C   s/   t  t t  } |  j t t t | t d  d S(   s   
        :py:obj:`dump_privatekey` raises :py:obj:`ValueError` when it is passed a passphrase
        with a private key encoded in a format, that doesn't support
        encryption.
        R  N(   R   R   R   Rh   R   R$   R   R  (   RQ   R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt(   test_dump_privatekey_passphraseWrongType!
  s    	c   
      C   s   t  t } t t |  } t t |  } |  j | t   t t |  } t | d d d  } |  j | |  t t |  } t t |  } |  j | t   t t |  } t | d d d  }	 |  j | |	  d S(   sG   
        :py:obj:`dump_certificate` writes PEM, DER, and text.
        RJ   s   -outformt   DERs   -noouts   -textN(	   RA  R   R   R   R!   Rn   R   Rg  R    (
   RQ   R  R   t
   dumped_pemt
   dumped_dert   good_dert   cert2t   dumped_pem2t   dumped_textt	   good_text(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_certificate,
  s    
c         C   sE   t  t t  } |  j | j    t t |  } |  j | t  d S(   s8   
        :py:obj:`dump_privatekey` writes a PEM
        N(   R   R   R   R^   R   R$   Rn   (   RQ   R   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_privatekey_pem?
  s    c         C   s   t  t t  } t t |  } t t |  } t | d d d  } |  j | |  t  t |  } t t |  } |  j | t  d S(   s8   
        :py:obj:`dump_privatekey` writes a DER
        t   rsas   -outformR  N(   R   R   R   R$   R   Rg  Rn   (   RQ   R   R  R  R  t   key2R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_privatekey_asn1I
  s    c         C   sV   t  t t  } t t |  } t t |  } t | d d d  } |  j | |  d S(   s9   
        :py:obj:`dump_privatekey` writes a text
        R  s   -noouts   -textN(   R   R   R   R$   R    Rg  Rn   (   RQ   R   R  R  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_privatekey_textY
  s
    c   	      C   s   t  t t  } t t |  } |  j | t  t t |  } t | d d d  } |  j | |  t  t |  } t t |  } |  j | t  t t |  } t | d d d  } |  j | |  |  j t	 t d |  d S(   sQ   
        :py:obj:`dump_certificate_request` writes a PEM, DER, and text.
        RF   s   -outformR  s   -noouts   -textid   N(
   R"   R   t   cleartextCertificateRequestPEMR#   Rn   R   Rg  R    Rh   R   (	   RQ   RF   R  R  R  t   req2R  R  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_dump_certificate_requeste
  s    c            s   t  d   g       f d   } t t t  } t t | t |  } |  j t | t   |  j	   t
 g  t t |   } |  j t | t   |  j	 | j   | j    |  j	 | j   | j    d S(   s   
        :py:obj:`dump_privatekey` writes an encrypted PEM when given a callback which
        returns the correct passphrase.
        Rs   c            s     j  |    S(   N(   R  (   R  (   R  RW  (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s    N(   R   R   R   R   R$   R  R^   R_   R	   Rn   RX   R   R`   R   (   RQ   R  R   R8   R  (    (   R  RW  s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt'   test_dump_privatekey_passphraseCallbackx
  s    c         C   s8   d   } t  t t  } |  j t t t | t |  d S(   sy   
        :py:obj:`dump_privatekey` should not overwrite the exception raised
        by the passphrase callback.
        c         S   s
   t   d  S(   N(   R  (   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s    N(   R   R   R   Rh   R  R$   R  (   RQ   R  R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt)   test_dump_privatekey_passphrase_exception
  s    		c         C   s8   d   } t  t t  } |  j t t t | t |  d S(   s   
        :py:obj:`crypto.dump_privatekey` should raise an error when the passphrase
        provided by the callback is too long, not silently truncate it.
        c         S   s   d d S(   NR   i  (    (   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s    N(   R   R   R   Rh   R   R$   R  (   RQ   R  R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt-   test_dump_privatekey_passphraseCallbackLength
  s    		c         C   s)   t  t t  } |  j t | t   d S(   s{   
        :py:obj:`load_pkcs7_data` accepts a PKCS#7 string and returns an instance of
        :py:obj:`PKCS7Type`.
        N(   R&   R   t	   pkcs7DataR^   R_   R%   (   RQ   t   pkcs7(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs7_data_pem
  s    c         C   s)   t  t t  } |  j t | t   d S(   s   
        :py:obj:`load_pkcs7_data` accepts a bytes containing ASN1 data
        representing PKCS#7 and returns an instance of :py:obj`PKCS7Type`.
        N(   R&   R   t   pkcs7DataASN1R^   R_   R%   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs7_data_asn1
  s    c         C   s   |  j  t t t d  d S(   sp   
        If the data passed to :py:obj:`load_pkcs7_data` is invalid,
        :py:obj:`Error` is raised.
        Rs   N(   Rh   R   R&   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_pkcs7_data_invalid
  s    (   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  d	  s:   				
										
					
										t   LoadCertificateTestsc           B   s   e  Z d  Z d   Z RS(   s7   
    Tests for :py:obj:`load_certificate_request`.
    c         C   s   |  j  t t t   d  d S(   s   
        If the file type passed to :py:obj:`load_certificate_request` is
        neither :py:obj:`FILETYPE_PEM` nor :py:obj:`FILETYPE_ASN1` then
        :py:class:`ValueError` is raised.
        Re  N(   Rh   R   R"   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_badFileType
  s    (   R   R   R   R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s   t
   PKCS7Testsc           B   sz   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 d   Z
 d	   Z d
   Z d   Z d   Z RS(   s(   
    Tests for :py:obj:`PKCS7Type`.
    c         C   s-   |  j  t t t   |  j t j d  d S(   s7   
        :py:obj:`PKCS7Type` is a type object.
        t   PKCS7N(   R^   R_   R%   R`   Rn   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   
  s    c         C   s)   t  t t  } |  j t | j d  d S(   su   
        :py:obj:`PKCS7Type.type_is_signed` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R&   R   R  Rh   Rt   t   type_is_signedRS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_signed_wrong_args
  s    c         C   s&   t  t t  } |  j | j    d S(   s   
        :py:obj:`PKCS7Type.type_is_signed` returns :py:obj:`True` if the PKCS7 object is of
        the type *signed*.
        N(   R&   R   R  R^   R  (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_signed
  s    c         C   s)   t  t t  } |  j t | j d  d S(   sx   
        :py:obj:`PKCS7Type.type_is_enveloped` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R&   R   R  Rh   Rt   t   type_is_envelopedRS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt!   test_type_is_enveloped_wrong_args
  s    c         C   s&   t  t t  } |  j | j    d S(   s   
        :py:obj:`PKCS7Type.type_is_enveloped` returns :py:obj:`False` if the PKCS7 object is
        not of the type *enveloped*.
        N(   R&   R   R  Rk   R  (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_enveloped
  s    c         C   s)   t  t t  } |  j t | j d  d S(   s   
        :py:obj:`PKCS7Type.type_is_signedAndEnveloped` raises :py:obj:`TypeError` if called
        with any arguments.
        N(   R&   R   R  Rh   Rt   t   type_is_signedAndEnvelopedRS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt*   test_type_is_signedAndEnveloped_wrong_args  s    c         C   s&   t  t t  } |  j | j    d S(   s   
        :py:obj:`PKCS7Type.type_is_signedAndEnveloped` returns :py:obj:`False` if the PKCS7
        object is not of the type *signed and enveloped*.
        N(   R&   R   R  Rk   R  (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_signedAndEnveloped  s    c         C   s&   t  t t  } |  j | j    d S(   s   
        :py:obj:`PKCS7Type.type_is_data` returns :py:obj:`False` if the PKCS7 object is not of
        the type data.
        N(   R&   R   R  Rk   t   type_is_data(   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_data  s    c         C   s)   t  t t  } |  j t | j d  d S(   ss   
        :py:obj:`PKCS7Type.type_is_data` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R&   R   R  Rh   Rt   R   RS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_type_is_data_wrong_args  s    c         C   s)   t  t t  } |  j t | j d  d S(   st   
        :py:obj:`PKCS7Type.get_type_name` raises :py:obj:`TypeError` if called with any
        arguments.
        N(   R&   R   R  Rh   Rt   t   get_type_nameRS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_type_name_wrong_args(  s    c         C   s/   t  t t  } |  j | j   t d   d S(   sa   
        :py:obj:`PKCS7Type.get_type_name` returns a :py:obj:`str` giving the type name.
        s   pkcs7-signedDataN(   R&   R   R  RV   R  R   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_type_name1  s    c         C   s)   t  t t  } |  j t t | d  d S(   s   
        If an attribute other than one of the methods tested here is accessed on
        an instance of :py:obj:`PKCS7Type`, :py:obj:`AttributeError` is raised.
        Rs   N(   R&   R   R  Rh   R   R   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_attribute9  s    (   R   R   R   R\   R  R  R  R  R  R  R  R  R  R  R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  
  s   																				t   NetscapeSPKITestsc           B   s;   e  Z d  Z d   Z d   Z d   Z d   Z d   Z RS(   s:   
    Tests for :py:obj:`OpenSSL.crypto.NetscapeSPKI`.
    c         C   s   t    S(   sQ   
        Return a new :py:obj:`NetscapeSPKI` for use with signing tests.
        (   R-   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   G  s    c         C   s$   |  j  t t  |  j t d  d S(   s   
        :py:obj:`NetscapeSPKI` and :py:obj:`NetscapeSPKIType` refer to the same type object
        and can be used to create instances of that type.
        R-   N(   RZ   R-   R.   R[   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR\   N  s    c         C   s#   t    } |  j t | t   d S(   s[   
        :py:obj:`NetscapeSPKI` returns an instance of :py:obj:`NetscapeSPKIType`.
        N(   R-   R^   R_   R.   (   RQ   t   nspki(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd   W  s    	c            s&   t      |  j t   f d    d S(   s   
        Accessing a non-existent attribute of a :py:obj:`NetscapeSPKI` instance causes
        an :py:obj:`AttributeError` to be raised.
        c              s     j  S(   N(   Rs   (    (   R  (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  e  s    N(   R-   Rh   R   (   RQ   (    (   R  s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_attribute_  s    	c         C   s/   t    } | j   } |  j t | t   d S(   s]   
        :py:obj:`NetscapeSPKI.b64_encode` encodes the certificate to a base64 blob.
        N(   R-   t
   b64_encodeR^   R_   R	   (   RQ   R  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_b64_encodeh  s    	(   R   R   R   R   R\   Rd   R	  R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  C  s   						t   RevokedTestsc           B   sM   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z	 RS(   s4   
    Tests for :py:obj:`OpenSSL.crypto.Revoked`
    c         C   s   t    } |  j t | t    |  j t |  t   |  j | j   t d   |  j | j   d  |  j | j	   d  d S(   sj   
        Confirm we can create :py:obj:`OpenSSL.crypto.Revoked`.  Check
        that it is empty.
        t   00N(
   R+   R^   R_   RV   R`   t
   get_serialR   t   get_rev_dateRS   t
   get_reason(   RQ   t   revoked(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd   v  s    	c         C   s=   |  j  t t d  |  j  t t d  |  j  t t d  d S(   s   
        Calling :py:obj:`OpenSSL.crypto.Revoked` with any arguments results
        in a :py:obj:`TypeError` being raised.
        i   Rs   N(   Rh   Rt   R+   RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_construction_wrong_args  s    c         C   s   t    } | j t d   } |  j | d	  | j   } |  j | t d   | j t d   | j   } |  j | t d   |  j t | j t d   |  j t | j d  |  j t | j d  |  j t | j d	  |  j t | j d  d	 S(
   s   
        Confirm we can set and get serial numbers from
        :py:obj:`OpenSSL.crypto.Revoked`.  Confirm errors are handled
        with grace.
        t   10bt   010Bt   31pppt   31t   pqrstid   i   Re  N(	   R+   t
   set_serialR   RV   RS   R  Rh   R   Rt   (   RQ   R  Rc  t   ser(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_serial  s    	c         C   s   t    } | j   } |  j | d  t t j   j d   } | j |  } |  j	 | d  | j   } |  j	 | |  d S(   s   
        Confirm we can set and get revocation dates from
        :py:obj:`OpenSSL.crypto.Revoked`.  Confirm errors are handled
        with grace.
        s   %Y%m%d%H%M%SZN(
   R+   R  RV   RS   R   R   RM   RN   t   set_rev_dateRn   (   RQ   R  t   dateRM   Rc  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt	   test_date  s    	c         C   s   t    } x | j   D] } x t d  D] } | j |  } |  j | d  | j   } |  j | j   j t	 d  t	 d   | j   j t	 d  t	 d    | } q) Wq W| j d  |  j
 | j   d  d S(   s   
        Confirm we can set and get revocation reasons from
        :py:obj:`OpenSSL.crypto.Revoked`.  The "get" need to work
        as "set".  Likewise, each reason of all_reasons() must work.
        i   R  Re  N(   R+   t   all_reasonst   ranget
   set_reasonRV   RS   R  t   lowerR  R   Rn   (   RQ   R  t   rR   Rc  t   reason(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_reason  s    	!%c         C   s?   t    } |  j t | j d  |  j t | j t d   d S(   s   
        Calling :py:obj:`OpenSSL.crypto.Revoked.set_reason` with other than
        one argument, or an argument which isn't a valid reason,
        results in :py:obj:`TypeError` or :py:obj:`ValueError` being raised.
        id   t   blueN(   R+   Rh   Rt   R   R   R   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set_reason_wrong_arguments  s    	c         C   sO   t    } |  j t | j d  |  j t | j d  |  j t | j d  d S(   s   
        Calling :py:obj:`OpenSSL.crypto.Revoked.get_reason` with any
        arguments results in :py:obj:`TypeError` being raised.
        i   Rs   N(   R+   Rh   Rt   R  RS   (   RQ   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_reason_wrong_arguments  s    	(
   R   R   R   Rd   R  R  R  R$  R&  R'  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR  r  s   		
				t   CRLTestsc           B   s   e  Z d  Z e e e  Z e e e  Z	 d   Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z d	   Z d
   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s0   
    Tests for :py:obj:`OpenSSL.crypto.CRL`
    c         C   s9   t    } |  j t | t    |  j | j   d  d S(   se   
        Confirm we can create :py:obj:`OpenSSL.crypto.CRL`.  Check
        that it is empty
        N(   R*   R^   R_   Rn   t   get_revokedRS   (   RQ   t   crl(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRd     s    	c         C   s=   |  j  t t d  |  j  t t d  |  j  t t d  d S(   s   
        Calling :py:obj:`OpenSSL.crypto.CRL` with any number of arguments
        results in a :py:obj:`TypeError` being raised.
        i   Re  N(   Rh   Rt   R*   RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR    s    c         C   sq   t    } t   } t t j   j d   } | j |  | j t d   | j t d   | j	 |  | S(   s6   
        Get a new ``CRL`` with a revocation.
        s   %Y%m%d%H%M%SZt   3abt
   sUpErSeDEd(
   R*   R+   R   R   RM   RN   R  R  R   t   add_revoked(   RQ   R*  R  RM   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   _get_crl  s    		c         C   s|   |  j    } | j |  j |  j d d } t | d d d  } | j t d   | j t d   | j t d   d	 S(
   s   
        If not passed a format, ``CRL.export`` returns a "PEM" format string
        representing a serial number, a revoked reason, and certificate issuer
        information.
        RA   i   R*  s   -noouts   -texts   Serial Number: 03ABt
   Supersededs:   Issuer: /C=US/ST=IL/L=Chicago/O=Testing/CN=Testing Root CAN(   R.  RZ  R   RD   Rg  t   indexR   (   RQ   R*  t
   dumped_crlRy   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_pem
  s    c         C   s   |  j    } | j |  j |  j t  } t | d d d d d  } | j t d   | j t d   | j t d   d	 S(
   s   
        If passed ``FILETYPE_ASN1`` for the format, ``CRL.export`` returns a
        "DER" format string representing a serial number, a revoked reason, and
        certificate issuer information.
        R*  s   -noouts   -texts   -informR  s   Serial Number: 03ABR/  s:   Issuer: /C=US/ST=IL/L=Chicago/O=Testing/CN=Testing Root CAN(   R.  RZ  R   RD   R   Rg  R0  R   (   RQ   R*  R1  Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_der  s    c         C   st   |  j    } | j |  j |  j t  } t | d d d d d  } | j |  j |  j d t } |  j | |  d S(   s   
        If passed ``FILETYPE_TEXT`` for the format, ``CRL.export`` returns a
        text format string like the one produced by the openssl command line
        tool.
        R*  s   -noouts   -texts   -informR  R`   N(   R.  RZ  R   RD   R   Rg  R    Rn   (   RQ   R*  R1  Ry   R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_text2  s    c         C   sV   |  j    } | j |  j |  j d d } t | d d d  } | j t d   d S(   s   
        If passed the name of a digest function, ``CRL.export`` uses a
        signature algorithm based on that digest function.
        R  Rv   R*  s   -noouts   -texts   Signature Algorithm: sha1N(   R.  RZ  R   RD   Rg  R0  R   (   RQ   R*  R1  Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_custom_digestD  s    c         C   s   |  j    } t d t  ' } t d  |  j d t |   Wd QX| j |  j |  j d d } t	 | d d d	  } | j
 t d
   d S(   s   
        If passed md5 as the digest function, ``CRL.export`` uses md5 and does
        not emit a deprecation warning.
        Rq  Rr  i    NR  t   md5R*  s   -noouts   -texts   Signature Algorithm: md5(   R.  R   RX   R   Rn   R   RZ  R   RD   Rg  R0  R   (   RQ   R*  t   catcherR1  Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_md5_digestO  s    
c      	   C   s   |  j    } t d t  F } t d  | j |  j |  j  } |  j d t | d j	   Wd QXt
 | d d d  } | j t d	   d S(
   s   
        If not passed the name of a digest function, ``CRL.export`` uses a
        signature algorithm based on MD5 and emits a deprecation warning.
        Rq  Rr  s^   The default message digest (md5) is deprecated.  Pass the name of a message digest explicitly.i    NR*  s   -noouts   -texts   Signature Algorithm: md5(   R.  R   RX   R   RZ  R   RD   Rn   RW   Rv  Rg  R0  R   (   RQ   R*  R7  R1  Ry   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_default_digest]  s    
c         C   s,   t    } |  j t | j t   t    d S(   s   
        If :py:obj:`CRL.export` is used with an uninitialized :py:obj:`X509`
        instance, :py:obj:`OpenSSL.crypto.Error` is raised.
        N(   R*   Rh   R   RZ  R   R   (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_invalido  s    	c         C   sF   t    } t   } | j d |  |  j t | j   d t   d S(   s|   
        :py:obj:`OpenSSL.CRL.add_revoked` accepts its single argument as the
        ``revoked`` keyword argument.
        R  i    N(   R*   R+   R-  R^   R_   R)  (   RQ   R*  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_revoked_keywordx  s    		c      	   C   s   t    } |  j t | j  |  j t | j |  j  |  j t | j |  j |  j t d d d  |  j t | j d |  j t d  |  j t | j |  j d t d  |  j t | j |  j |  j d d  |  j t | j |  j t d  d S(   s#  
        Calling :py:obj:`OpenSSL.CRL.export` with fewer than two or more than
        four arguments, or with arguments other than the certificate,
        private key, integer file type, and integer number of days it
        expects, results in a :py:obj:`TypeError` being raised.
        i
   R6  Rs   N(   R*   Rh   Rt   RZ  R   RD   R   RS   (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_wrong_args  s    	+""%c         C   s2   t    } |  j t | j |  j |  j d d  d S(   s   
        Calling :py:obj:`OpenSSL.CRL.export` with a file type other than
        :py:obj:`FILETYPE_PEM`, :py:obj:`FILETYPE_ASN1`, or :py:obj:`FILETYPE_TEXT` results
        in a :py:obj:`ValueError` being raised.
        id   i
   N(   R*   Rh   R   RZ  R   RD   (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_unknown_filetype  s    	c         C   s5   t    } |  j t | j |  j |  j t d d  d S(   s   
        Calling :py:obj:`OpenSSL.CRL.export` with a unsupported digest results
        in a :py:obj:`ValueError` being raised.
        i
   s   strange-digestN(   R*   Rh   R   RZ  R   RD   R   (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_export_unknown_digest  s
    	c         C   s[  t    } t   } t t j   j d   } | j |  | j t d   | j |  | j t d   | j	 t d   | j |  | j
   } |  j t |  d  |  j t | d  t  |  j t | d  t  |  j | d j   t d   |  j | d j   t d	   |  j | d j   |  |  j | d j   |  d
 S(   s   
        Use python to create a simple CRL with two revocations.
        Get back the :py:obj:`Revoked` using :py:obj:`OpenSSL.CRL.get_revoked` and
        verify them.
        s   %Y%m%d%H%M%SZR+  t   100R,  i   i    i   t   03ABt   0100N(   R*   R+   R   R   RM   RN   R  R  R-  R   R)  Rn   R   R`   R  R  (   RQ   R*  R  RM   t   revs(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_revoked  s"    		  c         C   sk   t    } |  j t | j d  |  j t | j d  |  j t | j d  |  j t | j d d d  d S(   s   
        Calling :py:obj:`OpenSSL.CRL.get_revoked` with any arguments results
        in a :py:obj:`TypeError` being raised.
        i   Re  N(   R*   Rh   Rt   R)  RS   (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_get_revoked_wrong_args  s
    	c         C   sR   t    } |  j t | j  |  j t | j d d  |  j t | j d d  d S(   s   
        Calling :py:obj:`OpenSSL.CRL.add_revoked` with other than one
        argument results in a :py:obj:`TypeError` being raised.
        i   i   Rs   R   N(   R*   Rh   Rt   R-  (   RQ   R*  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_add_revoked_wrong_args  s    	c         C   so  t  t t  } | j   } |  j t |  d  |  j | d j   t d   |  j | d j   d
  |  j | d j   t d   |  j | d j   t d   t
 t d d d	  } t  t |  } | j   } |  j t |  d  |  j | d j   t d   |  j | d j   d
  |  j | d j   t d   |  j | d j   t d   d
 S(   sm   
        Load a known CRL and inspect its revocations.  Both
        PEM and DER formats are loaded.
        i   i    R@  i   RA  R/  R*  s   -outformR  N(   R,   R   t   crlDataR)  Rn   R   R  R   R  RS   Rg  R   (   RQ   R*  RB  R   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_crl  s         c         C   s@   |  j  t t  |  j  t t t  |  j  t t t t d  d S(   s   
        Calling :py:obj:`OpenSSL.crypto.load_crl` with other than two
        arguments results in a :py:obj:`TypeError` being raised.
        N(   Rh   Rt   R,   R   RF  RS   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_crl_wrong_args  s    c         C   s   |  j  t t d t  d S(   s|   
        Calling :py:obj:`OpenSSL.crypto.load_crl` with an unknown file type
        raises a :py:obj:`ValueError`.
        id   N(   Rh   R   R,   RF  (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_crl_bad_filetype  s    c         C   s   |  j  t t t d  d S(   s   
        Calling :py:obj:`OpenSSL.crypto.load_crl` with file data which can't
        be loaded raises a :py:obj:`OpenSSL.crypto.Error`.
        s   hello, worldN(   Rh   R   R,   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_load_crl_bad_data  s    (   R   R   R   R   R   RA  R   R   R   RD   Rd   R  R.  R2  R3  R4  R5  R8  R9  R:  R;  R<  R=  R>  RC  RD  RE  RG  RH  RI  RJ  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR(    s0   	
	
												
						
	t   X509StoreContextTestsc           B   sz   e  Z d  Z e e e  Z e e e  Z e e e	  Z
 d   Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   s>   
    Tests for :py:obj:`OpenSSL.crypto.X509StoreContext`.
    c         C   sU   t    } | j |  j  | j |  j  t | |  j  } |  j | j   d  d S(   sw   
        :py:obj:`verify_certificate` returns ``None`` when called with a certificate
        and valid chain.
        N(	   R   RD  R  t   intermediate_certR   t   intermediate_server_certRn   t   verify_certificateRS   (   RQ   RE  t	   store_ctx(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt
   test_valid  s
    	c         C   sk   t    } | j |  j  | j |  j  t | |  j  } |  j | j   d  |  j | j   d  d S(   s   
        :py:obj:`verify_certificate` can be called multiple times with the same
        ``X509StoreContext`` instance to produce the same result.
        N(	   R   RD  R  RL  R   RM  Rn   RN  RS   (   RQ   RE  RO  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt
   test_reuse$  s    	c         C   sE   t    } | j |  j  t | |  j  } |  j | j   d  d S(   s   
        :py:obj:`verify_certificate` returns ``None`` when called with a self-signed
        certificate and itself in the chain.
        N(   R   RD  R  R   Rn   RN  RS   (   RQ   RE  RO  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_trusted_self_signed1  s    	c         C   sk   t    } t | |  j  } |  j t | j  } |  j | j d d d  |  j | j j	   j
 d  d S(   s   
        :py:obj:`verify_certificate` raises error when a self-signed certificate is
        verified without itself in the chain.
        i    i   s   self signed certificates   Testing Root CAN(   R   R   R  Rh   R   RN  Rn   R  R   RH   R   (   RQ   RE  RO  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_untrusted_self_signed<  s
    	c         C   s{   t    } | j |  j  t | |  j  } |  j t | j  } |  j | j	 d d d  |  j | j
 j   j d  d S(   sv   
        :py:obj:`verify_certificate` raises error when a root certificate is missing
        from the chain.
        i    i   s    unable to get issuer certificatet   intermediateN(   R   RD  RL  R   RM  Rh   R   RN  Rn   R  R   RH   R   (   RQ   RE  RO  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_invalid_chain_no_rootH  s    	c         C   s{   t    } | j |  j  t | |  j  } |  j t | j  } |  j | j	 d d d  |  j | j
 j   j d  d S(   s   
        :py:obj:`verify_certificate` raises error when an intermediate certificate is
        missing from the chain.
        i    i   s&   unable to get local issuer certificates   intermediate-serviceN(   R   RD  R  R   RM  Rh   R   RN  Rn   R  R   RH   R   (   RQ   RE  RO  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt"   test_invalid_chain_no_intermediateU  s    	c         C   s   t    } | j |  j  t    } | j |  j  | j |  j  t | |  j  } |  j t | j  } |  j	 | j
 d d d  |  j	 | j j   j d  | j |  |  j	 | j   d  d S(   sl   
        :py:obj:`verify_certificate` can use a store context modified after
        instantiation.
        i    i   s    unable to get issuer certificateRT  N(   R   RD  RL  R  R   RM  Rh   R   RN  Rn   R  R   RH   R   t	   set_storeRS   (   RQ   t	   store_badt
   store_goodRO  R  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_modification_pre_verifyb  s    		(   R   R   R   R   R   R  R  t   intermediate_cert_pemRL  t   intermediate_server_cert_pemRM  RP  RQ  RR  RS  RU  RV  RZ  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRK    s   						t   SignVerifyTestsc           B   s)   e  Z d  Z d   Z d   Z d   Z RS(   sV   
    Tests for :py:obj:`OpenSSL.crypto.sign` and :py:obj:`OpenSSL.crypto.verify`.
    c      	   C   s   t  d  } t t t  } t t t  } t t t  } x{ d d g D]m } t | | |  } t | | | |  |  j	 t
 t | | | |  |  j	 t
 t | | | t  d  |  qF W|  j	 t t | | d  |  j	 t t | | | d  d S(   sf   
        :py:obj:`sign` generates a cryptographic signature which :py:obj:`verify` can check.
        s6  It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.R6  Rv   t   tainteds   strange-digestN(   R   R   R   R  R   R  R  R/   R0   Rh   R   R   (   RQ   t   contentt   priv_keyt	   good_certt   bad_certR  t   sig(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_sign_verifyy  s     	c         C   s+  d j  d  } t t t  } t t t  } x d d g D] } t d t  ` } t d  t	 | | |  } |  j
 d j t  t | d j   |  j | d j t  Wd	 QXt d t  a } t d  t | | | |  |  j
 d j t  t | d j   |  j | d j t  Wd	 QXq: Wd	 S(
   s   
        :py:obj:`sign` generates a cryptographic signature which :py:obj:`verify` can check.
        Deprecation warnings raised because using text instead of bytes as content
        s6  It was a bright cold day in April, and the clocks were striking thirteen. Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.Rs  R6  Rv   Rq  Rr  s-   {0} for data is no longer accepted, use bytesiN(   Rt  R   R   R  R   R  R   RX   R   R/   Rn   Ru  R5   RW   Rv  Rw  Rx  Ry  R0   (   RQ   R_  R`  R   R  Rz  Rc  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_sign_verify_with_text  s*    	

c         C   sS   t  d  } t t t  } t t t  } t | | d  } t | | | d  d S(   sW   
        :py:obj:`sign` produces a signature for a string with embedded nulls.
        s   Watch out!     Did you see it?Rv   N(   R   R   R   R  R   R  R/   R0   (   RQ   R_  R`  Ra  Rc  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_sign_nulls  s
    (   R   R   R   Rd  Re  Rf  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR]  u  s   	)	)t   EllipticCurveTestsc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   st   
    Tests for :py:class:`_EllipticCurve`, :py:obj:`get_elliptic_curve`, and
    :py:obj:`get_elliptic_curves`.
    c         C   s   |  j  t   t  d S(   sH   
        :py:obj:`get_elliptic_curves` returns a :py:obj:`set`.
        N(   t   assertIsInstanceR2   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_set  s    c         C   s3   t    } t j r" |  j |  n |  j |  d S(   s'  
        If :py:mod:`cryptography` has elliptic curve support then the set
        returned by :py:obj:`get_elliptic_curves` has some elliptic curves in
        it.

        There could be an OpenSSL that violates this assumption.  If so, this
        test will fail and we'll find out.
        N(   R2   R7   t   Cryptography_HAS_ECR^   Rk   (   RQ   t   curves(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_some_curves  s    			c         C   s`   t    } | rC t t |   } |  j | j t | j  j  n |  j t t t d   d S(   sl   
        :py:obj:`get_elliptic_curve` can be used to retrieve a particular
        supported curve.
        t
   prime256v1N(	   R2   t   nextRX  Rn   R   R1   Rh   R   R   (   RQ   Rk  t   curve(    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_a_curve  s
    	"c         C   s   |  j  t t t d   d S(   s   
        :py:obj:`get_elliptic_curve` raises :py:class:`ValueError` if called
        with a name which does not identify a supported curve.
        s   this curve was just inventedN(   Rh   R   R1   R   (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_not_a_curve   s    c         C   sH   t    } | rD t t |   } |  j d | j f t |   n  d S(   s   
        The string representation of a curve object includes simply states the
        object is a curve and what its name is.
        s
   <Curve %r>N(   R2   Rn  RX  Rn   R   R   (   RQ   Rk  Ro  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR   	  s    	c         C   s2   t    } | r. t t |   } | j   n  d S(   s   
        The curve object can export a version of itself as an EC_KEY* via the
        private :py:meth:`_EllipticCurve._to_EC_KEY`.
        N(   R2   Rn  RX  t
   _to_EC_KEY(   RQ   Rk  Ro  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_to_EC_KEY  s    	(	   R   R   R   Ri  Rl  Rp  Rq  R   Rs  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRg    s   						t   EllipticCurveFactoryc           B   s   e  Z d  Z d   Z RS(   s2   
    A helper to get the names of two curves.
    c         C   s_   t  t    } y( t |  j |  _ t |  j |  _ Wn! t k
 rZ d  |  _ |  _ n Xd  S(   N(   RX  R2   Rn  R   t
   curve_namet   another_curve_namet   StopIterationRS   (   RQ   Rk  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   __init__'  s    (   R   R   R   Rx  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRt  #  s   t   EllipticCurveEqualityTestsc           B   sA   e  Z d  Z e   Z e j d k r- d Z n  d   Z d   Z	 RS(   sR   
    Tests :py:type:`_EllipticCurve`\ 's implementation of ``==`` and ``!=``.
    s<   There are no curves available there can be no curve objects.c         C   s   t  |  j j  S(   sV   
        Get the curve object for an arbitrary curve supported by the system.
        (   R1   t   curve_factoryRu  (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt
   anInstance;  s    c         C   s   t  |  j j  S(   s   
        Get the curve object for an arbitrary curve supported by the system -
        but not the one returned by C{anInstance}.
        (   R1   Rz  Rv  (   RQ   (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   anotherInstanceB  s    N(
   R   R   R   Rt  Rz  Ru  RS   t   skipR{  R|  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyRy  1  s   			t   EllipticCurveHashTestsc           B   sA   e  Z d  Z e   Z e j d k r- d Z n  d   Z d   Z	 RS(   s   
    Tests for :py:type:`_EllipticCurve`\ 's implementation of hashing (thus use
    as an item in a :py:type:`dict` or :py:type:`set`).
    s<   There are no curves available there can be no curve objects.c         C   s5   t  |  j j  } t | g  } |  j | |  d S(   sw   
        The ``in`` operator reports that a :py:type:`set` containing a curve
        does contain that curve.
        N(   R1   Rz  Ru  R   R:  (   RQ   Ro  Rk  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_containsV  s    c         C   sA   t  |  j j  } t t  |  j j  g  } |  j | |  d S(   s   
        The ``in`` operator reports that a :py:type:`set` not containing a
        curve does not contain that curve.
        N(   R1   Rz  Ru  R   Rv  t   assertNotIn(   RQ   Ro  Rk  (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   test_does_not_contain`  s    N(
   R   R   R   Rt  Rz  Ru  RS   R}  R  R  (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyR~  K  s   			
t   __main__({   R   t   unittestR    t   warningsR   R   t   base64R  t   ret
   subprocessR   R   R   R   t   sixR   R   R	   R
   t   OpenSSL.cryptoR   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R    R!   R"   R#   R$   R%   R&   R'   R(   R)   R*   R+   R,   R-   R.   R/   R0   R1   R2   t   OpenSSL.test.utilR3   R4   R5   t   OpenSSL._utilR6   R7   R9   R:   R  R  R   R   R  R  R  R[  t   intermediate_key_pemR  R  R\  t   intermediate_server_key_pemRm  R   RA  R   R  R  R  R  t	   b64decodeR  RF  R   R   R@   R   R   R   R   R   RC  RI  t   compileR  R  R  R  Rg  R  R  R  R  R  R(  RK  R]  Rg  R   Rt  Ry  R~  R   (    (    (    s<   /usr/lib/python2.7/dist-packages/OpenSSL/test/test_crypto.pyt   <module>   s   "("""																				D  ') 			 ^t/o 0ebL 