ok

Mini Shell

Direktori : /lib64/python2.7/site-packages/OpenSSL/test/
Upload File :
Current File : //lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyc

�
o�[c@sdZddlmZddlZddlZddlZddlmZmZddl	m	Z	m
Z
ddlmZm
Z
mZmZmZddlmZmZmZmZddlmZmZdd	lmZmZdd
lmZmZddlmZmZmZddlmZmZdd
lm Z m!Z!ddlm"Z"m#Z#ddlm$Z$m%Z%m&Z&ddlm'Z'm(Z(m)Z)ddlm*Z*m+Z+ddlm,Z,m-Z-ddl.m/Z/m0Z0m1Z1d�Z2d�Z3e1d�Z4e1d�Z5e1d�Z6e3e1d��Z7e1d�Z8e3e1d��Z9e1d�Z:e3e1d��Z;e1d�Z<e1d�Z=e1d�Z>e1d�Z?e1d �Z@e1d!�ZAe1d"�ZBd#e/fd$��YZCd%e/fd&��YZDd'e/fd(��YZEd)fd*��YZFd+e/eFfd,��YZGd-e/eFfd.��YZHd/e/fd0��YZIejJd1�ZKejJd2�ZLd3�ZMd4�ZNd5�ZOd6e/fd7��YZPd8e/fd9��YZQd:e/eFfd;��YZRd<e/fd=��YZSd>e/fd?��YZTd@e/fdA��YZUeVdBkre�ndS(Cs#
Unit tests for L{OpenSSL.crypto}.
i����(tmainN(tPIPEtPopen(tdatetimet	timedelta(tTYPE_RSAtTYPE_DSAtErrortPKeytPKeyType(tX509tX509TypetX509NametX509NameType(tX509ReqtX509ReqType(t
X509ExtensiontX509ExtensionType(tload_certificatetload_privatekey(tFILETYPE_PEMt
FILETYPE_ASN1t
FILETYPE_TEXT(tdump_certificatetload_certificate_request(tdump_certificate_requesttdump_privatekey(t	PKCS7Typetload_pkcs7_data(tPKCS12t
PKCS12Typetload_pkcs12(tCRLtRevokedtload_crl(tNetscapeSPKItNetscapeSPKIType(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/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Q=
-----END CERTIFICATE-----tX509ExtTestscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�ZRS(s4
    Tests for L{OpenSSL.crypto.X509Extension}.
    cCst�|_|jjtd�t�|_|jj|j�d|jj�_t	�|_
|j
j�|_|jj�j|j_|j
j|j�|j
j|j�t
tj�jd��}t
tj�tdd�jd��}|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).
        isYoda root CAs
%Y%m%d%H%M%SZtdaysidN(Rtpkeytgenerate_keyRRtreqt
set_pubkeytget_subjectt
commonNameR
tx509tsubjectt
set_issuerR)RtnowtstrftimeRt
set_notBeforetset_notAfter(tselfR9texpire((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytsetUp1s(cCs2|jtttd�ttd���d�dS(sw
        The string representation of L{X509Extension} instances as returned by
        C{str} includes stuff.
        tbasicConstraintssCA:falsesCA:FALSEN(tassertEqualststrRR)tTrue(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_strHs!cCs9|jtt�|jtdtd�ttd��dS(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_typeTscCs�ttd�ttd��}|jt|t�d|t|�tf�ttd�ttd��}|jt|t�d|t|�tf�dS(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_scCss|jtttd�ttd��|jtttd�ttd��|jtttd�ttd��dS(sj
        L{X509Extension} raises something if it is passed a bad extension
        name or value.
        tthisIsMadeUpthiR@s	blah blaht
proxyCertInfos4language:id-ppl-anyLanguage,pathlen:1,policy:text:ABN(tassertRaisesRRR)RLRC(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_extensionrscCsfttd�ttd��}|j|j��ttd�ttd��}|j|j��dS(so
        L{X509ExtensionType.get_critical} returns the value of the
        extension's critical flag.
        R@sCA:trueN(RR)RCRItget_criticalRLtassertFalse(R=text((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_critical�scCsxttd�ttd��}|j|j�td��ttd�ttd��}|j|j�td��dS(s{
        L{X509ExtensionType.get_short_name} returns a string giving the short
        type name of the extension.
        R@sCA:trueRHsfoo barN(RR)RCtassertEqualtget_short_name(R=RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_short_name�scCs>ttd�ttd��}|j|j�td��dS(sf
        L{X509Extension.get_data} returns a string giving the data of the
        extension.
        R@sCA:trues0�N(RR)RCRYtget_data(R=RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt
test_get_data�scCsdttd�ttd��}|jt|jd�|jt|jd�|jt|jd�dS(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_args�scCs�ttd�ttd�d|j�}|jj|g�|jj|jd�tt|j�}|j	td�|k�|j	td�|k�dS(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_subject�s$cCsttd�ttd�d|j�}|jj|g�|jj|jd�tt|j�}|j	td�|k�dS(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.pyttest_subject�s$cCs)|jtttd�ttd��dS(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_subject�sc	CsFx?tt�dg|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_subject�s
cCs�ttd�ttd�d|j�}|jj|g�|jj|jd�tt|j�}|j	td�|k�|j	td�|k�dS(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_issuer�s$cCs�ttd�ttd�d|j�}|jj|g�|jj|jd�tt|j�}|j	td�|k�|j	td�|k�dS(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.pyttest_issuer�scCs)|jtttd�ttd��dS(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_issuer�s
c	CsFx?tt�dg|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_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s0
    Unit tests for L{OpenSSL.crypto.PKey}.
    cCs$|jtt�|jtd�dS(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|jttd�t�}|jt|t�d|t|�tf�dS(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|j�d�|j|j�d�|jt|j�dS(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	cCs�t�}|jt|j�|jt|jddd�|jt|jdd�|jt|jdd�|jt|jtd�|jt|jtd�dS(	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^tbari����iN(RRSR_R1Rt
ValueErrorR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_failedGeneration;s	cCsbd}t�}|jt|�|j|j�t�|j|j�|�|j|j��dS(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|j�t�|j|j�|�|jt|j�dS(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|j�dS(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_inconsistentKey�scCsR|jtt�jd�|jtt�jt��|jtt�jd�dS(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_args�s(RwRxRyRGROR~R�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRzs					#	
			t
X509NameTestscBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
s4
    Unit tests for L{OpenSSL.crypto.X509Name}.
    cKset�j�}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	_x509name�s	cCsu|jtt�|jtjd�|jttt��|j�}|jt|t�d|t|�tf�dS(sB
        The type of X509Name objects is L{X509NameType}.
        Rs%r is of type %r, should be %rN(	RERR
RYRwRIRJRKR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRG�scCst|j�}|jtt|dd�|jtt|dd�dtfd��Y}|jtt||�d�dS(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.pyR��sN(R�RSR_R�R`RB(R=R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_onlyStringAttributes�s
cCs)|j�}|jtt|dd�dS(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(R�RStAttributeErrorR�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_setInvalidAttribute�scCs�|j�}d|_|j|jd�|j|jd�d|_|j|jd�|j|jd�d|_|j|jd�|j|jd�d|_|j|jd�|j|jd�dS(si
        L{X509NameType} instances have attributes for each standard (?)
        X509Name field.
        R^tbazRtquuxN(R�R5RYtCN(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_attributes�s				cCs�|jdddd�}t|�}|j|jd�|j|jd�d|_|j|jd�d|_|j|jd�dS(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^temailAddresssbar@example.comR�squux@example.comN(R�RRYR5R�(R=R�tcopy((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_copy�s		cCs2|jdddd�}|jt|�d�dS(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^R�Rs,<X509Name object '/emailAddress=bar/CN=foo'>N(R�RYtrepr(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_repr�s	cs�d����fd�}�j�}|||�|�j��j��|�jdd��jdd��|�jdd��jdd��|�jdddd��jdddd����fd	�}|�jdd��jdd��|�jdd��jdd��d
����fd�}|�jdd��jdd
����fd�}|�jdd
��jdd��dS(sO
        L{X509NameType} instances should compare based on their NIDs.
        cSsQ|||kd||f�|||k�|||k�|||k�dS(Ns(%r == %r) --> False((taR)RIRV((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	_equality
scs�||�j�j�dS(N(RIRV(R�R)(R�R=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRYsR5R^R�torganizationalUnitNameRtOUcs�||�j�j�dS(N(RVRI(R�R)(R�R=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertNotEqual+scSs�|||k�|||k�|||k�|||k�|||k�|||k�|||k�|||k�dS(N((R�R)RIRV((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt_inequality7scs�||�j�j�dS(N(RIRV(R�R)(R�R=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertLessThanAstabctdefcs�||�j�j�dS(N(RVRI(R�R)(R�R=(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertGreaterThanJsN(R�(R=RYR�R�R�R�((R�R�R=s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_comparison	s.	
	
cCsi|jdd�}|jdd�}|j|j�|j��d|_|j|j�|j��dS(sb
        L{X509Name.hash} returns an integer hash based on the value of the
        name.
        R�R^RN(R�RYRhR�R�(R=R�R)((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_hashTs
	cCs8|jdddd�}|j|j�td��dS(sK
        L{X509Name.der} returns the DER encoded form of the name.
        R�R^tCtUSs010	UUS10
UfooN(R�RYtderR)(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_der`s	cCs�|j�}|j|j�g�d|_|j|j�td�td�fg�d|_|j|j�td�td�ftd�td�fg�dS(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^R�RR�N(R�RYtget_componentsR�R)R�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_componentsks	+		cCs2ttt�}|j�}|jd|j�dS(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(RwRxRyR�RGR�R�R�R�R�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s	
			
				K			t_PKeyInteractionTestsMixincBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s7
    Tests which involve another thing and a PKey.
    cCs
t��dS(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.pytsignable�scCs2|j�}t�}|jt|j|d�dS(sY
        L{X509Req.sign} raises L{ValueError} when pass a L{PKey} with no parts.
        tMD5N(R�RRSR�R%(R=trequestR{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithUngenerated�s	cCs[|j�}t�}|jtd�|j|�|j�}|jt|j|d�dS(s{
        L{X509Req.sign} raises L{ValueError} when pass a L{PKey} with no
        private part as the signing key.
        iR�N(	R�RR1RR3t
get_pubkeyRSR�R%(R=R�R{tpub((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithPublicKey�s	
cCsB|j�}t�}|jtd�|jt|j|d�dS(sl
        L{X509Req.sign} raises L{ValueError} when passed a digest name which is
        not known.
        itmonkeysN(R�RR1RRSR�R%(R=R�R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithUnknownDigest�s	cCs�|j�}t�}|jtd�|j|�|j|d�t|dd�dk	r�|j�}|j	|j
|��t�}|jtd�|jt|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(
R�RR1RR3R%tgetattrR`R�RIR&RSR(R=R�R{R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_sign�s	
	(RwRxRyR�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s				
	tX509ReqTestscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s.
    Tests for L{OpenSSL.crypto.X509Req}.
    cCst�S(s5
        Create and return a new L{X509Req}.
        (R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��scCs$|jtt�|jtd�dS(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.pyRG�scCs9t�}|jt|t�d|t|�tf�dS(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.pyRO�s	cCsit�}|j|j�d�|jd�|j|j�d�|jd�|j|j�d�dS(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(RRYtget_versiontset_version(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_version�s	

cCset�}|jt|j�|jt|jd�|jt|jdd�|jt|jd�dS(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_R�R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_version_wrong_args�s
	cCs�t�}|j�}|jt|t�d|t|�tf�d|_|j|j�jd�~d|_|j|jd�dS(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=R�R7((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_subjects			cCs#t�}|jt|jd�dS(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�}|jttd�ttd��g�dS(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|jt�g�|jt|jgd�dS(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_RcRmR�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_extensions_wrong_args(s
	(RwRxRyR�RGROR�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s				
						t	X509TestscBs}eZdZeeZdZd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z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tj7MX9hG
uZzbwDAZzJPjzDQDD7d3cWsrVcfIdqVU7epHqIadnOF+X0ghJ39pAm6VVadnSXCt
WpOdIpB8KksUTCzV591Nr1wd
-----END CERTIFICATE-----
    cCst�S(s2
        Create and return a new L{X509}.
        (R
(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�QscCs$|jtt�|jtd�dS(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
RRF(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRGXscCs�t�}|jt|t�d|t|�tf�|jtt�jd�|jt|�jd�|jt|�t�|jt|�t�dS(sT
        L{X509} takes no arguments and returns an instance of L{X509Type}.
        s%r is of type %r, should be %rRKR
N(R
RIRJRRKRYRw(R=tcertificate((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyROas		cCs#t�}|jt|jd�dS(sX
        L{X509.get_version} raises L{TypeError} if invoked with any arguments.
        N(R
RSR_R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_version_wrong_argsqs	cCsOt�}|jt|j�|jt|jd�|jt|jdd�dS(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_R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_version_wrong_argsys	cCs0t�}|jd�|j|j�d�dS(st
        L{X509.set_version} sets the certificate version number.
        L{X509.get_version} retrieves it.
        i�N(R
R�RAR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s	
cCs#t�}|jt|jd�dS(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_args�s	cCst�}|jt|j�|jt|jdd�|jt|jd�|jt|jd�|j|j�d�|jd�|j|j�d�|jd�|j|j�d
�|jd�|j|j�d�|jd�|j|j�d�d	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@i�NIIIIlllll	l	l	l	(R
RSR_tset_serial_numberRYR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_serial_number�s	



cCs%t�}t|d|�}t|d|�}|j|�d�td�}||�|j|�|�td�}||�|j|�|�td�}||�|j|�|�|jt|td��|jt|�|jt|td�td��|jt|td��dS(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
R�RYR`R)RSR�R_(R=twhichR�tsettgettwhen((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt
_setBoundTest�s"	


"cCs|jd�dS(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_notBefore�scCs|jd�dS(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_notAfter�scCs2tt|j�}|j|j�td��dS(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_notBefore�scCs2tt|j�}|j|j�td��dS(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(RRR�RYtget_notAfterR)(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_notAfter�scCsOt�}|jt|j�|jt|jd�|jt|jdd�dS(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_args�s	cCsatt|j�}tj�tdd�}|jd�|j|j�t	|j
d���dS(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(RRR�RtutcnowRR�RYR�R)R:(R=R�R9((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_gmtime_adj_notBefores
cCsOt�}|jt|j�|jt|jd�|jt|jdd�dS(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�}tj�tdd�}|jd�|j|j�t	|j
d���dS(s�
        L{X509Type.gmtime_adj_notAfter} changes the not-after timestamp to be
        the current time plus the number of seconds passed in.
        R�ids
%Y%m%d%H%M%SZN(RRR�RR�RR�RYR�R)R:(R=R�R9((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_gmtime_adj_notAfters
cCs#t�}|jt|jd�dS(sc
        L{X509Type.has_expired} raises L{TypeError} if called with any
        arguments.
        N(R
RSR_thas_expiredR`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_expired_wrong_args%s	cCs-t�}|jd�|j|j��dS(su
        L{X509Type.has_expired} returns C{True} if the certificate's not-after
        time is in the past.
        i����N(R
R�RIR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_expired.s	
cCs-t�}|jd�|j|j��dS(sx
        L{X509Type.has_expired} returns C{False} if the certificate's not-after
        time is in the future.
        iN(R
R�RVR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_has_not_expired8s	
cCs5tt|j�}|j|jd�td��dS(s�
        L{X509.digest} returns a string giving ":"-separated hex-encoded words
        of the digest of the certificate.
        R�s_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(RRR�RYtdigestR)(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_digestBscCs�t�}|j|�d|j�_d|j�_ttj�jd��}|j	|�|j
|�|j|�|j|d�t
ttt|��S(Ns
Unit Testss
%Y%m%d%H%M%SZR�(R
R3R4R5t
get_issuerR)RR9R:R;R<RcR%RRR(R=R0t
extensionsR�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt_extcertMs	



cCs�ttt�}ttd�ttd��}ttd�ttd��}ttd�ttd��}|j|g�}|j|j�d�|j||g�}|j|j�d�|j||||g�}|j|j�d	�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)RCR�RYtget_extension_count(R=R0tcaR{R�tc((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_extension_count\scCs�ttt�}ttd�ttd��}ttd�ttd��}ttd�ttd��}|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:FALSER�R�R�sDNS:example.comiiii����iRlN(RRR�RR)RCRLR�t
get_extensionRIRJRURYRZRVRSt
IndexErrorR_(R=R0R�R{R�R�RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_extensionts*cCs`ttt�}|jd�}|j|j�td��|jtd�tt|���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.
        iR�s�DNS: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(RRR�RRYRZR)RB(R=R�RW((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_nullbyte_subjectAltName�s	cCs#t�}|jt|jd�dS(sl
        L{X509.digest} raises L{ValueError} if called with an unrecognized hash
        algorithm.
        R�N(R
RSR�R�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_digest_algorithm�s	cCs#t�}|jt|jd�dS(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.pyR��s	c	Cs�tt|j�}|j�}|jt|t��|j|j�t	d�t	d�ft	d�t	d�ft	d�t	d�ft	d�t	d�ft	d	�t	d
�fg�dS(sF
        L{X509.get_subject} returns an L{X509Name} instance.
        R�R�tSTtILtLtChicagotOtTestingR�sTesting Root CAN(
RRR�R4RIRJRRAR�R)(R=R�tsubj((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s	?cCsUt�}|jt|j�|jt|jd�|jt|j|j�d�dS(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_tset_subjectR`R4(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_subject_wrong_args�s	cCs~t�}|j�}d|_d|_|j|�|j|j�j�td�td�ftd�td�fg�dS(sj
        L{X509.set_subject} changes the subject of the certificate to the one
        passed in.
        tAUs
Unit TestsR�R
N(R
R4R�R
R
RAR�R)(R=R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_subject�s			
cCs#t�}|jt|jd�dS(sV
        L{X509.get_issuer} raises L{TypeError} if called with any arguments.
        N(R
RSR_R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_issuer_wrong_args�s	c	Cs�tt|j�}|j�}|jt|t��|j�}|j|t	d�t	d�ft	d�t	d�ft	d�t	d�ft	d�t	d�ft	d	�t	d
�fg�dS(sE
        L{X509.get_issuer} returns an L{X509Name} instance.
        R�R�RRRR	R
RR�sTesting Root CAN(
RRR�R�RIRJRR�RAR)(R=R�Rtcomp((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_issuer�s?cCsUt�}|jt|j�|jt|jd�|jt|j|j�d�dS(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_args�s	cCs~t�}|j�}d|_d|_|j|�|j|j�j�td�td�ftd�td�fg�dS(sh
        L{X509.set_issuer} changes the issuer of the certificate to the one
        passed in.
        Rs
Unit TestsR�R
N(R
R�R�R
R8RAR�R)(R=R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_issuers			
cCs t�}|jt|j�dS(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|jd�dS(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|j�ddg�dS(sg
        L{X509.subject_name_hash} returns the hash of the certificate's subject
        name.
        I����I8Vp�N(RRR�tassertInR(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_subject_name_hash!s
	cCs2tt|j�}|jtd�|j��dS(s�
        L{X509Type.get_signature_algorithm} returns a string which means
        the algorithm used to sign the certificate.
        tsha1WithRSAEncryptionN(RRR�RYR)tget_signature_algorithm(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_signature_algorithm.scCs,d}tt|�}|jt|j�dS(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(RRRSR�R(R=tcertPEMR�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt&test_get_undefined_signature_algorithm8s(.RwRxRytcleartextCertificatePEMtcleartextPrivateKeyPEMR�textpemR�RGROR�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�RRRRR�R�RRRRRRRRRRR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�7sT
							
				'					
	
							
	
				!					
											
	
tPKCS12TestscBs�eZdZeeZd�Zd�Zd�Zd�Z	d�Z
ddddd�Zdddddd�Z
d	�Zd
�Zd�Zd�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sN
    Test for L{OpenSSL.crypto.PKCS12} and L{OpenSSL.crypto.load_pkcs12}.
    cCs$|jtt�|jtd�dS(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|j��dS(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|jt�f�|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	cCs�d}t�}ttt�}|j|�|jd|j��|j||j��y"|j	d|dddd�}Wnt
k
r�dSXt||�}|jd|j��|jd|j��|j
t|j�ttd�f��dS(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_only�s	
"
cCsd}t�}ttt�}|j|�|j||j��|jd|j��y"|j	d|dddd�}Wnt
k
r�dSXt||�}|jd|j��|jt
|j�ttd�f��|jttt|j�d��dS(	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(R�R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_cert_only�s 	
"
(cCs�t�}|r:|jtt|��}|j|d�n|rk|jtt|��}|j|d�n|r�|jtt|�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(
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_pkcs12�s	tc		Cs�|rFt|ddddd||�}|j|t|�|�n|r�t|ddddd|d|�}|j|t|�|�n|r�t|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{R�R�R5textrat
recovered_keytrecovered_cert((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcheck_recovery�scCs�d}tt}t|ddddd|�}t||�}|jt|t��tt|j	��}|j
|t�tt|j��}|j
|t�|j
d|j��dS(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(R�tclient_cert_pemRARRIRJRRRR$RYRR%R`R&(R=R5R*RCR(R9R:((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs12�s
cCsbd}|jttd|�}|j|jdddd�|jt|jdd�d�dS(sx
        L{load_pkcs12} raises L{OpenSSL.crypto.Error} when passed a string
        which is not a PKCS12 dump.
        RHsfruit 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�|jdt
|j���|j||j�d�|j||g�|jdt
|j���|j||j�d�|j||j�d�dS(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>RIR�t
root_cert_pemR+RRtserver_cert_pemR,Rtserver_key_pemR-RYRBR&(R=R(t	root_certtclient_cert((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_replacescCs�d}|jttt�}x�td�d
td�gD]�}|j|�|j|j�|�|j	d|dddd�}t
||�}|j|j�|j��|j|d	td
tdtd|�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{R�R�R5N(R>RORPRNR)R`R.RYR'R4RRG(R=R5R(R<R6treloaded_p12((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_friendly_name$s"
cCs�|jttt�}d}|jddddd|�}|jdddddd�}|jdddd	�}x<|||gD]+}|j|d
tdtdtd
|�qWdS(sf
        Test that missing, None, and '' passphrases are identical for PKCS12
        export.
        R?R2iR3iR1ii	iR{R�R�R5N(R>RIR�RNR4R`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|j��dS(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
�dS(sb
        Exporting a PKCS12 with a C{maciter} of C{-1} excludes the MAC
        entirely.
        s
Lake MichiganR3i����R1R2iR{R�R5RDs	-nomacverN(s	-nomacver(R>RORPRNR4RG(R=R5R(R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_without_macVscCszd}|jttt�}|jddd|dd�}y)t||�}|jt|t��Wnt	k
runXdS(sQ
        Loading a PKCS12 without a MAC does something other than crash.
        s
Lake MichiganR3i����R1R2iN(
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{R�R5N((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|dtdtdd�dS(sE
        All the arguments to L{PKCS12.export} are optional.
        R{R�R5R?N(R>RORPRNR4RG(R=R(R6((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_without_args�scCs,|jttt�}|jt|j�dS(sc
        L{PKCS12.export} raises an exception when a key and certificate
        mismatch.
        N(R>ROR�RNRSRR4(R=R(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_key_cert_mismatch�sN((RwRxRyR R!R�RGR)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.pytcmdLineQuote�s
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.pytquoteArguments�scGs�tjdkrKddjg|D]}d|jdd�f^q�}ndt|�}t|dtdtd	t�}|jj	|�|jj
�|jj�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(
tosR�RhtreplaceRkRRCRRotwritetcloseRptread(R*RKtargtcommandtproc((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRA�s	3
t
FunctionTestscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�Zd
�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(sC
    Tests for free-functions in the L{OpenSSL.crypto} module.
    cCs|jttdt�dS(sX
        L{load_privatekey} raises L{ValueError} if passed an unknown filetype.
        idN(RSR�Rtroot_key_pem(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt#test_load_privatekey_invalid_format�scCs |jttttt��dS(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_type�scCs|jtt�dS(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_args�scCs#|jtttttd��dS(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_wrongPassphrase�scCs;ttt�}tt|�}|jttt|d�dS(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_passphraseWrongType�s	cCs,tttt�}|jt|t��dS(s~
        L{load_privatekey} can create a L{PKey} object from an encrypted PEM
        string if given the passphrase.
        N(RRR�R|RIRJR	(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_privatekey_passphrases	cs?g��fd�}|jtttt|�|j��dS(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.
        cs�jd�td�S(NR(tappendR`R)(R�(tcalled(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcbs
N(RSRRRR�RI(R=R�((R�s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt,test_load_privatekey_wrongPassphraseCallbackscsTg��fd�}ttt|�}|jt|t��|j�tg�dS(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.
        cs�j|�tS(N(R�R|(twriting(R�(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�'s
N(RRR�RIRJR	RYRL(R=R�R{((R�s>/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.
        cSstd��dS(NsThis is not working.(tRuntimeError(tignored((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytbroken4sN(RSR�RRR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt)test_load_privatekey_passphrase_exception/s
	cCs |jttttd��dS(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.pyt<lambda>DsN(RSR�RRR�(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt1test_load_privatekey_passphrase_wrong_return_type<scCs0|jtt�|jtttt�d�dS(sn
        L{dump_privatekey} raises L{TypeError} if called with the wrong number
        of arguments.
        R^N(RSR_RR�RR(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey_wrong_argsGscCs9t�}|jtd�|jttt|dd�dS(sm
        L{dump_privatekey} raises L{ValueError} if called with an unrecognized
        cipher name.
        itzippersR1N(RR1RRSR�RR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt#test_dump_privatekey_unknown_cipherRs
	cCs<t�}|jtd�|jttt|dt��dS(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(RR1RRSR�R(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(NR�i((R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�ysN(RSR�RRR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt-test_load_privatekey_passphraseCallbackLengthts		cCs�td�}ttt�}tt|d|�}|jt|t��tt||�}|jt|t��|j	|j
�|j
��|j	|j�|j��dS(sU
        L{dump_privatekey} writes an encrypted PEM when given a passphrase.
        R^R�N(R)RRR!RRIRJR(R	RYRKR|(R=R1R{R*t	loadedKey((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey_passphrase�scCs/ttt�}|jttt|dd�dS(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�R�N(RRR!RSR�RR(R=R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt(test_dump_privatekey_passphraseWrongType�s	c
Cs�tt}tt|�}tt|�}|j|t�tt|�}t|ddd�}|j||�tt|�}tt|�}|j|t�tt|�}t|ddd�}	|j||	�dS(s@
        L{dump_certificate} writes PEM, DER, and text.
        R6s-outformtDERs-noouts-textN(	R R!RRRRYRRAR(
R=R�R�t
dumped_pemt
dumped_dertgood_dertcert2tdumped_pem2tdumped_textt	good_text((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificate�s
c	Cs�ttt�}|j|j��tt|�}|j|t�tt|�}t|ddd�}|j||�tt|�}tt|�}|j|t�tt	|�}t|ddd�}|j||�dS(sA
        L{dump_privatekey} writes a PEM, DER, and text.
        trsas-outformR�s-noouts-textN(
RRR!RIR}RRYRRAR(	R=R{R�R�R�tkey2R�R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey�sc	Cs�ttt�}tt|�}|j|t�tt|�}t|ddd�}|j||�tt|�}tt|�}|j|t�tt|�}t|ddd�}|j||�|jt	td|�dS(sJ
        L{dump_certificate_request} writes a PEM, DER, and text.
        R2s-outformR�s-noouts-textidN(
RRtcleartextCertificateRequestPEMRRYRRARRSR�(	R=R2R�R�R�treq2R�R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificate_request�scs�td��g���fd�}ttt�}tt|d|�}|jt|t��|j�t	g�tt|��}|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^cs�j|��S(N(R�(R�(R�R1(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s
R�N(
R)RRR!RRIRJR(RYRCR	RKR|(R=R�R{R*R�((R�R1s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt'test_dump_privatekey_passphraseCallback�scCs8d�}ttt�}|jttt|d|�dS(sy
        :py:obj:`dump_privatekey` should not overwrite the exception raised
        by the passphrase callback.
        cSs
t�dS(N(tArithmeticError(R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��sR�N(RRR!RSR�R(R=R�R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt)test_dump_privatekey_passphrase_exception�s		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(NR�i((R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��sR�N(RRR!RSR�R(R=R�R{((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt-test_dump_privatekey_passphraseCallbackLength�s		cCs)ttt�}|jt|t��dS(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~R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRy�s2				
					
					
								
	
t
PKCS7TestscBszeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�ZRS(
s!
    Tests for L{PKCS7Type}.
    cCs-|jttt��|jtjd�dS(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|jd�dS(sg
        L{PKCS7Type.type_is_signed} raises L{TypeError} if called with any
        arguments.
        N(RRR�RSR_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|j��dS(ss
        L{PKCS7Type.type_is_signed} returns C{True} if the PKCS7 object is of
        the type I{signed}.
        N(RRR�RIR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_signed%	scCs)ttt�}|jt|jd�dS(sj
        L{PKCS7Type.type_is_enveloped} raises L{TypeError} if called with any
        arguments.
        N(RRR�RSR_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|j��dS(s~
        L{PKCS7Type.type_is_enveloped} returns C{False} if the PKCS7 object is
        not of the type I{enveloped}.
        N(RRR�RVR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_enveloped7	scCs)ttt�}|jt|jd�dS(ss
        L{PKCS7Type.type_is_signedAndEnveloped} raises L{TypeError} if called
        with any arguments.
        N(RRR�RSR_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|j��dS(s�
        L{PKCS7Type.type_is_signedAndEnveloped} returns C{False} if the PKCS7
        object is not of the type I{signed and enveloped}.
        N(RRR�RVR�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_signedAndEnvelopedI	scCs&ttt�}|j|j��dS(sq
        L{PKCS7Type.type_is_data} returns C{False} if the PKCS7 object is not of
        the type data.
        N(RRR�RVttype_is_data(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_dataR	scCs)ttt�}|jt|jd�dS(se
        L{PKCS7Type.type_is_data} raises L{TypeError} if called with any
        arguments.
        N(RRR�RSR_R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_is_data_wrong_args[	scCs)ttt�}|jt|jd�dS(sf
        L{PKCS7Type.get_type_name} raises L{TypeError} if called with any
        arguments.
        N(RRR�RSR_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|j�td��dS(sS
        L{PKCS7Type.get_type_name} returns a C{str} giving the type name.
        spkcs7-signedDataN(RRR�RAR�R)(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_type_namem	scCs)ttt�}|jtt|d�dS(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(RRR�RSR�R�(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_attributeu	s(RwRxRyRGR�R�R�R�R�R�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�	s	
																			tNetscapeSPKITestscBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s3
    Tests for L{OpenSSL.crypto.NetscapeSPKI}.
    cCst�S(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�|jtd�dS(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|t��dS(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��|jt�fd��dS(s�
        Accessing a non-existent attribute of a L{NetscapeSPKI} instance causes
        an L{AttributeError} to be raised.
        cs�jS(N(R^((R�(s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��	sN(R#RSR�(R=((R�s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_attribute�	s	cCs/t�}|j�}|jt|t��dS(sV
        L{NetscapeSPKI.b64_encode} encodes the certificate to a base64 blob.
        N(R#t
b64_encodeRIRJR((R=R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_b64_encode�	s	(RwRxRyR�RGROR�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�	s						tRevokedTestscBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s-
    Tests for L{OpenSSL.crypto.Revoked}
    cCs�t�}|jt|t��|jt|�t�|j|j�td��|j|j�d�|j|j	�d�dS(sc
        Confirm we can create L{OpenSSL.crypto.Revoked}.  Check
        that it is empty.
        t00N(
R!RIRJRARKt
get_serialR)tget_rev_dateR`t
get_reason(R=trevoked((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO�	s	cCs=|jttd�|jttd�|jttd�dS(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�	scCs�t�}|jtd��}|j|d	�|j�}|j|td��|jtd��|j�}|j|td��|jt|jtd��|jt|jd�|jt|jd�|jt|jd	�|jt|jd�d	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`R�RSR�R_(R=R�R=tser((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_serial�	s	cCst�}|j�}|j|d�ttj�jd��}|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!R�RAR`R)RR9R:tset_rev_dateRY(R=R�tdateR9R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_date�	s	cCs�t�}x�|j�D]�}x�td�D]�}|j|�}|j|d�|j�}|j|j�jt	d�t	d��|j�jt	d�t	d���|}q)WqW|jd�|j
|j�d�dS(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!tall_reasonstranget
set_reasonRAR`R�tlowerRrR)RY(R=R�trtxR=treason((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_reason�	s	!%
cCs?t�}|jt|jd�|jt|jtd��dS(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_R�R�R)(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|jd�dS(s
        Calling L{OpenSSL.crypto.Revoked.get_reason} with any
        arguments results in L{TypeError} being raised.
        iR^N(R!RSR_R�R`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_reason_wrong_arguments
s	(
RwRxRyROR�R�R�R�R�R�(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��	s	
	
				tCRLTestscBs�eZdZeee�Zeee�Z	d�Z
d�Zd�Zd�Z
d�Zd�Zd�Zd�Zd	�Zd
�Zd�Zd�Zd
�ZRS(s)
    Tests for L{OpenSSL.crypto.CRL}
    cCs9t�}|jt|t��|j|j�d�dS(s^
        Confirm we can create L{OpenSSL.crypto.CRL}.  Check
        that it is empty
        N(R RIRJRYtget_revokedR`(R=tcrl((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRO$
s	cCs=|jttd�|jttd�|jttd�dS(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�.
scCs�t�}t�}ttj�jd��}|j|�|jtd��|jtd��|j	|�|j
|j|jdddd�}t
|dd	d
�}|jtd��|jtd��|jtd
��|jtd��|j
|j|jt�}t
|dd	d
dd�}|jtd��|jtd��|jtd
��|j
|j|jdt�}|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/iR�RbR�s-noouts-textsSerial Number: 03ABt
Supersededs:Issuer: /C=US/ST=IL/L=Chicago/O=Testing/CN=Testing Root CAs*Signature Algorithm: sha1WithRSAEncryptions-informR�RKN(R R!R)RR9R:R�R�R�tadd_revokedR4R�R0RAtindexRRRY(R=R�R�R9t
dumped_crlReR�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export8
s(		

$cCs`t�}t�}|jd�|jd�|jd|�|jt|j�dt��dS(st
        L{OpenSSL.CRL.add_revoked} accepts its single argument as the
        I{revoked} keyword argument.
        t01t20160310020145ZR�iN(R R!R�R�R�RIRJR�(R=R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_add_revoked_keywordZ
s		

c	Cs�t�}|jt|j�|jt|j|j�|jt|j|j|jtddd�|jt|jd|jtd�|jt|j|jdtd�|jt|j|j|jdd�|jt|j|jtd�dS(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_R4R�R0RR`(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_wrong_argsg
s	+""%cCs2t�}|jt|j|j|jdd�dS(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 RSR�R4R�R0(R=R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_unknown_filetypey
s	cCs[t�}t�}ttj�jd��}|j|�|jtd��|j|�|jtd��|j	td��|j|�|j
�}|jt|�d�|jt
|d�t�|jt
|d�t�|j|dj�td��|j|dj�td	��|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%SZR�t100R�iiit03ABt0100N(R R!R)RR9R:R�R�R�R�R�RYRBRKR�R�(R=R�R�R9trevs((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_revoked�
s"		


  cCskt�}|jt|jd�|jt|jd�|jt|jd�|jt|jddd�dS(sw
        Calling L{OpenSSL.CRL.get_revoked} with any arguments results
        in a L{TypeError} being raised.
        iR?N(R RSR_R�R`(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|jdd�dS(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|dj�td��|j|dj�d
�|j|dj�td��|j|dj�td��t
tddd	�}tt|�}|j�}|jt|�d�|j|dj�td��|j|dj�d
�|j|dj�td��|j|dj�td��d
S(sm
        Load a known CRL and inspect its revocations.  Both
        PEM and DER formats are loaded.
        iiR�iR�R�R�s-outformR�N(R"RtcrlDataR�RYRBR�R)R�R`RAR(R=R�R�R�((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt
test_load_crl�
s     cCs@|jtt�|jttt�|jttttd�dS(s�
        Calling L{OpenSSL.crypto.load_crl} with other than two
        arguments results in a L{TypeError} being raised.
        N(RSR_R"RR�R`(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_wrong_args�
scCs|jttdt�dS(sn
        Calling L{OpenSSL.crypto.load_crl} with an unknown file type
        raises a L{ValueError}.
        idN(RSR�R"R�(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_bad_filetype�
scCs|jtttd�dS(s�
        Calling L{OpenSSL.crypto.load_crl} with file data which can't
        be loaded raises a L{OpenSSL.crypto.Error}.
        shello, worldN(RSRR"R(R=((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_crl_bad_data�
s(RwRxRyRRR R�RR!R0ROR�R�R�R�R�R�R�R�R�R�RR(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�
s 	
	
	"	
		
					
	tSignVerifyTestscBs eZdZd�Zd�ZRS(sH
    Tests for L{OpenSSL.crypto.sign} and L{OpenSSL.crypto.verify}.
    c	Cs�td�}ttt�}ttt�}ttt�}x{ddgD]m}t|||�}t||||�|j	t
t||||�|j	t
t|||td�|�qFW|j	tt||d�|j	tt|||d�dS(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_certR�tsig((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_sign_verify�
s 	cCsStd�}ttt�}ttt�}t||d�}t|||d�dS(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_nullss
(RwRxRyR
R(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�
s	)t__main__(WRytunittestRRqtretsyst
subprocessRRRRtOpenSSL.cryptoRRRRR	R
RRR
RRRRRRRRRRRRRRRRRRR R!R"R#R$R%R&tOpenSSL.test.utilR'R(R)R+R,RNRzRORPRIR�R R!R�R�R|R�R�R�R�R.RzR�R�R�R�R#tcompileRdRbRfRkRARyR�R�R�R�RRw(((s>/usr/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt<module>s�$("														���Bo��$�C			�<t/o�8

Zerion Mini Shell 1.0