HEX
Server: Apache
System: Linux server2.voipitup.com.au 4.18.0-553.104.1.lve.el8.x86_64 #1 SMP Tue Feb 10 20:07:30 UTC 2026 x86_64
User: posscale (1027)
PHP: 8.2.29
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib64/python3.6/site-packages/M2Crypto/__pycache__/BIO.cpython-36.pyc
3

���[�*�@s�ddlmZddlZddlmZmZmZerHddlmZm	Z	m
Z
mZmZej
d�ZGdd�de�Zeje�Gdd�de�ZGd	d
�d
e�ZGdd�de�Zddd�ZGdd�de�ZGdd�de�ZGdd�de�ZdS)�)�absolute_importN)�m2�py27plus�six)�AnyStr�Callable�Iterable�Optional�Union�BIOc@seZdZdS)�BIOErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/BIO.pyrsrc@s�eZdZdZejZd0dd�Zdd�Zdd	�Z	e	Z
d
d�Zdd
�Zd1dd�Z
d2dd�Zd3dd�Zdd�Zdd�Zdd�Zdd�Zdd�Zd d!�Zd"d#�Zd$d%�Zd&d'�Zd(d)�Zd*d+�Zd,d-�Zd.d/�ZdS)4rz)Abstract object interface to the BIO API.NrcCs"||_||_||_d|_d|_dS)Nr)�bio�_pyfree�	_close_cb�closed�write_closed)�selfrrrrrr�__init__s
zBIO.__init__cCs|jr|j|j�dS)N)r�m2_bio_freer)rrrr�__del__$szBIO.__del__cCs|jS)N)r)rrrr�_ptr(szBIO._ptrcCstj|j�S)N)rZ
bio_get_fdr)rrrr�fileno.sz
BIO.filenocCs|jS)N)r)rrrr�readable2szBIO.readablecCsx|j�std��|dkrDt�}x tj|jd�}|s4P||7}q W|S|dkrPdS|dkrbtd��nttj|j|��SdS)Nzcannot readir�zread count is negative)r�IOError�	bytearrayr�bio_readr�
ValueError�bytes)r�size�buf�datarrr�read6s
zBIO.read�cCs8|j�std��tj|j|�}|dkr*dn|}tj|�S)Nzcannot read�)rrr�bio_getsrr�
ensure_binary)rr$r%rrr�readlineIs
zBIO.readline�ignoredcCsF|j�std��g}x,tj|jd�}|dkr.P|jtj|��qW|S)Nzcannot readi)rrrr*r�appendrr+)r�sizehint�linesr%rrr�	readlinesQsz
BIO.readlinescCs|jo|jS)N)rr)rrrr�	writeable]sz
BIO.writeablecCs4|j�std��t|tj�r&|jd�}tj|j|�S)z�Write data to BIO.

        :return: either data written, or [0, -1] for nothing written,
                 -2 not implemented
        zcannot write�utf8)	r2r�
isinstancerZ	text_type�encoder�	bio_writer)rr&rrr�writeas

z	BIO.writecCs
d|_dS)N�)r)rrrr�write_closenszBIO.write_closecCstj|j�dS)zTFlush the buffers.

        :return: 1 for success, and 0 or -1 for failure
        N)rZ	bio_flushr)rrrr�flushrsz	BIO.flushcCstj|j�S)zcSet the bio to its initial state.

        :return: 1 for success, and 0 or -1 for failure
        )rZ	bio_resetr)rrrr�resetzsz	BIO.resetcCsd|_|jr|j�dS)Nr8)rr)rrrr�close�sz	BIO.closecCstj|j�S)za
        Can the call be attempted again, or was there an error
        ie do_handshake

        )rZbio_should_retryr)rrrr�should_retry�szBIO.should_retrycCstj|j�S)zShould we read more data?)rZbio_should_readr)rrrr�should_read�szBIO.should_readcCstj|j�S)zShould we write more data?)rZbio_should_writer)rrrr�should_write�szBIO.should_writecCstj|j�S)zReturn the current offset.)rZbio_tellr)rrrr�tell�szBIO.tellcCstj|j|�S)z&Seek to the specified absolute offset.)rZbio_seekr)rZoffrrr�seek�szBIO.seekcCs|S)Nr)rrrr�	__enter__�sz
BIO.__enter__cGs|j�dS)N)r<)r�argsrrr�__exit__�szBIO.__exit__)NrN)N)r()r-)r
rr�__doc__r�bio_freerrrrZbio_ptrrrr'r,r1r2r7r9r:r;r<r=r>r?r@rArBrDrrrrrs0




	csLeZdZdZd�fdd�	Zdd�Zd
dd	�ZeZZ�fd
d�Z	e	Z
�ZS)�MemoryBufferanObject interface to BIO_s_mem.

    Empirical testing suggests that this class performs less well than
    cStringIO, because cStringIO is implemented in C, whereas this class
    is implemented in Python. Thus, the recommended practice is to use
    cStringIO for regular work and convert said cStringIO object to
    a MemoryBuffer object only when necessary.
    Ncshtt|�j|�|dk	r8t|t�r8tdt|�jf��tj	tj
