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: //usr/lib64/python3.6/site-packages/M2Crypto/__pycache__/EC.cpython-36.opt-1.pyc
3

YݧZd>�@s�ddlmZddlmZmZmZmZmZejrNddl	m
Z
mZmZm
Z
mZmZeZGdd�de�Zeje�ejZejZejZejZejZejZejZejZejZejZejZej Z ej!Z!ej"Z"ej#Z#ej$Z$ej%Z%ej&Z&ej'Z'ej(Z(ej)Z)ej*Z*ej+Z+ej,Z,ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2ej3Z3ej4Z5ej6Z7ej8Z9ej:Z;ej<Z=ej>Z?ej@ZAejBZCejDZEejFZGejHZIejJZKejLZMejNZOejPZQejRZSejTZUejVZWejXZYejZZ[ej\Z]ej^Z_ej`Zae5Z4e7Z6e9Z8e;Z:e=Z<e?Z>eAZ@eCZBeEZDeGZFeIZHeKZJeMZLeOZNeQZPeSZReUZTeWZVeYZXe[ZZe]Z\e_Z^eaZ`ejbZbejcZcejdZdejeZeejfZfejgZgejhZhejiZiejjZjejkZkejlZlGdd�dem�ZnGdd	�d	en�Zod
d�Zpejqfdd
�Zrejqfdd�Zsejqfdd�Ztdd�Zuejqfdd�Zvdd�Zwdd�Zxdd�Zydd�Zzdd�Z{d S)!�)�absolute_import)�BIO�Err�EVP�m2�util)�AnyStr�Callable�Dict�Optional�Tuple�Unionc@seZdZdS)�ECErrorN)�__name__�
__module__�__qualname__�rr�/usr/lib64/python3.6/EC.pyrsrc@s�eZdZdZejZd'dd�Zdd�Zdd�Z	d	d
�Z
dd�Zd
d�Zdd�Z
dd�Zdd�Zdd�Zdejfdd�Zdejfdd�Zdd�Zdd�Zdejfd d!�Zd"d#�Zd$d%�Zd&S)(�ECz,
    Object interface to a EC key pair.
    rcCs||_||_dS)N)�ec�_pyfree)�selfrrrrr�__init__�szEC.__init__cCst|dd�r|j|j�dS)Nrr)�getattr�m2_ec_key_freer)rrrr�__del__�sz
EC.__del__cCstj|j�S)N)rZ
ec_key_keylenr)rrrr�__len__�sz
EC.__len__cCstj|j�dS)z�
        Generates the key pair from its parameters. Use::

            keypair = EC.gen_params(curve)
            keypair.gen_key()

        to create an EC key pair.
        N)rZec_key_gen_keyr)rrrr�gen_key�sz
EC.gen_keycCst|jd�S)Nr)�EC_pubr)rrrr�pub�szEC.pubcCstj|j|�S)zw
        Sign the given digest using ECDSA. Returns a tuple (r,s), the two
        ECDSA signature parameters.
        )rZ
ecdsa_signr)r�digestrrr�sign_dsa�szEC.sign_dsacCstj|j|||�S)zj
        Verify the given digest using ECDSA. r and s are the ECDSA
        signature parameters.
        )rZecdsa_verifyr)rr �r�srrr�
verify_dsa�sz
EC.verify_dsacCstj|j|�S)N)rZecdsa_sign_asn1r)rr rrr�
sign_dsa_asn1�szEC.sign_dsa_asn1cCstj|j||�S)N)rZecdsa_verify_asn1r)rr Zblobrrr�verify_dsa_asn1�szEC.verify_dsa_asn1cCstj|j|j�S)z�
        Compute the ECDH shared key of this key pair and the given public
        key object. They must both use the same curve. Returns the
        shared key in binary as a buffer object. No Key Derivation Function is
        applied.
        )rZecdh_compute_keyr)rZpub_keyrrr�compute_dh_key�s	zEC.compute_dh_keyZaes_128_cbccCsX|dkrtj|j|j�|�Stt|d�}|dkr<td|��tj|j|j�|�|�SdS)aB
        Save the key pair to an M2Crypto.BIO.BIO object in PEM format.

        :param bio: M2Crypto.BIO.BIO object to save key to.

        :param cipher: Symmetric cipher to protect the key. The default
                       cipher is 'aes_128_cbc'. If cipher is None, then
                       the key is saved in the clear.

        :param callback: A Python callable object that is invoked
                         to acquire a passphrase with which to protect
                         the key. The default is
                         util.passphrase_callback.
        Nznot such cipher %s)rZec_key_write_bio_no_cipherr�_ptrr�
