%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/
Upload File :
Create Path :
Current File : //proc/227033/root/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyo

�
�|�Jc@s�dZddlmZddlZddlZddlmZddlmZmZddlm	Z	m
Z
mZmZm
Z
ddlmZmZmZmZddlmZmZdd	lmZmZdd
lmZmZddlmZmZmZddlmZmZdd
lmZmZddlmZm Z ddlm!Z!m"Z"m#Z#ddlm$Z$m%Z%ddl&m'Z'dZ(dZ)dZ*dZ+dZ,dZ-dZ.dZ/dZ0dZ1dZ2dZ3de'fd��YZ4de'fd��YZ5d e'fd!��YZ6d"fd#��YZ7d$e'e7fd%��YZ8d&e'e7fd'��YZ9d(e'fd)��YZ:ej;d*�Z<ej;d+�Z=d,�Z>d-�Z?d.�Z@d/e'fd0��YZAd1e'fd2��YZBd3e'fd4��YZCeDd5kr�e�ndS(6s#
Unit tests for L{OpenSSL.crypto}.
i����(tmainN(tpopen2(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(t
PKCS12Typetload_pkcs12tPKCS12(tNetscapeSPKItNetscapeSPKIType(tTestCases2-----BEGIN CERTIFICATE-----
MIIC7TCCAlagAwIBAgIIPQzE4MbeufQwDQYJKoZIhvcNAQEFBQAwWDELMAkGA1UE
BhMCVVMxCzAJBgNVBAgTAklMMRAwDgYDVQQHEwdDaGljYWdvMRAwDgYDVQQKEwdU
ZXN0aW5nMRgwFgYDVQQDEw9UZXN0aW5nIFJvb3QgQ0EwIhgPMjAwOTAzMjUxMjM2
NThaGA8yMDE3MDYxMT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0BAQQFAAOBgQA7/CqT6PoHycTdhEStWNZde7M/2Yc6BoJu
VwnW8YxGO8Sn6UJ4FeffZNcYZddSDKosw8LtPOeWoK3JINjAk5jiPQ2cww++7QGG
/g5NDjxFZNDJP1dGiLAxPW6JXwov4v0FmdzfLOZ01jDcgQQZqEpYlgpuI5JEWUQ9
Ho4EzbYCOaEAMQA=
-----END PKCS7-----
tX509ExtTestscBs�eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�Zd�Z
d�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
j�jd�}t
j�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).
        i�sYoda root CAs
%Y%m%d%H%M%SZtdaysidN(Rtpkeytgenerate_keyRR
treqt
set_pubkeytget_subjectt
commonNameR	tx509tsubjectt
set_issuerRtnowtstrftimeRt
set_notBeforetset_notAfter(tselfR.texpire((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytsetUp�s"cCs-|jtt�|jtddtd�dS(s�
        L{X509Extension} and L{X509ExtensionType} refer to the same type object
        and can be used to create instances of that type.
        RtbasicConstraintssCA:trueN(tassertIdenticalRRtassertConsistentTypetTrue(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_typescCs�tdtd�}|jt|t�d|t|�tf�tdtd�}|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.
        R5sCA:trues%r is of type %r, should be %rt	nsCommentspyOpenSSL unit testN(RR8t
assertTruet
isinstanceRttypetFalse(R2tbasictcomment((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_constructionscCsO|jttdtd�|jttdtd�|jttdtd�dS(sj
        L{X509Extension} raises something if it is passed a bad extension
        name or value.
        tthisIsMadeUpthiR5s	blah blaht
proxyCertInfos4language:id-ppl-anyLanguage,pathlen:1,policy:text:ABN(tassertRaisesRRR>R8(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_extensionscCsNtdtd�}|j|j��tdtd�}|j|j��dS(so
        L{X509ExtensionType.get_critical} returns the value of the
        extension's critical flag.
        R5sCA:trueN(RR8R;tget_criticalR>tassertFalse(R2text((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_critical1scCsTtdtd�}|j|j�d�tdtd�}|j|j�d�dS(s{
        L{X509ExtensionType.get_short_name} returns a string giving the short
        type name of the extension.
        R5sCA:trueR:sfoo barN(RR8tassertEqualtget_short_name(R2RI((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_short_name<scCs�tdtdd|j�}|jj|g�|jj|jd�tt|j�}|jd|k�|jd|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.
        R5sCA:TRUER,tsha1sX509v3 Basic Constraints:N(	RR>R+tadd_extensionstsignR%RRR;(R2text1ttext((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_unused_subjectGscCsmtdtdd|j�}|jj|g�|jj|jd�tt|j�}|jd|k�dS(s~
        If an extension requires a subject, the C{subject} parameter to
        L{X509Extension} provides its value.
        tsubjectKeyIdentifierthashR,RNsX509v3 Subject Key Identifier:N(	RR>R+RORPR%RRR;(R2text3RR((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_subjectUs
cCs|jttdtd�dS(s
        If an extension requires a subject and the C{subject} parameter is
        given no value, something happens.
        RTRUN(RERRR>(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_missing_subjectasc	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.
        thelloR5sCA:TRUER,N(R8tobjectREt	TypeErrorRR>(R2tbadObj((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_subjectjs
cCs�tdtdd|j�}|jj|g�|jj|jd�tt|j�}|jd|k�|jd|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.
        R5sCA:TRUEtissuerRNsX509v3 Basic Constraints:N(	RR>R+RORPR%RRR;(R2RQRR((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_unused_issuervscCs�tdtdd|j�}|jj|g�|jj|jd�tt|j�}|jd|k�|jd|k�dS(s|
        If an extension requires a issuer, the C{issuer} parameter to
        L{X509Extension} provides its value.
        tauthorityKeyIdentifiers
issuer:alwaysR^RNs X509v3 Authority Key Identifier:sDirName:/CN=Yoda root CAN(	RR>R+RORPR%RRR;(R2text2RR((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_issuer�scCs|jttdtd�dS(s}
        If an extension requires an issue and the C{issuer} parameter is given
        no value, something happens.
        R`skeyid:always,issuer:alwaysN(RERRR>(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_missing_issuer�sc	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.
        RYR`skeyid:always,issuer:alwaysR^N(R8RZRER[RR>(R2R\((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_invalid_issuer�s(t__name__t
__module__t__doc__R4R9RARFRJRMRSRWRXR]R_RbRcRd(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR#�s		
										
		t	PKeyTestscBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(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(R6RRR7(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9�scCsL|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(RER[RtNoneR;R<RR=(R2tkey((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRA�s
	cCs9t�}|j|j�d�|j|j�d�dS(sh
        L{PKeyType.bits} and L{PKeyType.type} return C{0} before the key is
        generated.
        iN(RRKR=tbits(R2Rj((sK/opt/alt/python27/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.
        iiitfootbari����iN(RRER[R&Rt
ValueErrorR(R2Rj((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_failedGeneration�s	cCsOd}t�}|jt|�|j|j�t�|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.
        i�N(RR&RRKR=Rk(R2RkRj((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_rsaGeneration�s
	cCsOd}t�}|jt|�|j|j�t�|j|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(RR&RRKR=Rk(R2RkRj((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dsaGeneration�s
	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.
        ii@N(RRRR&RKR=Rk(R2RjR=Rk((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_regenerations
	%(
ReRfRgR9RARlRpRqRrRs(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRh�s				
	#		t
X509NameTestscBs_eZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�ZRS(
s4
    Unit tests for L{OpenSSL.crypto.X509Name}.
    cKsVt�j�}|j�}|jd��x$|D]\}}t|||�q2W|S(NcSs%|\}}|\}}t||�S(N(tcmp(t.0t.1tk1tv1tk2tv2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt<lambda>!s(R	R)titemstsorttsetattr(R2tattrstnametktv((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	_x509namescCsu|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(	R6RRRKReR;R<R=R�(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9'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.
        RmtbazRntquuxN(R�R*RKtCN(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_attributes6s				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.
        R*RmtemailAddresssbar@example.comR�squux@example.comN(R�RRKR*R�(R2R�tcopy((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_copyJs		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.
        R*RmR�Rns,<X509Name object '/emailAddress=bar/CN=foo'>N(R�RKtrepr(R2R�((sK/opt/alt/python27/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((tatbR;RH((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	_equalityoscs�||�j�j�dS(N(R;RH(R�R�(R�R2(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRKusR*RmR�torganizationalUnitNameRntOUcs�||�j�j�dS(N(RHR;(R�R�(R�R2(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertNotEqual�scSs�|||k�|||k�|||k�|||k�|||k�|||k�|||k�|||k�dS(N((R�R�R;RH((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt_inequality�scs�||�j�j�dS(N(R;RH(R�R�(R�R2(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertLessThan�stabctdefcs�||�j�j�dS(N(RHR;(R�R�(R�R2(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytassertGreaterThan�sN(R�(R2RKR�R�R�R�((R�R�R2sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_comparisonks.	
	
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�RmRnN(R�RKRUR�R�(R2R�R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt	test_hash�s
	cCs2|jdddd�}|j|j�d�dS(sK
        L{X509Name.der} returns the DER encoded form of the name.
        R�RmtCtUSs010	UUS10
UfooN(R�RKtder(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_der�s	cCsm|j�}|j|j�g�d|_|j|j�dg�d|_|j|j�ddg�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.
        RmR�RnR�N(sCNsfoo(sCNsfoo(sOUsbar(R�RKtget_componentsR�R�(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_components�s			(ReRfRgR�R9R�R�R�R�R�R�R�(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRts						K		t_PKeyInteractionTestsMixincBs)eZdZd�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(R2((sK/opt/alt/python27/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�RRERoRP(R2trequestRj((sK/opt/alt/python27/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�RR&RR(t
get_pubkeyRERoRP(R2R�Rjtpub((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_signWithPublicKey�s	
(ReRfRgR�R�R�(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s			tX509ReqTestscBs;eZdZd�Zd�Zd�Zd�Zd�ZRS(s.
    Tests for L{OpenSSL.crypto.X509Req}.
    cCst�S(s5
        Create and return a new L{X509Req}.
        (R
(R2((sK/opt/alt/python27/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.
        R
N(R6R
RR7(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9	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(R
R;R<RR=(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRAs	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(R
RKtget_versiontset_version(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_versions	

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 %rRmRnN(R
R)R;R<RR=R*RK(R2R�R,((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_subject*s			(ReRfRgR�R9RAR�R�(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s				
	t	X509TestscBsreZdZeeZd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd�Z
d	�Zd
�ZRS(s+
    Tests for L{OpenSSL.crypto.X509}.
    cCst�S(s2
        Create and return a new L{X509}.
        (R	(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�CscCs$|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(R6R	R
R7(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9JscCs�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 %rR=R	N(R	R;R<R
R=RKRe(R2tcertificate((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRASs		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	RER[tset_serial_numberRKtget_serial_number(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_serial_numbercs	



cCs�t�}t|d|�}t|d|�}|j|�d�d}||�|j|�|�d}||�|j|�|�d}||�|j|�|�|jt|d�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	tgetattrRKRiRERo(R2twhichR�tsettgettwhen((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt
_setBoundTestxs	


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�(R2((sK/opt/alt/python27/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�(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_set_notAfter�scCs,tt|j�}|j|j�d�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.
        t20090325123658ZN(RRtpemDataRKt
get_notBefore(R2tcert((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_notBefore�scCs,tt|j�}|j|j�d�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.
        t20170611123658ZN(RRR�RKtget_notAfter(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_get_notAfter�scCs&t�}|j|jd�d�dS(s�
        L{X509.digest} returns a string giving ":"-separated hex-encoded words
        of the digest of the certificate.
        tmd5s/A8:EB:07:F8:53:25:0A:F2:56:05:C5:A5:C4:C4:C7:15N(R	RKtdigest(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_digest�s	(ReRfRgtcleartextCertificatePEMtcleartextPrivateKeyPEMR�R�R9RAR�R�R�R�R�R�R�(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�=s
						 					
	
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(R6RRR7(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9�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(RRKRitget_certificatetget_privatekeytget_ca_certificatestget_friendlyname(R2tp12((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_empty_construction�s
	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.
        itlegboneiiRmRnN(ii(sfoosbar(	RRER[tset_certificateRR	tset_privatekeytset_ca_certificatestset_friendlyname(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_type_errors�s	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�RKRiR�R�texportRRR�R;R<RR=(R2tpasswdR�R%t
dumped_p12((sK/opt/alt/python27/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}.
        R�R�R�iR�iNi(RRRR�R�RKR�RiR�R�RRR;R<R	R=RR�(R2R�R�R�R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_cert_onlys 	
"
(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�RRRKRiR�RR�R�(R2tcert_pemtkey_pemtca_pemt
friendly_nameR�tret((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt
gen_pkcs127s	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_runopensslRKtlen(	R2tp12_strRjR�tcaR�textrat
recovered_keytrecovered_cert((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcheck_recoveryLscCs�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(tclient_key_pemtclient_cert_pemR�RR;R<RRRR�RKRR�RiR�(R2R�tpemR�R�R�R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs12cs
cCs\d}|jttd|�}|j|dddd�|jt|dd�d�dS(sx
        L{load_pkcs12} raises L{OpenSSL.crypto.Error} when passed a string
        which is not a PKCS12 dump.
        R�sfruit loopsisasn1 encoding routinesiN(RERRRKR�(R2R�te((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs12_garbagevscCs|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�R�R�t
root_cert_pemR�RRtserver_cert_pemR�Rtserver_key_pemR�RKR�R�(R2R�t	root_certtclient_cert((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_replace�scCs�d}|jttt�}x�dd
dgD]�}|j|�|j|j�|�|jd|dddd�}t	||�}|j|j�|j��|j
|d	td
tdtd|�q+Wd
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###R�R�iR�iRjR�R�R�N(R�R�R�R�RiR�RKR�R�RR�(R2R�R�R�R�treloaded_p12((sK/opt/alt/python27/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�R�iR�iR�ii	iRjR�R�R�N(R�R�R�R�R�RiR�(R2R�R�tdumped_p12_emptytdumped_p12_nonetdumped_p12_nopwR�((sK/opt/alt/python27/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�R�R�R�R�RiRKR�(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_removing_ca_cert�s
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 MichiganR�i����R�R�iRjR�R�R�s	-nomacverN(s	-nomacver(R�R�R�R�R�R�(R2R�R�R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_export_without_mac�scCszd}|jttt�}|jddd|dd�}y)t||�}|jt|t��Wnt	k
runXdS(sQ
        Loading a PKCS12 without a MAC does something other than crash.
        s
Lake MichiganR�i����R�R�iN(
R�R�R�R�R�RR;R<RR(R2R�R�R�t
recovered_p12((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_without_mac�s
cCsvd}|jtt�}|jg�|jd	|j��|jd|dd�}|j|dtdtd|�dS(
sN
        A PKCS12 with an empty CA certificates list can be exported.
        sHobie 18R�R�iRjR�R�N((R�R�R�R�RKR�R�R�(R2R�R�R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_zero_len_list_for_ca�s
cCsD|jttt�}|j�}|j|dtdtdd�dS(sE
        All the arguments to L{PKCS12.export} are optional.
        RjR�R�R�N(R�R�R�R�R�R�(R2R�R�((sK/opt/alt/python27/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�R�R�R�RERR�(R2R�((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_key_cert_mismatchsN((ReRfRgR�R�R�R9R�R�R�R�RiR�R�R�R�RRRR	R
RR
RR(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR��s*
					#						
	
			
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((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcmdLineQuotes
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 (tjointmapR(t	arguments((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytquoteArguments scGs�tjdkrKddjg|D]}d|jdd�f^q�}ndt|�}t|d�\}}|j|�|j�|j�S(s�
    Run the command line openssl tool with the given arguments and write
    the given PEM to its stdin.  Not safe for quotes.
    tposixsopenssl Rs'%s't's'\''R�(	tosR�RtreplaceRRtwritetclosetread(R�targstargtcommandRR ((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR�/s<

t
FunctionTestscBsheZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	d�Z
d	�Zd
�ZRS(sC
    Tests for free-functions in the L{OpenSSL.crypto} module.
    cCs|jttttd�dS(s�
        L{load_privatekey} raises L{OpenSSL.crypto.Error} when it is passed an
        encrypted PEM and an incorrect passphrase.
        tquackN(RERRRtencryptedPrivateKeyPEM(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt$test_load_privatekey_wrongPassphraseCscCs,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&t encryptedPrivateKeyPEMPassphraseR;R<R(R2Rj((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_privatekey_passphraseMs	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�dS(NR%(tappendRi(R�(tcalled(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pytcb_s
N(RERRRR&R;(R2R,((R+sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt,test_load_privatekey_wrongPassphraseCallbackXscsTg��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+(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR,ns
N(RRR&R;R<RRKR>(R2R,Rj((R+sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt'test_load_privatekey_passphraseCallbackgs
cCs�d}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.
        RmtblowfishN(RRR�RR;R<tstrRRKR=Rk(R2R�RjR�t	loadedKey((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_privatekey_passphrasevsc
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.
        R+s-outformtDERs-noouts-textN(	R�R�RRRRKRR�R(
R2R�R�t
dumped_pemt
dumped_dertgood_dertcert2tdumped_pem2tdumped_textt	good_text((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificate�s
c	Cs�ttt�}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-outformR4s-noouts-textN(RRR�RRKRR�R(	R2RjR5R6R7tkey2R9R:R;((sK/opt/alt/python27/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||�dS(sJ
        L{dump_certificate_request} writes a PEM, DER, and text.
        R's-outformR4s-noouts-textN(RRtcleartextCertificateRequestPEMRRKRR�R(	R2R'R5R6R7treq2R9R:R;((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_dump_certificate_request�scs�d�g���fd�}ttt�}tt|d|�}|jt|t��|j�tg�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.
        Rmcs�j|��S(N(R*(R.(R+R�(sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR,�s
R0N(RRR�RR;R<R1RKR8RR=Rk(R2R,RjR�R2((R+R�sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt'test_dump_privatekey_passphraseCallback�scCs)ttt�}|jt|t��dS(sm
        L{load_pkcs7_data} accepts a PKCS#7 string and returns an instance of
        L{PKCS7Type}.
        N(RRt	pkcs7DataR;R<R(R2tpkcs7((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyttest_load_pkcs7_data�s(
ReRfRgR'R)R-R/R3R<R?RBRCRF(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR$?s	
								t
PKCS7TestscBseZdZd�ZRS(s!
    Tests for L{PKCS7Type}.
    cCs-|jttt��|jtjd�dS(s0
        L{PKCS7Type} is a type object.
        tPKCS7N(R;R<RR=RKRe(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9�s(ReRfRgR9(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRG�stNetscapeSPKITestscBs eZdZd�Zd�ZRS(s3
    Tests for L{OpenSSL.crypto.NetscapeSPKI}.
    cCs$|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.
        RN(R6RR R7(R2((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyR9�scCs#t�}|jt|t��dS(sM
        L{NetscapeSPKI} returns an instance of L{NetscapeSPKIType}.
        N(RR;R<R (R2tnspki((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRA�s	(ReRfRgR9RA(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyRI�s		t__main__(ERgtunittestRRtreRRRtOpenSSL.cryptoRRRRRR	R
RRR
RRRRRRRRRRRRRRRRRRR tOpenSSL.test.utilR!R�troot_key_pemR�R�R�R�R�R�R@R&R(RDR#RhRtR�R�R�R�tcompileRRRRR�R$RGRIRe(((sK/opt/alt/python27/lib64/python2.7/site-packages/OpenSSL/test/test_crypto.pyt<module>s\("�m�"?��C			�

Zerion Mini Shell 1.0