��|_d|_|dk	rdtj
|j|�dS)Nz"data must be bytes or None, not %sr8)�superrGrr4r#�	TypeError�typer
r�bio_newZ	bio_s_memrrr6)rr&)�	__class__rrr�szMemoryBuffer.__init__cCstj|j�S)N)r�bio_ctrl_pendingr)rrrr�__len__�szMemoryBuffer.__len__rcCs<|j�std��|r"tj|j|�Stj|jtj|j��SdS)Nzcannot read)rrrr!rrM)rr$rrrr'�s
zMemoryBuffer.readcs tt|�j�tj|jd�dS)Nr)rHrGr9rZbio_set_mem_eof_returnr)r)rLrrr9�szMemoryBuffer.write_close)N)r)r
rrrErrNr'�getvalueZread_allr9r<�
__classcell__rr)rLrrG�s

rGcsNeZdZdZd�fdd�	Z�fdd�Z�fdd	�Z�fd
d�Zdd
�Z�Z	S)�Filez�Object interface to BIO_s_pyfd.

    This class interfaces Python to OpenSSL functions that expect BIO. For
    general file manipulation in Python, use Python's builtin file object.
    r8�rbcs�tt|�j|dd�t|tj�r*t||�}|j�|j|_	||_
ttd�r`tj
|j�tj�|_ntj|tj�|_||_d|_dS)Nr8)r�bio_new_pyfdF)rHrQrr4rZstring_types�openr:�nameZfname�pyfile�hasattrrrSr�bio_nocloserZbio_new_pyfile�close_pyfiler)rrVrY�mode)rLrrr�s
	
z
File.__init__cstt|�j�|jj�dS)N)rHrQr:rV)r)rLrrr:�sz
File.flushcs*|j�tt|�j�|jr&|jj�dS)N)r:rHrQr<rYrV)r)rLrrr<sz
File.closecstt|�j�S)z^Set the bio to its initial state.

        :return: 0 for success, and -1 for failure
        )rHrQr;)r)rLrrr;sz
File.resetcCs|jstj|j�dS)N)rrrFr)rrrrrszFile.__del__)r8rR)
r
rrrErr:r<r;rrPrr)rLrrQ�srQrRcCsDyt||�}Wn,tk
r:}zt|j��WYdd}~XnXt|�S)N)rTrrrCrQ)�filenamerZ�fZexrrr�openfiles
r]cs>eZdZdZejZejZd
�fdd�	Z	dd�Z
dd	�Z�ZS)�IOBufferz�Object interface to BIO_f_buffer.

    Its principal function is to be BIO_push()'ed on top of a BIO_f_ssl, so
    that makefile() of said underlying SSL socket works.
    �rwbr8csXtt|�j||d�tjtj��|_tj|j|j��|_	||_
d|krNd|_nd|_dS)N)r�wrr8)rHr^rrrKZbio_f_buffer�io�bio_pushrrZ
_under_bior)rZ	under_biorZr)rLrrr(szIOBuffer.__init__cCs(t|dd�r|j|j�|j|j�dS)Nrr)�getattr�
m2_bio_poprrra)rrrrr4szIOBuffer.__del__cCstj|�dS)N)rr<)rrrrr<:szIOBuffer.close)r_r8)
r
rrrEr�bio_poprdrFrrrr<rPrr)rLrr^sr^csReZdZdZejZejZej	Z
�fdd�Zdd�Zdd�Z
dd	�Zd
d�Z�ZS)�CipherStreamz!Object interface to BIO_f_cipher.cs4tt|�j|dd�||_tjtj��|_d|_dS)Nr8)rr)	rHrfr�obiorrKZbio_f_cipherrr)rrg)rLrrrGszCipherStream.__init__cCst|dd�s|j�dS)Nrr8)rcr<)rrrrrNszCipherStream.__del__cCs"|j|j�|j|j�d|_dS)Nr8)rdrrr)rrrrr<SszCipherStream.closecCs|jj�dS)N)rgr9)rrrrr9YszCipherStream.write_closecCsztt|d�}|dkr td|��n(t|t�s4|jd�}t|t�sH|jd�}tj|j|�||t|��tj	|j|j
j��dS)Nzunknown cipherr3)rcrr"r4r#r5Zbio_set_cipherr�intrbrgr)rZalgo�keyZiv�opZcipherrrr�
set_cipher]s



zCipherStream.set_cipher)r
rrrErZPKCS5_SALT_LENZSALT_LENrerdrFrrrr<r9rkrPrr)rLrrf?srfcs8eZdZdZd	�fdd�	Zejfdd�Zdd�Z�Z	S)
�SSLBiozObject interface to BIO_f_ssl.r8cs.tt|�j||d�tjtj��|_d|_dS)N)rr)rHrlrrrKZ	bio_f_sslrr)rr)rLrrrnszSSLBio.__init__cCs2d|_tj|j|j|�|tjkr.|jtj�dS)zf
        Sets the bio to the SSL pointer which is
        contained in the connection object.
        rN)rrZbio_set_sslrZsslrXZset_ssl_close_flagZ	bio_close)rZconnZ
close_flagrrr�set_sslts
zSSLBio.set_sslcCstj|j�S)z�Do the handshake.

        Return 1 if the handshake completes
        Return 0 or a negative number if there is a problem
        )rZbio_do_handshaker)rrrr�do_handshakeszSSLBio.do_handshake)r8)
r
rrrErrrXrmrnrPrr)rLrrlksrl)rR)Z
__future__rZloggingZM2CryptorrrZtypingrrrr	r
Z	getLogger�logr"rZbio_init�objectrrGrQr]r^rfrlrrrr�<module>s

-;

!,