ValueErrorZec_key_write_bio)r�bio�cipher�callbackZciphrrr�save_key_bio�szEC.save_key_biocCs&tj|d��}|j|||�SQRXdS)a)
        Save the key pair to a file in PEM format.

        :param file: Name of filename to save key to.

        :param cipher: Symmetric cipher to protect the key. The default
                       cipher is 'aes_128_cbc'. If cipher is None, then
                       the key is saved in the clear.

        :param callback: A Python callable object that is invoked
                         to acquire a passphrase with which to protect
                         the key.  The default is
                         util.passphrase_callback.
        �wbN)r�openfiler-)r�filer+r,r*rrr�save_key�szEC.save_keycCstj|j|j��S)z�
        Save the public key to an M2Crypto.BIO.BIO object in PEM format.

        :param bio: M2Crypto.BIO.BIO object to save key to.
        )r�ec_key_write_pubkeyrr()rr*rrr�save_pub_key_bioszEC.save_pub_key_bioc
Cs*tj|d��}tj|j|j��SQRXdS)zy
        Save the public key to a filename in PEM format.

        :param file: Name of filename to save key to.
        r.N)rr/rr2rr()rr0r*rrr�save_pub_key	szEC.save_pub_keycCs*tj��}|j|||�|j�SQRXdS)z�
        Returns the key(pair) as a string in PEM format.
        If no password is passed and the cipher is set
        it exits with error
        N)r�MemoryBufferr-�read)rr+r,r*rrr�as_pems
z	EC.as_pemcCstj|j�S)N)rZec_key_type_checkr)rrrr�_check_key_typeszEC._check_key_typecCstj|j�S)N)rZec_key_check_keyr)rrrr�	check_key!szEC.check_keyN)r)rrr�__doc__rZec_key_freerrrrrrr!r$r%r&r'r�passphrase_callbackr-r1r3r4r7r8r9rrrrr�s*

			

rc@s6eZdZdZd
dd�Zdd�Zdd�ZejZ	ej
Zd	S)rzb
    Object interface to an EC public key.
    ((don't like this implementation inheritance))
    rcCstj|||�d|_dS)N)rr�der)rrrrrrr-szEC_pub.__init__cCs|jdkrtj|j�|_|jS)zJ
        Returns the public key in DER format as a buffer object.
        N)r<rZec_key_get_public_derr)rrrr�get_der2s
zEC_pub.get_dercCstj|j�S)z:
        Returns the public key as a byte string.
        )rZec_key_get_public_keyr)rrrr�get_key<szEC_pub.get_keyN)r)rrrr:rr=r>rr4r1r3r-rrrrr's

rcCsttj|�d�S)z�
    Factory function that generates EC parameters and
    instantiates a EC object from the output.

    :param curve: This is the OpenSSL nid of the curve to use.
    �)rrZec_key_new_by_curve_name)�curverrr�
gen_paramsIsrAc
Cs tj|��}t||�SQRXdS)a+
    Factory function that instantiates a EC object.

    :param file: Names the filename that contains the PEM representation
                 of the EC key pair.

    :param callback: Python callback object that will be invoked
                     if the EC key pair is passphrase-protected.
    N)rr/�load_key_bio)r0r,r*rrr�load_keyWsrCc
Cs tj|��}t||�SQRXdS)aZ
    Load an EC key pair from a string.

    :param string: String containing EC key pair in PEM format.

    :param callback: A Python callable object that is invoked
                     to acquire a passphrase with which to unlock the
                     key. The default is util.passphrase_callback.

    :return: M2Crypto.EC.EC object.
    N)rr5rB)�stringr,r*rrr�load_key_stringfs
rEcCsttj|j�|�d�S)a*
    Factory function that instantiates a EC object.

    :param bio: M2Crypto.BIO object that contains the PEM
                representation of the EC key pair.

    :param callback: Python callback object that will be invoked
                     if the EC key pair is passphrase-protected.
    r?)rrZec_key_read_bior()r*r,rrrrBwsrBc	Cstj|��
}t|�SQRXdS)z�
    Load an EC public key from filename.

    :param file: Name of filename containing EC public key in PEM
                 format.

    :return: M2Crypto.EC.EC_pub object.
    N)rr/�load_pub_key_bio)r0r*rrr�load_pub_key�s
