o[c@sdZddlmZddlZddlZddlZddlmZmZddl m Z m Z ddl m Z m Z mZmZmZddl mZmZmZmZddl mZmZdd l mZmZdd l mZmZdd l mZmZmZdd l mZmZdd l m Z m!Z!ddl m"Z"m#Z#ddl m$Z$m%Z%m&Z&ddl m'Z'm(Z(m)Z)ddl m*Z*m+Z+ddl m,Z,m-Z-ddl.m/Z/m0Z0m1Z1dZ2dZ3e1dZ4e1dZ5e1dZ6e3e1dZ7e1dZ8e3e1dZ9e1dZ:e3e1dZ;e1dZ<e1dZ=e1dZ>e1dZ?e1d Z@e1d!ZAe1d"ZBd#e/fd$YZCd%e/fd&YZDd'e/fd(YZEd)fd*YZFd+e/eFfd,YZGd-e/eFfd.YZHd/e/fd0YZIejJd1ZKejJd2ZLd3ZMd4ZNd5ZOd6e/fd7YZPd8e/fd9YZQd:e/eFfd;YZRd<e/fd=YZSd>e/fd?YZTd@e/fdAYZUeVdBkrendS(Cs# Unit tests for L{OpenSSL.crypto}. i(tmainN(tPIPEtPopen(tdatetimet timedelta(tTYPE_RSAtTYPE_DSAtErrortPKeytPKeyType(tX509tX509TypetX509Namet X509NameType(tX509Reqt X509ReqType(t X509ExtensiontX509ExtensionType(tload_certificatetload_privatekey(t FILETYPE_PEMt FILETYPE_ASN1t FILETYPE_TEXT(tdump_certificatetload_certificate_request(tdump_certificate_requesttdump_privatekey(t PKCS7Typetload_pkcs7_data(tPKCS12t PKCS12Typet load_pkcs12(tCRLtRevokedtload_crl(t NetscapeSPKItNetscapeSPKIType(tsigntverify(tTestCasetbytestbcCstttt|S(N(RRR(tpem((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytnormalize_certificate_pemscCstttt|S(N(RRR(R*((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytnormalize_privatekey_pem!ss.-----BEGIN CERTIFICATE----- MIIC6TCCAlKgAwIBAgIIPQzE4MbeufQwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UE BhMCVVMxCzAJBgN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zt9PZOK9sR3lMZSsP7rMi7kzuQJABie6 1sXXjFH7nNJvRG4S39cIxq8YRYTy68II/dlB2QzGpKxV/POCxbJ/zu0CU79tuYK7 NaeNCFfH3aeTrX0LyQJAMBWjWmeKM2G2sCExheeQK0ROnaBC8itCECD4Jsve4nqf r50+LF74iLXFwqysVCebPKMOpDWp/qQ1BbJQIPs7/A== -----END RSA PRIVATE KEY----- s"-----BEGIN CERTIFICATE----- MIICIjCCAYugAwIBAgIJAKxpFI5lODkjMA0GCSqGSIb3DQEBBQUAMFgxCzAJBgNV BAYTAlVTMQswCQYDVQQIDAJJTDEQMA4GA1UEBwwHQ2hpY2FnbzEQMA4GA1UECgwH VGVzdGluZzEYMBYGA1UEAwwPVGVzdGluZyBSb290IENBMB4XDTE3MDYxMjAwMDQx M1oXDTM3MDYwNzAwMDQxM1owFjEUMBIGA1UEAwwLdWdseSBjbGllbnQwgZ8wDQYJ KoZIhvcNAQEBBQADgY0AMIGJAoGBAMBmH9JG02bme0xPipvpjMSlOugyWrauf4at EdGJn7GQLD8IY2Fu0+Kvv9DFpSPboFKZCsfDVsYoRs+xaJbtt1dJ6ymX7EqKS7gb 8q+eeZZ14keqyJd5Rm2q6swQtw9ADD3E8cS6GqpQm+8SgxOycISoYz7sO1ugJFqN jId+W4BFAgMBAAGjNjA0MB0GA1UdDgQWBBSDVXctXiHxSQwJJOdUCRKNyH4ErjAT BgNVHSUEDDAKBggrBgEFBQcDAjANBgkqhkiG9w0BAQUFAAOBgQAMqcHyweaCOZNN dWQQOsBKQlL5wqVVZwucHPWqobjxpULKy9gS2ha2zbgkXcB/BnBOSwe0Fm+MJV0T NbnTghcGJNpEH7VKn4xSLvIGZmnZZWgxeIB16z4GhpkK2fShBJ+6GKZjsgjT0lSH JRgjHbWutZfZvbSHXr9n7PIphG1Ojg== -----END CERTIFICATE----- s{-----BEGIN RSA PRIVATE KEY----- MIICXgIBAAKBgQDAZh/SRtNm5ntMT4qb6YzEpTroMlq2rn+GrRHRiZ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oeeRs9i/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 X509ExtTestscBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZRS(s4 Tests for L{OpenSSL.crypto.X509Extension}. cCst|_|jjtdt|_|jj|jd|jj_t |_ |j j|_ |jjj|j _|j j |j |j j|jt tjjd}t tjtddjd}|j j||j j|dS(s Create a new private key and start a certificate request (for a test method to finish in one way or another). is Yoda root CAs %Y%m%d%H%M%SZtdaysidN(Rtpkeyt generate_keyRRtreqt set_pubkeyt get_subjectt commonNameR tx509tsubjectt set_issuerR)RtnowtstrftimeRt set_notBeforet set_notAfter(tselfR9texpire((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytsetUp1s   (cCs2|jtttdttdddS(sw The string representation of L{X509Extension} instances as returned by C{str} includes stuff. tbasicConstraintssCA:falsesCA:FALSEN(t assertEqualststrRR)tTrue(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_strHs!cCs9|jtt|jtdtdttddS(s L{X509Extension} and L{X509ExtensionType} refer to the same type object and can be used to create instances of that type. RR@sCA:trueN(tassertIdenticalRRtassertConsistentTypeR)RC(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_typeTscCsttdttd}|jt|td|t|tfttdttd}|jt|td|t|tfdS(s L{X509Extension} accepts an extension type name, a critical flag, and an extension value and returns an L{X509ExtensionType} instance. R@sCA:trues%r is of type %r, should be %rt nsCommentspyOpenSSL unit testN(RR)RCt assertTruet isinstanceRttypetFalse(R=tbasictcomment((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_construction_s  cCss|jtttdttd|jtttdttd|jtttdttddS(sj L{X509Extension} raises something if it is passed a bad extension name or value. t thisIsMadeUpthiR@s blah blaht proxyCertInfos4language:id-ppl-anyLanguage,pathlen:1,policy:text:ABN(t assertRaisesRRR)RLRC(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_extensionrscCsfttdttd}|j|jttdttd}|j|jdS(so L{X509ExtensionType.get_critical} returns the value of the extension's critical flag. R@sCA:trueN(RR)RCRIt get_criticalRLt assertFalse(R=text((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_criticalscCsxttdttd}|j|jtdttdttd}|j|jtddS(s{ L{X509ExtensionType.get_short_name} returns a string giving the short type name of the extension. R@sCA:trueRHsfoo barN(RR)RCt assertEqualtget_short_name(R=RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_short_namescCs>ttdttd}|j|jtddS(sf L{X509Extension.get_data} returns a string giving the data of the extension. R@sCA:trues0N(RR)RCRYtget_data(R=RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_get_datascCsdttdttd}|jt|jd|jt|jd|jt|jddS(sX L{X509Extension.get_data} raises L{TypeError} if passed any arguments. R@sCA:truetfooiN(RR)RCRSt TypeErrorR\tNone(R=RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_data_wrong_argsscCsttdttdd|j}|jj|g|jj|jdtt|j}|j td|k|j td|kdS(s The C{subject} parameter to L{X509Extension} may be provided for an extension which does not use it and is ignored in this case. R@sCA:TRUER7tsha1sX509v3 Basic Constraints:N( RR)RLR6tadd_extensionsR%R0RRRI(R=text1ttext((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_unused_subjects$cCsttdttdd|j}|jj|g|jj|jdtt|j}|j td|kdS(s~ If an extension requires a subject, the C{subject} parameter to L{X509Extension} provides its value. tsubjectKeyIdentifierthashR7RbsX509v3 Subject Key Identifier:N( RR)RLR6RcR%R0RRRI(R=text3Re((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_subjects $cCs)|jtttdttddS(s If an extension requires a subject and the C{subject} parameter is given no value, something happens. RgRhN(RSRRR)RL(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_missing_subjectsc CsFx?ttdg|gD]%}|jttdtdd|qWdS(s If the C{subject} parameter is given a value which is not an L{X509} instance, L{TypeError} is raised. thelloR@sCA:TRUER7N(RCtobjectRSR_RRL(R=tbadObj((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_subjects cCsttdttdd|j}|jj|g|jj|jdtt|j}|j td|k|j td|kdS(s The C{issuer} parameter to L{X509Extension} may be provided for an extension which does not use it and is ignored in this case. R@sCA:TRUEtissuerRbsX509v3 Basic Constraints:N( RR)RLR6RcR%R0RRRI(R=RdRe((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_unused_issuers$cCsttdttdd|j}|jj|g|jj|jdtt|j}|j td|k|j td|kdS(s| If an extension requires a issuer, the C{issuer} parameter to L{X509Extension} provides its value. tauthorityKeyIdentifiers issuer:alwaysRpRbs X509v3 Authority Key Identifier:sDirName:/CN=Yoda root CAN( RR)RLR6RcR%R0RRRI(R=text2Re((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_issuers cCs)|jtttdttddS(s} If an extension requires an issue and the C{issuer} parameter is given no value, something happens. Rrskeyid:always,issuer:alwaysN(RSRRR)RL(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_missing_issuers  c CsFx?ttdg|gD]%}|jttdtdd|qWdS(s If the C{issuer} parameter is given a value which is not an L{X509} instance, L{TypeError} is raised. RlRrskeyid:always,issuer:alwaysRpN(RCRmRSR_RRL(R=Rn((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_issuer s  (t__name__t __module__t__doc__R?RDRGRORTRXR[R]RaRfRjRkRoRqRtRuRv(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR.,s$       t PKeyTestscBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( s0 Unit tests for L{OpenSSL.crypto.PKey}. cCs$|jtt|jtddS(s L{PKey} and L{PKeyType} refer to the same type object and can be used to create instances of that type. RN(RERR RF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRGscCsL|jttdt}|jt|td|t|tfdS(sP L{PKey} takes no arguments and returns a new L{PKey} instance. s%r is of type %r, should be %rN(RSR_RR`RIRJR RK(R=tkey((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO$s   cCsLt}|j|jd|j|jd|jt|jdS(s L{PKeyType.bits} and L{PKeyType.type} return C{0} before the key is generated. L{PKeyType.check} raises L{TypeError} before the key is generated. iN(RRYRKtbitsRSR_tcheck(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_pregeneration/s cCst}|jt|j|jt|jddd|jt|jdd|jt|jdd|jt|jtd|jt|jtddS( ss L{PKeyType.generate_key} takes two arguments, the first giving the key type as one of L{TYPE_RSA} or L{TYPE_DSA} and the second giving the number of bits to generate. If an invalid type is specified or generation fails, L{Error} is raised. If an invalid number of bits is specified, L{ValueError} or L{Error} is raised. iiiR^tbariiN(RRSR_R1Rt ValueErrorR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_failedGeneration;s cCsbd}t}|jt||j|jt|j|j||j|jdS(s L{PKeyType.generate_key} generates an RSA key when passed L{TYPE_RSA} as a type and a reasonable number of bits. iN(RR1RRYRKR|RIR}(R=R|R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_rsaGeneration^s  cCsbd}t}|jt||j|jt|j|j||jt|jdS(s L{PKeyType.generate_key} generates a DSA key when passed L{TYPE_DSA} as a type and a reasonable number of bits. iN( RR1RRYRKR|RSR_R}(R=R|R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dsaGenerationks  cCsrt}xbtdftdfgD]H\}}|j|||j|j||j|j|q"WdS(su L{PKeyType.generate_key} can be called multiple times on the same key to generate new keys. iiN(RRRR1RYRKR|(R=R{RKR|((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_regeneration{s  %cCs&ttt}|jt|jdS(sR L{PKeyType.check} returns C{False} if the key is not consistent. N(RRtinconsistentPrivateKeyPEMRSRR}(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_inconsistentKeyscCsR|jttjd|jttjt|jttjddS(sU L{PKeyType.check} raises L{TypeError} if called with any arguments. iN(RSR_RR}R`Rm(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_check_wrong_argss( RwRxRyRGROR~RRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRzs #  t X509NameTestscBszeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( s4 Unit tests for L{OpenSSL.crypto.X509Name}. cKsetj}t|j}d}|jd|x$|D]\}}t|||qAW|S(NcSs|dS(Ni((tattr((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR{sR{(R R4tlisttitemstsorttsetattr(R=tattrstnameR{tktv((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt _x509names cCsu|jtt|jtjd|jttt|j}|jt|td|t|tfdS(sB The type of X509Name objects is L{X509NameType}. R s%r is of type %r, should be %rN( RER R RYRwRIRJRKR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRGs  cCst|j}|jtt|dd|jtt|dddtfdY}|jtt||ddS(s Attempting to set a non-L{str} attribute name on an L{X509NameType} instance causes L{TypeError} to be raised. RlitevilcBseZRS((RwRx(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRsN(RRSR_RR`RB(R=RR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_onlyStringAttributess  cCs)|j}|jtt|dddS(s Attempting to set any attribute name on an L{X509NameType} instance for which no corresponding NID is defined causes L{AttributeError} to be raised. s no such thingN(RRStAttributeErrorRR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_setInvalidAttributes cCs|j}d|_|j|jd|j|jdd|_|j|jd|j|jdd|_|j|jd|j|jdd|_|j|jd|j|jddS(si L{X509NameType} instances have attributes for each standard (?) X509Name field. R^tbazRtquuxN(RR5RYtCN(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_attributess     cCs|jdddd}t|}|j|jd|j|jdd|_|j|jdd|_|j|jddS(s L{X509Name} creates a new L{X509NameType} instance with all the same attributes as an existing L{X509NameType} instance when called with one. R5R^t emailAddresssbar@example.comRsquux@example.comN(RR RYR5R(R=Rtcopy((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_copys   cCs2|jdddd}|jt|ddS(s L{repr} passed an L{X509NameType} instance should return a string containing a description of the type and the NIDs which have been set on it. R5R^RRs,N(RRYtrepr(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_reprs csdfd}j}||||jj|jddjdd|jddjdd|jddddjddddfd }|jddjdd|jddjddd fd }|jdd jdd fd}|jdd jdd dS(sO L{X509NameType} instances should compare based on their NIDs. cSsQ|||kd||f|||k|||k|||kdS(Ns(%r == %r) --> False((taR)RIRV((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt _equality scs||jjdS(N(RIRV(RR)(RR=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRYsR5R^RtorganizationalUnitNameRtOUcs||jjdS(N(RVRI(RR)(RR=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertNotEqual+scSs|||k|||k|||k|||k|||k|||k|||k|||kdS(N((RR)RIRV((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt _inequality7scs||jjdS(N(RIRV(RR)(RR=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertLessThanAstabctdefcs||jjdS(N(RVRI(RR)(RR=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertGreaterThanJsN(R(R=RYRRRR((RRR=s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_comparison s.    cCsi|jdd}|jdd}|j|j|jd|_|j|j|jdS(sb L{X509Name.hash} returns an integer hash based on the value of the name. RR^RN(RRYRhRR(R=RR)((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_hashTs  cCs8|jdddd}|j|jtddS(sK L{X509Name.der} returns the DER encoded form of the name. RR^tCtUSs01 0 UUS1 0 U fooN(RRYtderR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_der`s cCs|j}|j|jgd|_|j|jtdtdfgd|_|j|jtdtdftdtdfgdS(s L{X509Name.get_components} returns a C{list} of two-tuples of C{str} giving the NIDs and associated values which make up the name. R^RRRN(RRYtget_componentsRR)R(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_componentsks  +  cCs2ttt}|j}|jd|jdS(s An L{X509Name} from an L{X509} instance loaded from a file can have a NUL byte in the value of one of its attributes. snull.python.orgexample.orgN(RRtnulbyteSubjectAltNamePEMR4RYR5(R=tcertR7((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_nul_byte_attributezs (RwRxRyRRGRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs     K t_PKeyInteractionTestsMixincBs;eZdZdZdZdZdZdZRS(s7 Tests which involve another thing and a PKey. cCs tdS(s[ Return something with a C{set_pubkey}, C{set_pubkey}, and C{sign} method. N(tNotImplementedError(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytsignablescCs2|j}t}|jt|j|ddS(sY L{X509Req.sign} raises L{ValueError} when pass a L{PKey} with no parts. tMD5N(RRRSRR%(R=trequestR{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithUngenerateds  cCs[|j}t}|jtd|j||j}|jt|j|ddS(s{ L{X509Req.sign} raises L{ValueError} when pass a L{PKey} with no private part as the signing key. iRN( RRR1RR3t get_pubkeyRSRR%(R=RR{tpub((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithPublicKeys     cCsB|j}t}|jtd|jt|j|ddS(sl L{X509Req.sign} raises L{ValueError} when passed a digest name which is not known. itmonkeysN(RRR1RRSRR%(R=RR{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithUnknownDigests  cCs|j}t}|jtd|j||j|dt|dddk r|j}|j |j |t}|jtd|j t |j |ndS(s L{X509Req.sign} succeeds when passed a private key object and a valid digest function. C{X509Req.verify} can be used to check the signature. itSHA256R&N( RRR1RR3R%tgetattrR`RRIR&RSR(R=RR{R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_signs     (RwRxRyRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs   t X509ReqTestscBs_eZdZdZdZdZdZdZdZdZ dZ d Z RS( s. Tests for L{OpenSSL.crypto.X509Req}. cCstS(s5 Create and return a new L{X509Req}. (R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRscCs$|jtt|jtddS(s L{X509Req} and L{X509ReqType} refer to the same type object and can be used to create instances of that type. RN(RERRRF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRGscCs9t}|jt|td|t|tfdS(sW L{X509Req} takes no arguments and returns an L{X509ReqType} instance. s%r is of type %r, should be %rN(RRIRJRRK(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyROs  cCsit}|j|jd|jd|j|jd|jd|j|jddS(s L{X509ReqType.set_version} sets the X.509 version of the certificate request. L{X509ReqType.get_version} returns the X.509 version of the certificate request. The initial value of the version is 0. iiiN(RRYt get_versiont set_version(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_versions    cCset}|jt|j|jt|jd|jt|jdd|jt|jddS(s L{X509ReqType.set_version} raises L{TypeError} if called with the wrong number of arguments or with a non-C{int} argument. L{X509ReqType.get_version} raises L{TypeError} if called with any arguments. R^iiN(RRSR_RRR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_version_wrong_argss  cCst}|j}|jt|td|t|tfd|_|j|jjd~d|_|j|jddS(s L{X509ReqType.get_subject} returns an L{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 %rR^RN(RR4RIRJR RKR5RY(R=RR7((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_subjects     cCs#t}|jt|jddS(sf L{X509ReqType.get_subject} raises L{TypeError} if called with any arguments. N(RRSR_R4R`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_subject_wrong_argss cCs5t}|jttdttdgdS(s L{X509Req.add_extensions} accepts a C{list} of L{X509Extension} instances and adds them to the X509 request. R@sCA:falseN(RRcRR)RC(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_extensionss cCsnt}|jt|j|jt|jt|jt|jtg|jt|jgddS(s  L{X509Req.add_extensions} raises L{TypeError} if called with the wrong number of arguments or with a non-C{list}. Or it raises L{ValueError} if called with a C{list} containing objects other than L{X509Extension} instances. N(RRSR_RcRmRR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_extensions_wrong_args(s  ( RwRxRyRRGRORRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs     t X509TestscBs}eZdZeeZdZdZdZdZ dZ dZ dZ dZ d Zd Zd Zd Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!dZ"dZ#dZ$d Z%d!Z&d"Z'd#Z(d$Z)d%Z*d&Z+d'Z,d(Z-RS()s+ Tests for L{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----- cCstS(s2 Create and return a new L{X509}. (R (R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRQscCs$|jtt|jtddS(s L{X509} and L{X509Type} refer to the same type object and can be used to create instances of that type. R N(RER R RF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRGXscCst}|jt|td|t|tf|jttjd|jt|jd|jt|t|jt|tdS(sT L{X509} takes no arguments and returns an instance of L{X509Type}. s%r is of type %r, should be %rRKR N(R RIRJR RKRYRw(R=t certificate((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyROas    cCs#t}|jt|jddS(sX L{X509.get_version} raises L{TypeError} if invoked with any arguments. N(R RSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_version_wrong_argsqs cCsOt}|jt|j|jt|jd|jt|jdddS(s L{X509.set_version} raises L{TypeError} if invoked with the wrong number of arguments or an argument not of type C{int}. iN(R RSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_version_wrong_argsys cCs0t}|jd|j|jddS(st L{X509.set_version} sets the certificate version number. L{X509.get_version} retrieves it. iN(R RRAR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs  cCs#t}|jt|jddS(sf L{X509.get_serial_number} raises L{TypeError} if invoked with any arguments. N(R RSR_tget_serial_numberR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt!test_get_serial_number_wrong_argss cCst}|jt|j|jt|jdd|jt|jd|jt|jd|j|jd|jd|j|jd|jd |j|jd |jd|j|jd|jd|j|jdd S(s The serial number of an L{X509Type} can be retrieved and modified with L{X509Type.get_serial_number} and L{X509Type.set_serial_number}. iit1g@ii i@iNIIIIlllll l l l (R RSR_tset_serial_numberRYR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_serial_numbers     cCs%t}t|d|}t|d|}|j|dtd}|||j||td}|||j||td}|||j|||jt|td|jt||jt|tdtd|jt|tddS(s L{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. tset_nottget_nott20040203040506Zs20040203040506+0530s20040203040506-0115sfoo barN(R RRYR`R)RSRR_(R=twhichRtsettgettwhen((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt _setBoundTests"       "cCs|jddS(s L{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. tBeforeN(R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_notBeforescCs|jddS(s L{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. tAfterN(R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_notAfterscCs2tt|j}|j|jtddS(s L{X509Type.get_notBefore} returns a string in the format of an ASN1 GENERALIZEDTIME even for certificates which store it as UTCTIME internally. t20170611223259ZN(RRtpemDataRYt get_notBeforeR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_notBeforescCs2tt|j}|j|jtddS(s L{X509Type.get_notAfter} returns a string in the format of an ASN1 GENERALIZEDTIME even for certificates which store it as UTCTIME internally. t20370606223259ZN(RRRRYt get_notAfterR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_notAfterscCsOt}|jt|j|jt|jd|jt|jdddS(s L{X509Type.gmtime_adj_notBefore} raises L{TypeError} if called with the wrong number of arguments or a non-C{int} argument. i{N(R RSR_tgmtime_adj_notBeforeR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt$test_gmtime_adj_notBefore_wrong_argss cCsatt|j}tjtdd}|jd|j|jt |j ddS(s L{X509Type.gmtime_adj_notBefore} changes the not-before timestamp to be the current time plus the number of seconds passed in. tsecondsids %Y%m%d%H%M%SZN( RRRRtutcnowRRRYRR)R:(R=RR9((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_gmtime_adj_notBefores cCsOt}|jt|j|jt|jd|jt|jdddS(s L{X509Type.gmtime_adj_notAfter} raises L{TypeError} if called with the wrong number of arguments or a non-C{int} argument. i{N(R RSR_tgmtime_adj_notAfterR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt#test_gmtime_adj_notAfter_wrong_argss cCsatt|j}tjtdd}|jd|j|jt |j ddS(s L{X509Type.gmtime_adj_notAfter} changes the not-after timestamp to be the current time plus the number of seconds passed in. Rids %Y%m%d%H%M%SZN( RRRRRRRRYRR)R:(R=RR9((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_gmtime_adj_notAfters cCs#t}|jt|jddS(sc L{X509Type.has_expired} raises L{TypeError} if called with any arguments. N(R RSR_t has_expiredR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_expired_wrong_args%s cCs-t}|jd|j|jdS(su L{X509Type.has_expired} returns C{True} if the certificate's not-after time is in the past. iN(R RRIR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_expired.s  cCs-t}|jd|j|jdS(sx L{X509Type.has_expired} returns C{False} if the certificate's not-after time is in the future. iN(R RRVR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_not_expired8s  cCs5tt|j}|j|jdtddS(s L{X509.digest} returns a string giving ":"-separated hex-encoded words of the digest of the certificate. Rs_65:D6:61:2C:C2:2D:5F:A6:08:76:9A:03:01:B3:71:FF:FD:48:9B:A3:F2:19:B3:84:CF:3F:D0:9E:57:39:6A:7EN(RRRRYtdigestR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_digestBs cCst}|j|d|j_d|j_ttjjd}|j ||j ||j ||j |dt ttt|S(Ns Unit Testss %Y%m%d%H%M%SZR(R R3R4R5t get_issuerR)RR9R:R;R<RcR%RRR(R=R0t extensionsRR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt_extcertMs     cCsttt}ttdttd}ttdttd}ttdttd}|j|g}|j|jd|j||g}|j|jd|j||||g}|j|jd d S( s{ L{X509.get_extension_count} returns the number of extensions that are present in the certificate. R@sCA:FALSEtkeyUsagetdigitalSignaturetsubjectAltNamesDNS:example.comiiiN( RRtclient_key_pemRR)RCRRYtget_extension_count(R=R0tcaR{Rtc((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_extension_count\scCsttt}ttdttd}ttdttd}ttdttd}|j||||g}|jd}|j t |t|j |j |j |j td|jd}|j t |t|j |j |j |j td|jd }|j t |t|j|j |j |j td|jt|jd |jt|jd |jt|jd d S(s L{X509.get_extension} takes an integer and returns an L{X509Extension} corresponding to the extension at that index. R@sCA:FALSERRRsDNS:example.comiiiiiRlN(RRRRR)RCRLRt get_extensionRIRJRURYRZRVRSt IndexErrorR_(R=R0RR{RRRW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_extensionts*cCs`ttt}|jd}|j|jtd|jtdtt|dS(s The fields of a I{subjectAltName} extension on an X509 may contain NUL bytes and this value is reflected in the string representation of the extension object. iRsDNS:altnull.python.orgexample.com, email:null@python.orguser@example.org, URI:http://null.python.orghttp://example.org, IP Address:192.0.2.1, IP Address:2001:DB8:0:0:0:0:0:1 N(RRRRRYRZR)RB(R=RRW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_nullbyte_subjectAltNames  cCs#t}|jt|jddS(sl L{X509.digest} raises L{ValueError} if called with an unrecognized hash algorithm. RN(R RSRR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_digest_algorithms cCs#t}|jt|jddS(sW L{X509.get_subject} raises L{TypeError} if called with any arguments. N(R RSR_R4R`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs c Cstt|j}|j}|jt|t|j|jt dt dft dt dft dt dft dt dft d t d fgd S( sF L{X509.get_subject} returns an L{X509Name} instance. RRtSTtILtLtChicagotOtTestingRsTesting Root CAN( RRRR4RIRJR RARR)(R=Rtsubj((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs  ?cCsUt}|jt|j|jt|jd|jt|j|jddS(s L{X509.set_subject} raises a L{TypeError} if called with the wrong number of arguments or an argument not of type L{X509Name}. N(R RSR_t set_subjectR`R4(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_subject_wrong_argss cCs~t}|j}d|_d|_|j||j|jjtdtdftdtdfgdS(sj L{X509.set_subject} changes the subject of the certificate to the one passed in. tAUs Unit TestsRR N(R R4RR R RARR)(R=RR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_subjects     cCs#t}|jt|jddS(sV L{X509.get_issuer} raises L{TypeError} if called with any arguments. N(R RSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_issuer_wrong_argss c Cstt|j}|j}|jt|t|j}|j|t dt dft dt dft dt dft dt dft d t d fgd S( sE L{X509.get_issuer} returns an L{X509Name} instance. RRRRRR R R RsTesting Root CAN( RRRRRIRJR RRAR)(R=RR tcomp((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_issuers  ?cCsUt}|jt|j|jt|jd|jt|j|jddS(s L{X509.set_issuer} raises a L{TypeError} if called with the wrong number of arguments or an argument not of type L{X509Name}. N(R RSR_R8R`R(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_issuer_wrong_argss cCs~t}|j}d|_d|_|j||j|jjtdtdftdtdfgdS(sh L{X509.set_issuer} changes the issuer of the certificate to the one passed in. Rs Unit TestsRR N(R RRR R8RARR)(R=RR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_issuers     cCs t}|jt|jdS(s} When called on a certificate with no public key, L{X509.get_pubkey} raises L{OpenSSL.crypto.Error}. N(R RSRR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_pubkey_uninitializeds cCs#t}|jt|jddS(se L{X509.subject_name_hash} raises L{TypeError} if called with any arguments. N(R RSR_tsubject_name_hashR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt!test_subject_name_hash_wrong_argss cCs2tt|j}|j|jddgdS(sg L{X509.subject_name_hash} returns the hash of the certificate's subject name. II8VpN(RRRtassertInR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_subject_name_hash!s  cCs2tt|j}|jtd|jdS(s L{X509Type.get_signature_algorithm} returns a string which means the algorithm used to sign the certificate. tsha1WithRSAEncryptionN(RRRRYR)tget_signature_algorithm(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_signature_algorithm.scCs,d}tt|}|jt|jdS(s L{X509Type.get_signature_algorithm} raises L{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(RRRSRR(R=tcertPEMR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt&test_get_undefined_signature_algorithm8s(.RwRxRytcleartextCertificatePEMtcleartextPrivateKeyPEMRtextpemRRGRORRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR7sT      '   !       t PKCS12TestscBseZdZeeZdZdZdZdZ dZ dddddZ ddddddZ d Zd Zd Zd Zd ZdZdZdZdZdZdZRS(sN Test for L{OpenSSL.crypto.PKCS12} and L{OpenSSL.crypto.load_pkcs12}. cCs$|jtt|jtddS(s1 L{PKCS12Type} is a type object. RN(RERRRF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRG_scCset}|jd|j|jd|j|jd|j|jd|jdS(s L{PKCS12} returns a new instance of L{PKCS12} with no certificate, private key, CA certificates, or friendly name. N(RRYR`tget_certificatetget_privatekeytget_ca_certificatestget_friendlyname(R=tp12((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_empty_constructiongs  cCs$t}|jt|jd|jt|jt|jt|jt|jt|jd|jt|jd|jt|jt|jt|jd|jt|jt|jt|jd|jt|jtf|jt|jd|jt|jd dS( s The L{PKCS12} setter functions (C{set_certificate}, C{set_privatekey}, C{set_ca_certificates}, and C{set_friendlyname}) raise L{TypeError} when passed objects of types other than those expected. itlegboneiiR^RN(ii(sfoosbar( RRSR_tset_certificateRR tset_privatekeytset_ca_certificatestset_friendlyname(R=R(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_errorsss cCsd}t}ttt}|j||jd|j|j||jy"|j d|dddd}Wnt k rdSXt ||}|jd|j |jd|j|j t|jttdfdS(s A L{PKCS12} with only a private key can be exported using L{PKCS12.export} and loaded again using L{load_pkcs12}. tblaht passphrasetiteritmaciteriN(RRRR!R,RYR`R$R%texportRRR&RIRJRRK(R=tpasswdR(R0t dumped_p12((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_key_onlys  " cCsd}t}ttt}|j||j||j|jd|jy"|j d|dddd}Wnt k rdSXt ||}|jd|j|j t |jttdf|jttt|jddS( s A L{PKCS12} with only a certificate can be exported using L{PKCS12.export} and loaded again using L{load_pkcs12}. R0R1R2iR3iNi(RRRR R+RYR$R`R%R4RRRIRJR RKRR&(R=R5R(RR6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_cert_onlys   " (cCst}|r:|jtt|}|j|dn|rk|jtt|}|j|dn|r|jtt|f}|j|dn|r|j |}|j|dn|S(sx Generate a PKCS12 object with components from PEM. Verify that the set functions return None. N( RR+RRRYR`R,RR-R.(R=tcert_pemtkey_pemtca_pemt friendly_nameR(tret((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt gen_pkcs12s tc Cs|rFt|ddddd||}|j|t| |n|rt|ddddd|d|}|j|t| |n|rt|ddddd|d|}|j|t| |nd S( so Use openssl program to confirm three components are recoverable from a PKCS12 string. tpkcs12s-nocertss-nodess-passinspass:s-clcertss-nokeyss-cacertsN(t _runopensslRYtlen( R=tp12_strR{RRR5textrat recovered_keytrecovered_cert((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcheck_recoveryscCsd}tt}t|ddddd|}t||}|jt|ttt|j }|j |tt t|j }|j |t|j d|jdS(s A PKCS12 string generated using the openssl command line can be loaded with L{load_pkcs12} and its components extracted and examined. twhateverR@s-exports-clcertss-passoutspass:N(Rtclient_cert_pemRARRIRJRRRR$RYRR%R`R&(R=R5R*RCR(R9R:((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs12s cCsbd}|jttd|}|j|jdddd|jt|jddddS(sx L{load_pkcs12} raises L{OpenSSL.crypto.Error} when passed a string which is not a PKCS12 dump. RHs fruit loopsisasn1 encoding routinesiN(RSRRRYtargsRB(R=R5te((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs12_garbagescCs |jttt}|jttt|jt tt ttt}ttt}|j |g|j dt |j|j ||jd|j ||g|j dt |j|j ||jd|j ||jddS(s L{PKCS12.set_certificate} replaces the certificate in a PKCS12 cluster. L{PKCS12.set_privatekey} replaces the private key. L{PKCS12.set_ca_certificates} replaces the CA certificates. iiiN(R>RIRt root_cert_pemR+RRtserver_cert_pemR,Rtserver_key_pemR-RYRBR&(R=R(t root_certt client_cert((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_replacesc Csd}|jttt}xtdd tdgD]}|j||j|j||j d|dddd}t ||}|j|j|j|j |d td td td |q7Wd S(s The I{friendlyName} of a PKCS12 can be set and retrieved via L{PKCS12.get_friendlyname} and L{PKCS12_set_friendlyname}, and a L{PKCS12} with a friendly name set can be dumped with L{PKCS12.export}. s$Dogmeat[]{}!@#$%^&*()~`?/.,<>-_+=";:t Serverliciouss###R1R2iR3iR{RRR5N( R>RORPRNR)R`R.RYR'R4RRG(R=R5R(R<R6t reloaded_p12((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_friendly_name$s" c Cs|jttt}d}|jddddd|}|jdddddd}|jdddd }x<|||gD]+}|j|d td td td |qWdS(sf Test that missing, None, and '' passphrases are identical for PKCS12 export. R?R2iR3iR1ii iR{RRR5N(R>RIRRNR4R`RG(R=R(R5tdumped_p12_emptytdumped_p12_nonetdumped_p12_nopwR6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_various_empty_passphrases<scCs<|jttt}|jd|jd|jdS(sg Passing C{None} to L{PKCS12.set_ca_certificates} removes all CA certificates. N(R>RORPRNR-R`RYR&(R=R(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_removing_ca_certLs c Csbd}|jttt}|jddd|dd}|j|dtdtd |d d d S(sb Exporting a PKCS12 with a C{maciter} of C{-1} excludes the MAC entirely. s Lake MichiganR3iR1R2iR{RR5RDs -nomacverN(s -nomacver(R>RORPRNR4RG(R=R5R(R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_without_macVs cCszd}|jttt}|jddd|dd}y)t||}|jt|tWnt k runXdS(sQ Loading a PKCS12 without a MAC does something other than crash. s Lake MichiganR3iR1R2iN( R>RORPRNR4RRIRJRR(R=R5R(R6t recovered_p12((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_without_maccs cCsvd}|jtt}|jg|jd |j|jd|dd}|j|dtdtd|dS( sN A PKCS12 with an empty CA certificates list can be exported. sHobie 18R1R2iR{RR5N((R>RORPR-RYR&R4RG(R=R5R(R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_zero_len_list_for_caxs cCsD|jttt}|j}|j|dtdtdddS(sE All the arguments to L{PKCS12.export} are optional. R{RR5R?N(R>RORPRNR4RG(R=R(R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_without_argss cCs,|jttt}|jt|jdS(sc L{PKCS12.export} raises an exception when a key and certificate mismatch. N(R>RORRNRSRR4(R=R(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_key_cert_mismatchsN((RwRxRyR R!RRGR)R/R7R8R`R>RGRJRMRSRVRZR[R\R^R_R`Ra(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR#Ys*     #         s(\\*)"s(\\+)\ZcCs&tjdtjd|}d|S(s< Internal method for quoting a single command-line argument. @type: C{str} @param s: A single unquoted string to quote for something that is expecting cmd.exe-style quoting @rtype: C{str} @return: A cmd.exe-style quoted string @see: U{http://www.perlmonks.org/?node_id=764004} s\1\1s\1\1\\"s"%s"(t_cmdLineQuoteRe2tsubt_cmdLineQuoteRe(ts((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt cmdLineQuotes cCsdjtt|S(s Quote an iterable of command-line arguments for passing to CreateProcess or a similar API. This allows the list passed to C{reactor.spawnProcess} to match the child process's C{sys.argv} properly. @type arguments: C{iterable} of C{str} @param arguments: An iterable of unquoted arguments to quote @rtype: C{str} @return: A space-delimited string containing quoted versions of L{arguments} t (tjointmapRf(t arguments((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytquoteArgumentss cGstjdkrKddjg|D]}d|jddf^q}ndt|}t|dtdtd t}|jj ||jj |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. tposixsopenssl Rgs'%s't's'\''tshelltstdintstdout( tosRRhtreplaceRkRRCRRotwritetcloseRptread(R*RKtargtcommandtproc((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRAs 3 t FunctionTestscBseZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZRS(sC Tests for free-functions in the L{OpenSSL.crypto} module. cCs|jttdtdS(sX L{load_privatekey} raises L{ValueError} if passed an unknown filetype. idN(RSRRt root_key_pem(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt#test_load_privatekey_invalid_formatscCs |jtttttdS(s L{load_privatekey} raises L{TypeError} if passed a passphrase that is neither a c{str} nor a callable. N(RSR_RRt encryptedPrivateKeyPEMPassphraseRm(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt,test_load_privatekey_invalid_passphrase_typescCs|jttdS(sn L{load_privatekey} raises L{TypeError} if called with the wrong number of arguments. N(RSR_R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_privatekey_wrong_argsscCs#|jtttttddS(s L{load_privatekey} raises L{OpenSSL.crypto.Error} when it is passed an encrypted PEM and an incorrect passphrase. tquackN(RSRRRtencryptedPrivateKeyPEMR)(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt$test_load_privatekey_wrongPassphrasescCs;ttt}tt|}|jttt|ddS(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. tsecretN(RRR!RRRSR(R=R{tblob((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt(test_load_privatekey_passphraseWrongTypes cCs,tttt}|jt|tdS(s~ L{load_privatekey} can create a L{PKey} object from an encrypted PEM string if given the passphrase. N(RRRR|RIRJR (R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_privatekey_passphrases cs?gfd}|jtttt||jdS(s L{load_privatekey} raises L{OpenSSL.crypto.Error} when it is passed an encrypted PEM and a passphrase callback which returns an incorrect passphrase. csjdtdS(NR(tappendR`R)(R(tcalled(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcbs N(RSRRRRRI(R=R((Rs>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt,test_load_privatekey_wrongPassphraseCallbacks csTgfd}ttt|}|jt|t|jtgdS(s L{load_privatekey} can create a L{PKey} object from an encrypted PEM string if given a passphrase callback which returns the correct password. csj|tS(N(RR|(twriting(R(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR's N(RRRRIRJR RYRL(R=RR{((Rs>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt'test_load_privatekey_passphraseCallback s cCs&d}|jtttt|dS(st An exception raised by the passphrase callback passed to L{load_privatekey} is propagated. cSstddS(NsThis is not working.(t RuntimeError(tignored((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytbroken4sN(RSRRRR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt)test_load_privatekey_passphrase_exception/s  cCs |jttttddS(s :py:obj:`load_privatekey` raises :py:obj:`ValueError` if the passphrase callback returns something other than a byte string. cWsdS(Ni((RK((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytDsN(RSRRRR(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt1test_load_privatekey_passphrase_wrong_return_type<scCs0|jtt|jttttddS(sn L{dump_privatekey} raises L{TypeError} if called with the wrong number of arguments. R^N(RSR_RRRR(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey_wrong_argsGscCs9t}|jtd|jttt|dddS(sm L{dump_privatekey} raises L{ValueError} if called with an unrecognized cipher name. itzippersR1N(RR1RRSRRR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt#test_dump_privatekey_unknown_cipherRs  cCs<t}|jtd|jttt|dtdS(s L{dump_privatekey} raises L{TypeError} if called with a passphrase which is neither a C{str} nor a callable. itblowfishN(RR1RRSR_RRRm(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt,test_dump_privatekey_invalid_passphrase_type^s  cCs3t}|jtd|jttd|dS(sj L{dump_privatekey} raises L{ValueError} if called with an unrecognized filetype. iidN(RR1RRSRR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt%test_dump_privatekey_invalid_filetypejs cCs&d}|jtttt|dS(s :py:obj:`crypto.load_privatekey` should raise an error when the passphrase provided by the callback is too long, not silently truncate it. cSsddS(NRi((R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRysN(RSRRRR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt-test_load_privatekey_passphraseCallbackLengthts  cCstd}ttt}tt|d|}|jt|ttt||}|jt|t|j |j |j |j |j |j dS(sU L{dump_privatekey} writes an encrypted PEM when given a passphrase. R^RN( R)RRR!RRIRJR(R RYRKR|(R=R1R{R*t loadedKey((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey_passphrases cCs/ttt}|jttt|dddS(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. RRN(RRR!RSRRR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt(test_dump_privatekey_passphraseWrongTypes c Cstt}tt|}tt|}|j|ttt|}t|ddd}|j||tt|}tt|}|j|ttt|}t|ddd} |j|| dS(s@ L{dump_certificate} writes PEM, DER, and text. R6s-outformtDERs-noouts-textN( R R!RRRRYRRAR( R=RRt dumped_pemt dumped_dertgood_dertcert2t dumped_pem2t dumped_textt good_text((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificates c Csttt}|j|jtt|}|j|ttt|}t|ddd}|j||tt|}tt|}|j|ttt |}t|ddd}|j||dS(sA L{dump_privatekey} writes a PEM, DER, and text. trsas-outformRs-noouts-textN( RRR!RIR}RRYRRAR( R=R{RRRtkey2RRR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekeysc Csttt}tt|}|j|ttt|}t|ddd}|j||tt|}tt|}|j|ttt|}t|ddd}|j|||jt td|dS(sJ L{dump_certificate_request} writes a PEM, DER, and text. R2s-outformRs-noouts-textidN( RRtcleartextCertificateRequestPEMRRYRRARRSR( R=R2RRRtreq2RRR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificate_requestscstdgfd}ttt}tt|d|}|jt|t|jt gtt|}|jt|t |j|j |j |j|j |j dS(s L{dump_privatekey} writes an encrypted PEM when given a callback which returns the correct passphrase. R^csj|S(N(R(R(RR1(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRs RN( R)RRR!RRIRJR(RYRCR RKR|(R=RR{R*R((RR1s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt'test_dump_privatekey_passphraseCallbacks cCs8d}ttt}|jttt|d|dS(sy :py:obj:`dump_privatekey` should not overwrite the exception raised by the passphrase callback. cSs tdS(N(tArithmeticError(R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRsRN(RRR!RSRR(R=RR{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt)test_dump_privatekey_passphrase_exceptions  cCs8d}ttt}|jttt|d|dS(s :py:obj:`crypto.dump_privatekey` should raise an error when the passphrase provided by the callback is too long, not silently truncate it. cSsddS(NRi((R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRsRN(RRR!RSRR(R=RR{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt-test_dump_privatekey_passphraseCallbackLengths  cCs)ttt}|jt|tdS(sm L{load_pkcs7_data} accepts a PKCS#7 string and returns an instance of L{PKCS7Type}. N(RRt pkcs7DataRIRJR(R=tpkcs7((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs7_data s(RwRxRyR{R}R~RRRRRRRRRRRRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRys2          t PKCS7TestscBszeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d ZRS( s! Tests for L{PKCS7Type}. cCs-|jttt|jtjddS(s0 L{PKCS7Type} is a type object. tPKCS7N(RIRJRRKRYRw(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRG scCs)ttt}|jt|jddS(sg L{PKCS7Type.type_is_signed} raises L{TypeError} if called with any arguments. N(RRRRSR_ttype_is_signedR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_signed_wrong_args scCs&ttt}|j|jdS(ss L{PKCS7Type.type_is_signed} returns C{True} if the PKCS7 object is of the type I{signed}. N(RRRRIR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_signed% scCs)ttt}|jt|jddS(sj L{PKCS7Type.type_is_enveloped} raises L{TypeError} if called with any arguments. N(RRRRSR_ttype_is_envelopedR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt!test_type_is_enveloped_wrong_args. scCs&ttt}|j|jdS(s~ L{PKCS7Type.type_is_enveloped} returns C{False} if the PKCS7 object is not of the type I{enveloped}. N(RRRRVR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_enveloped7 scCs)ttt}|jt|jddS(ss L{PKCS7Type.type_is_signedAndEnveloped} raises L{TypeError} if called with any arguments. N(RRRRSR_ttype_is_signedAndEnvelopedR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt*test_type_is_signedAndEnveloped_wrong_args@ scCs&ttt}|j|jdS(s L{PKCS7Type.type_is_signedAndEnveloped} returns C{False} if the PKCS7 object is not of the type I{signed and enveloped}. N(RRRRVR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_signedAndEnvelopedI scCs&ttt}|j|jdS(sq L{PKCS7Type.type_is_data} returns C{False} if the PKCS7 object is not of the type data. N(RRRRVt type_is_data(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_dataR scCs)ttt}|jt|jddS(se L{PKCS7Type.type_is_data} raises L{TypeError} if called with any arguments. N(RRRRSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_data_wrong_args[ scCs)ttt}|jt|jddS(sf L{PKCS7Type.get_type_name} raises L{TypeError} if called with any arguments. N(RRRRSR_t get_type_nameR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_type_name_wrong_argsd scCs/ttt}|j|jtddS(sS L{PKCS7Type.get_type_name} returns a C{str} giving the type name. spkcs7-signedDataN(RRRRARR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_type_namem scCs)ttt}|jtt|ddS(s If an attribute other than one of the methods tested here is accessed on an instance of L{PKCS7Type}, L{AttributeError} is raised. R^N(RRRRSRR(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_attributeu s(RwRxRyRGRRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR s tNetscapeSPKITestscBs;eZdZdZdZdZdZdZRS(s3 Tests for L{OpenSSL.crypto.NetscapeSPKI}. cCstS(sJ Return a new L{NetscapeSPKI} for use with signing tests. (R#(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR scCs$|jtt|jtddS(s L{NetscapeSPKI} and L{NetscapeSPKIType} refer to the same type object and can be used to create instances of that type. R#N(RER#R$RF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRG scCs#t}|jt|tdS(sM L{NetscapeSPKI} returns an instance of L{NetscapeSPKIType}. N(R#RIRJR$(R=tnspki((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO s cs&t|jtfddS(s Accessing a non-existent attribute of a L{NetscapeSPKI} instance causes an L{AttributeError} to be raised. csjS(N(R^((R(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR sN(R#RSR(R=((Rs>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_attribute s cCs/t}|j}|jt|tdS(sV L{NetscapeSPKI.b64_encode} encodes the certificate to a base64 blob. N(R#t b64_encodeRIRJR((R=RR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_b64_encode s  (RwRxRyRRGRORR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR s    t RevokedTestscBsMeZdZdZdZdZdZdZdZdZ RS(s- Tests for L{OpenSSL.crypto.Revoked} cCst}|jt|t|jt|t|j|jtd|j|jd|j|j ddS(sc Confirm we can create L{OpenSSL.crypto.Revoked}. Check that it is empty. t00N( R!RIRJRARKt get_serialR)t get_rev_dateR`t get_reason(R=trevoked((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO s  cCs=|jttd|jttd|jttddS(sv Calling L{OpenSSL.crypto.Revoked} with any arguments results in a L{TypeError} being raised. iR^N(RSR_R!R`(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_construction_wrong_args scCst}|jtd}|j|d |j}|j|td|jtd|j}|j|td|jt|jtd|jt|jd|jt|jd|jt|jd |jt|jdd S( s Confirm we can set and get serial numbers from L{OpenSSL.crypto.Revoked}. Confirm errors are handled with grace. t10bt010Bt31pppt31tpqrstidiR?N( R!t set_serialR)RAR`RRSRR_(R=RR=tser((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_serial s   cCst}|j}|j|dttjjd}|j|}|j |d|j}|j ||dS(s Confirm we can set and get revocation dates from L{OpenSSL.crypto.Revoked}. Confirm errors are handled with grace. s %Y%m%d%H%M%SZN( R!RRAR`R)RR9R:t set_rev_dateRY(R=RtdateR9R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_date s   cCst}x|jD]}xtdD]}|j|}|j|d|j}|j|jjt dt d|jjt dt d|}q)WqW|jd|j |jddS(s Confirm we can set and get revocation reasons from L{OpenSSL.crypto.Revoked}. The "get" need to work as "set". Likewise, each reason of all_reasons() must work. iRgR?N( R!t all_reasonstranget set_reasonRAR`RtlowerRrR)RY(R=RtrtxR=treason((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_reason s  !% cCs?t}|jt|jd|jt|jtddS(s Calling L{OpenSSL.crypto.Revoked.set_reason} with other than one argument, or an argument which isn't a valid reason, results in L{TypeError} or L{ValueError} being raised. idtblueN(R!RSR_RRR)(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_reason_wrong_arguments s cCsOt}|jt|jd|jt|jd|jt|jddS(s Calling L{OpenSSL.crypto.Revoked.get_reason} with any arguments results in L{TypeError} being raised. iR^N(R!RSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_reason_wrong_arguments s ( RwRxRyRORRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR s    tCRLTestscBseZdZeeeZeeeZ dZ dZ dZ dZ dZdZdZdZd Zd Zd Zd Zd ZRS(s) Tests for L{OpenSSL.crypto.CRL} cCs9t}|jt|t|j|jddS(s^ Confirm we can create L{OpenSSL.crypto.CRL}. Check that it is empty N(R RIRJRYt get_revokedR`(R=tcrl((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO$ s cCs=|jttd|jttd|jttddS(s| Calling L{OpenSSL.crypto.CRL} with any number of arguments results in a L{TypeError} being raised. iR?N(RSR_R R`(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR. scCst}t}ttjjd}|j||jtd|jtd|j ||j |j |j dddd}t |dd d }|jtd |jtd |jtd |jtd|j |j |j t}t |dd d dd}|jtd |jtd |jtd |j |j |j dt}|j||dS(s Use python to create a simple CRL with a revocation, and export the CRL in formats of PEM, DER and text. Those outputs are verified with the openssl program. s %Y%m%d%H%M%SZt3abt sUpErSeDEdR/iRRbRs-noouts-textsSerial Number: 03ABt Supersededs:Issuer: /C=US/ST=IL/L=Chicago/O=Testing/CN=Testing Root CAs*Signature Algorithm: sha1WithRSAEncryptions-informRRKN(R R!R)RR9R:RRRt add_revokedR4RR0RAtindexRRRY(R=RRR9t dumped_crlReR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_export8 s(    $cCs`t}t}|jd|jd|jd||jt|jdtdS(st L{OpenSSL.CRL.add_revoked} accepts its single argument as the I{revoked} keyword argument. t01t20160310020145ZRiN(R R!RRRRIRJR(R=RR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_revoked_keywordZ s     c Cst}|jt|j|jt|j|j|jt|j|j|jtddd|jt|jd|jtd|jt|j|jdtd|jt|j|j|jdd|jt|j|jtddS(s Calling L{OpenSSL.CRL.export} with fewer than two or more than five arguments, or with arguments other than the certificate, private key, integer file type, integer number of days, and digest it expects, results in a L{TypeError} being raised. i R^tbooN(R RSR_R4RR0RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_wrong_argsg s +""%cCs2t}|jt|j|j|jdddS(s Calling L{OpenSSL.CRL.export} with a file type other than L{FILETYPE_PEM}, L{FILETYPE_ASN1}, or L{FILETYPE_TEXT} results in a L{ValueError} being raised. idi N(R RSRR4RR0(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_unknown_filetypey s cCs[t}t}ttjjd}|j||jtd|j||jtd|j td|j||j }|j t |d|j t |dt|j t |dt|j |djtd|j |djtd |j |dj||j |dj|d S( s Use python to create a simple CRL with two revocations. Get back the L{Revoked} using L{OpenSSL.CRL.get_revoked} and verify them. s %Y%m%d%H%M%SZRt100Riiit03ABt0100N(R R!R)RR9R:RRRRRRYRBRKRR(R=RRR9trevs((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_revoked s"        cCskt}|jt|jd|jt|jd|jt|jd|jt|jddddS(sw Calling L{OpenSSL.CRL.get_revoked} with any arguments results in a L{TypeError} being raised. iR?N(R RSR_RR`(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_revoked_wrong_args s  cCsRt}|jt|j|jt|jdd|jt|jdddS(s Calling L{OpenSSL.CRL.add_revoked} with other than one argument results in a L{TypeError} being raised. iiR^RN(R RSR_R(R=R((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_revoked_wrong_args s cCsottt}|j}|jt|d|j|djtd|j|djd |j|djtd|j|djtdt tddd }tt |}|j}|jt|d|j|djtd|j|djd |j|djtd|j|djtdd S( sm Load a known CRL and inspect its revocations. Both PEM and DER formats are loaded. iiRiRRRs-outformRN( R"RtcrlDataRRYRBRR)RR`RAR(R=RRR((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt test_load_crl s       cCs@|jtt|jttt|jttttddS(s Calling L{OpenSSL.crypto.load_crl} with other than two arguments results in a L{TypeError} being raised. N(RSR_R"RRR`(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_wrong_args scCs|jttdtdS(sn Calling L{OpenSSL.crypto.load_crl} with an unknown file type raises a L{ValueError}. idN(RSRR"R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_bad_filetype scCs|jtttddS(s Calling L{OpenSSL.crypto.load_crl} with file data which can't be loaded raises a L{OpenSSL.crypto.Error}. s hello, worldN(RSRR"R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_bad_data s(RwRxRyRRR RRR!R0RORRRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR s  "    tSignVerifyTestscBs eZdZdZdZRS(sH Tests for L{OpenSSL.crypto.sign} and L{OpenSSL.crypto.verify}. c Cstd}ttt}ttt}ttt}x{ddgD]m}t|||}t|||||j t t|||||j t t|||td|qFW|j t t||d|j t t|||ddS(sX L{sign} generates a cryptographic signature which L{verify} can check. s6It 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.tmd5Rbttaintedsstrange-digestN( R)RRRzRRNROR%R&RSRR(R=tcontenttpriv_keyt good_certtbad_certRtsig((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_sign_verify s  cCsStd}ttt}ttt}t||d}t|||ddS(sP L{sign} produces a signature for a string with embedded nulls. sWatch out! Did you see it?RbN(R)RRRzRRNR%R&(R=RRRR ((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_sign_nulls s  (RwRxRyR R (((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR s )t__main__(WRytunittestRRqtretsyst subprocessRRRRtOpenSSL.cryptoRRRRR R R R R RRRRRRRRRRRRRRRRRRR R!R"R#R$R%R&tOpenSSL.test.utilR'R(R)R+R,RNRzRORPRIRR R!RRR|RRRRR.RzRRRRR#tcompileRdRbRfRkRARyRRRRRRw(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyts$("                 Bo$C   <t/o8