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: //proc/thread-self/root/lib64/python3.6/site-packages/M2Crypto/__pycache__/EC.cpython-36.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"tj|�std��||_||_dS)Nz'ec' type error)r�ec_key_type_check�AssertionError�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�std��tj|j�S)Nz'ec' type error)rrrrZ
ec_key_keylen)rrrr�__len__�sz
EC.__len__cCs$tj|j�std��tj|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.
        z'ec' type errorN)rrrrZec_key_gen_key)rrrr�gen_key�s
z
EC.gen_keycCst|jd�S)Nr)�EC_pubr)rrrr�pub�szEC.pubcCs|j�std��tj|j|�S)zw
        Sign the given digest using ECDSA. Returns a tuple (r,s), the two
        ECDSA signature parameters.
        z'ec' type error)�_check_key_typerrZ
ecdsa_signr)r�digestrrr�sign_dsa�szEC.sign_dsacCs"|j�std��tj|j|||�S)zj
        Verify the given digest using ECDSA. r and s are the ECDSA
        signature parameters.
        z'ec' type error)r"rrZecdsa_verifyr)rr#�r�srrr�
verify_dsa�sz
EC.verify_dsacCs|j�std��tj|j|�S)Nz'ec' type error)r"rrZecdsa_sign_asn1r)rr#rrr�
sign_dsa_asn1�szEC.sign_dsa_asn1cCs |j�std��tj|j||�S)Nz'ec' type error)r"rrZecdsa_verify_asn1r)rr#Zblobrrr�verify_dsa_asn1�szEC.verify_dsa_asn1cCs |j�std��tj|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.
        zkey is not initialised)�	check_keyrrZecdh_compute_keyr)rZpub_keyrrr�compute_dh_key�szEC.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�openfiler1)r�filer/r0r.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.
        r2N)rr3rr6rr,)rr4r.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�MemoryBufferr1�read)rr/r0r.rrr�as_pems
z	EC.as_pemcCstj|j�S)N)rrr)rrrrr"szEC._check_key_typecCs tj|j�std��tj|j�S)Nz'ec' type error)rrrrZec_key_check_key)rrrrr*!szEC.check_keyN)r)rrr�__doc__rZec_key_freerrrrrr!r$r'r(r)r+r�passphrase_callbackr1r5r7r8r;r"r*rrrrr�s*

			

rc@s6eZdZdZd
dd�Zdd�Zdd�ZejZ	ej
Zd	S)r zb
    Object interface to an EC public key.
    ((don't like this implementation inheritance))
    rcCstj|||�d|_dS)N)rr�der)rrrrrrr-szEC_pub.__init__cCs.|j�std��|jdkr(tj|j�|_|jS)zJ
        Returns the public key in DER format as a buffer object.
        zkey is not initialisedN)r*rr>rZec_key_get_public_derr)rrrr�get_der2s
zEC_pub.get_dercCs|j�std��tj|j�S)z:
        Returns the public key as a byte string.
        zkey is not initialised)r*rrZec_key_get_public_keyr)rrrr�get_key<szEC_pub.get_keyN)r)rrrr<rr?r@rr8r5r7r1rrrrr 's

r cCs8|dd�tj�D�ks(tdtj|���ttj|�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.
    cSsg|]}|d�qS)ZNIDr)�.0�xrrr�
<listcomp>Qszgen_params.<locals>.<listcomp>z2Elliptic curve %s is not available on this system.�)r�ec_get_builtin_curvesrZ
obj_nid2snrZec_key_new_by_curve_name)�curverrr�
gen_paramsIsrGc
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)rr3�load_key_bio)r4r0r.rrr�load_keyWsrIc
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)rr9rH)�stringr0r.rrr�load_key_stringfs
rKcCsttj|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.
    rD)rrZec_key_read_bior,)r.r0rrrrHwsrHc	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)rr3�load_pub_key_bio)r4r.rrr�load_pub_key�s
rMc
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)rr9rZload_key_bio_pubkey)rJr0r.rrr�load_key_string_pubkey�s
rNcCs&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.
    NrD)rZec_key_read_pubkeyr,�ec_errorr )r.rrrrrL�s
rLcCsttj���dS)N)rrZget_error_messagerrrrrO�srOcCsttj|�d�S)z!
    Create EC_pub from DER.
    rD)r rZec_key_from_pubkey_der)r>rrr�pub_key_from_der�srPcCsttj||�d�S)z9
    Create EC_pub from curve name and octet string.
    rD)r rZec_key_from_pubkey_params)rF�bytesrrr�pub_key_from_params�srRcCstj�S)N)rrErrrr�get_builtin_curves�srSN)|Z
__future__rZM2CryptorrrrrZpy27plusZtypingrr	r
rrr
rQZEC_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�objectrr rGr=rIrKrHrMrNrLrOrPrRrSrrrr�<module>s� 

%"