rGc
Cs"tj|��}tj||�SQRXdS)aE
    Load an M2Crypto.EC.PKey from a public key as a string.

    :param string: String containing the key in PEM format.

    :param callback: A Python callable object that is invoked
                     to acquire a passphrase with which to protect the
                     key.

    :return: M2Crypto.EC.PKey object.
    N)rr5rZload_key_bio_pubkey)rDr,r*rrr�load_key_string_pubkey�s
rHcCs&tj|j��}|dkrt�t|d�S)z�
    Load an EC public key from an M2Crypto.BIO.BIO object.

    :param bio: M2Crypto.BIO.BIO object containing EC public key in PEM
                format.

    :return: M2Crypto.EC.EC_pub object.
    Nr?)rZec_key_read_pubkeyr(�ec_errorr)r*rrrrrF�s
rFcCsttj���dS)N)rrZget_error_messagerrrrrI�srIcCsttj|�d�S)z!
    Create EC_pub from DER.
    r?)rrZec_key_from_pubkey_der)r<rrr�pub_key_from_der�srJcCsttj||�d�S)z9
    Create EC_pub from curve name and octet string.
    r?)rrZec_key_from_pubkey_params)r@�bytesrrr�pub_key_from_params�srLcCstj�S)N)rZec_get_builtin_curvesrrrr�get_builtin_curves�srMN)|Z
__future__rZM2CryptorrrrrZpy27plusZtypingrr	r
rrr
rKZEC_Key�	ExceptionrZec_initZ
NID_secp112r1Z
NID_secp112r2Z
NID_secp128r1Z
NID_secp128r2Z
NID_secp160k1Z
NID_secp160r1Z
NID_secp160r2Z
NID_secp192k1Z
NID_secp224k1Z
NID_secp224r1Z
NID_secp256k1Z
NID_secp384r1Z
NID_secp521r1Z
NID_sect113r1Z
NID_sect113r2Z
NID_sect131r1Z
NID_sect131r2Z
NID_sect163k1Z
NID_sect163r1Z
NID_sect163r2Z
NID_sect193r1Z
NID_sect193r2Z
NID_sect233k1Z
NID_sect233r1Z
NID_sect239k1Z
NID_sect283k1Z
NID_sect283r1Z
NID_sect409k1Z
NID_sect409r1Z
NID_sect571k1Z
NID_sect571r1ZNID_X9_62_prime192v1ZNID_prime192v1ZNID_X9_62_prime192v2ZNID_prime192v2ZNID_X9_62_prime192v3ZNID_prime192v3ZNID_X9_62_prime239v1ZNID_prime239v1ZNID_X9_62_prime239v2ZNID_prime239v2ZNID_X9_62_prime239v3ZNID_prime239v3ZNID_X9_62_prime256v1ZNID_prime256v1ZNID_X9_62_c2pnb163v1ZNID_c2pnb163v1ZNID_X9_62_c2pnb163v2ZNID_c2pnb163v2ZNID_X9_62_c2pnb163v3ZNID_c2pnb163v3ZNID_X9_62_c2pnb176v1ZNID_c2pnb176v1ZNID_X9_62_c2tnb191v1ZNID_c2tnb191v1ZNID_X9_62_c2tnb191v2ZNID_c2tnb191v2ZNID_X9_62_c2tnb191v3ZNID_c2tnb191v3ZNID_X9_62_c2pnb208w1ZNID_c2pnb208w1ZNID_X9_62_c2tnb239v1ZNID_c2tnb239v1ZNID_X9_62_c2tnb239v2ZNID_c2tnb239v2ZNID_X9_62_c2tnb239v3ZNID_c2tnb239v3ZNID_X9_62_c2pnb272w1ZNID_c2pnb272w1ZNID_X9_62_c2pnb304w1ZNID_c2pnb304w1ZNID_X9_62_c2tnb359v1ZNID_c2tnb359v1ZNID_X9_62_c2pnb368w1ZNID_c2pnb368w1ZNID_X9_62_c2tnb431r1ZNID_c2tnb431r1ZNID_wap_wsg_idm_ecid_wtls1ZNID_wap_wsg_idm_ecid_wtls3ZNID_wap_wsg_idm_ecid_wtls4ZNID_wap_wsg_idm_ecid_wtls5ZNID_wap_wsg_idm_ecid_wtls6ZNID_wap_wsg_idm_ecid_wtls7ZNID_wap_wsg_idm_ecid_wtls8ZNID_wap_wsg_idm_ecid_wtls9ZNID_wap_wsg_idm_ecid_wtls10ZNID_wap_wsg_idm_ecid_wtls11ZNID_wap_wsg_idm_ecid_wtls12�objectrrrAr;rCrErBrGrHrFrIrJrLrMrrrr�<module>s� 

%"