Your IP : 18.191.72.87


Current Path : /lib64/python2.7/site-packages/M2Crypto/
Upload File :
Current File : //lib64/python2.7/site-packages/M2Crypto/EC.pyo

�

�1Mc@sdZddlZddlZddlZdefd��YZeje�ejZejZej	Z	ej
Z
ejZejZej
Z
ejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZejZej 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/ej0Z0ej1Z1ej2Z2ej3Z3ej4Z4ej5Z5ej6Z6ej7Z7ej8Z8ej9Z9ej:Z:ej;Z;ej<Z<ej=Z=ej>Z>ej?Z?ej@Z@ejAZAejBZBejCZCejDZDejEZEejFZFejGZGddd��YZHdeHfd��YZId	�ZJejKd
�ZLejKd�ZMd�ZNd
�ZOd�ZPd�ZQdS(s�
M2Crypto wrapper for OpenSSL ECDH/ECDSA API.

@requires: OpenSSL 0.9.8 or newer

Copyright (c) 1999-2003 Ng Pheng Siong. All rights reserved.

Portions copyright (c) 2005-2006 Vrije Universiteit Amsterdam. 
All rights reserved.i����NtECErrorcBseZRS((t__name__t
__module__(((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyR
stECcBs�eZdZejZdd�Zd�Zd�Zd�Z	d�Z
d�Zd�Zd	�Z
d
�Zd�Zdejd
�Zdejd�Zd�Zd�Zd�Zd�ZRS(s,
    Object interface to a EC key pair.
    icCs||_||_dS(N(tect_pyfree(tselfRR((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt__init__is	cCs)t|dd�r%|j|j�ndS(NRi(tgetattrtm2_ec_key_freeR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt__del__nscCstj|j�S(N(tm2t
ec_key_keylenR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt__len__rscCstj|j�dS(s�
        Generates the key pair from its parameters. Use::
            keypair = EC.gen_params(curve)
            keypair.gen_key()
        to create an EC key pair.
        N(Rtec_key_gen_keyR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytgen_keyvscCst|jd�S(Ni(tEC_pubR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytpub�scCstj|j|�S(sw
        Sign the given digest using ECDSA. Returns a tuple (r,s), the two
        ECDSA signature parameters.
        (Rt
ecdsa_signR(Rtdigest((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytsign_dsa�scCstj|j|||�S(sj
        Verify the given digest using ECDSA. r and s are the ECDSA
        signature parameters.
        (Rtecdsa_verifyR(RRtrts((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt
verify_dsa�scCstj|j|�S(N(Rtecdsa_sign_asn1R(RR((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt
sign_dsa_asn1�scCstj|j||�S(N(Rtecdsa_verify_asn1R(RRtblob((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytverify_dsa_asn1�scCstj|j|j�S(s�
        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.
        (Rtecdh_compute_keyR(Rtpub_key((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytcompute_dh_key�staes_128_cbccCs|dkr(tj|j|j�|�Stt|d�}|dkrYtd|��ntj|j|j�|�|�SdS(sR
        Save the key pair to an M2Crypto.BIO.BIO object in PEM format.

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

        @type cipher: string
        @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.

        @type callback: Python callable
        @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.
        snot such cipher %sN(tNoneRtec_key_write_bio_no_cipherRt_ptrRt
ValueErrortec_key_write_bio(Rtbiotciphertcallbacktciph((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytsave_key_bio�scCs%tj|d�}|j|||�S(s+
        Save the key pair to a file in PEM format.

        @type file: string
        @param file: Name of file to save key to.

        @type cipher: string
        @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.

        @type callback: Python callable
        @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.
        twb(tBIOtopenfileR+(RtfileR(R)R'((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytsave_key�scCstj|j|j��S(s�
        Save the public key to an M2Crypto.BIO.BIO object in PEM format.

        @type bio: M2Crypto.BIO.BIO
        @param bio: M2Crypto.BIO.BIO object to save key to.
        (Rtec_key_write_pubkeyRR$(RR'((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytsave_pub_key_bio�scCs+tj|d�}tj|j|j��S(s�
        Save the public key to a file in PEM format.

        @type file: string
        @param file: Name of file to save key to.
        R,(R-R.RR1RR$(RR/R'((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytsave_pub_key�scCstj|j�S(N(Rtec_key_type_checkR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt_check_key_type�scCstj|j�S(N(Rtec_key_check_keyR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt	check_key�s(RRt__doc__Rtec_key_freeR	RR
R
RRRRRRR tutiltpassphrase_callbackR+R0R2R3R5R7(((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyRas$				
						
			
	RcBs5eZdZdd�Zd�ZejZejZ	RS(sc
    Object interface to an EC public key. 
    ((don't like this implementation inheritance))
    icCs tj|||�d|_dS(N(RRR"tder(RRR((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyR�scCs.|jdkr'tj|j�|_n|jS(sJ
        Returns the public key in DER format as a buffer object.
        N(R<R"Rtec_key_get_public_derR(R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytget_der�s(
RRR8RR>RR3R0R2R+(((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyR�s
			cCsttj|�d�S(s�
    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. 
    i(RRtec_key_new_by_curve_name(tcurve((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt
gen_paramsscCstj|�}t||�S(s
    Factory function that instantiates a EC object.

    @param file: Names the file 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-R.tload_key_bio(R/R)R'((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytload_keys
cCsttj|j�|�d�S(s
    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.
    i(RRtec_key_read_bioR$(R'R)((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyRBs
cCstj|�}t|�S(s�
    Load an EC public key from file.

    @type file: string
    @param file: Name of file containing EC public key in PEM format.

    @rtype: M2Crypto.EC.EC_pub
    @return: M2Crypto.EC.EC_pub object.
    (R-R.tload_pub_key_bio(R/R'((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytload_pub_key*s
cCs8tj|j��}|dkr+t�nt|d�S(s�
    Load an EC public key from an M2Crypto.BIO.BIO object.

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

    @rtype: M2Crypto.EC.EC_pub
    @return: M2Crypto.EC.EC_pub object.
    iN(Rtec_key_read_pubkeyR$R"tec_errorR(R'R((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyRE8s
cCsttjtj���dS(N(RRterr_reason_error_stringt
err_get_error(((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyRHHscCsttj|�d�S(s!
    Create EC_pub from DER.
    i(RRtec_key_from_pubkey_der(R<((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pytpub_key_from_derKs((RR8R:R-Rt	ExceptionRtec_initt
NID_secp112r1t
NID_secp112r2t
NID_secp128r1t
NID_secp128r2t
NID_secp160k1t
NID_secp160r1t
NID_secp160r2t
NID_secp192k1t
NID_secp224k1t
NID_secp224r1t
NID_secp256k1t
NID_secp384r1t
NID_secp521r1t
NID_sect113r1t
NID_sect113r2t
NID_sect131r1t
NID_sect131r2t
NID_sect163k1t
NID_sect163r1t
NID_sect163r2t
NID_sect193r1t
NID_sect193r2t
NID_sect233k1t
NID_sect233r1t
NID_sect239k1t
NID_sect283k1t
NID_sect283r1t
NID_sect409k1t
NID_sect409r1t
NID_sect571k1t
NID_sect571r1tNID_X9_62_prime192v1tNID_X9_62_prime192v2tNID_X9_62_prime192v3tNID_X9_62_prime239v1tNID_X9_62_prime239v2tNID_X9_62_prime239v3tNID_X9_62_prime256v1tNID_X9_62_c2pnb163v1tNID_X9_62_c2pnb163v2tNID_X9_62_c2pnb163v3tNID_X9_62_c2pnb176v1tNID_X9_62_c2tnb191v1tNID_X9_62_c2tnb191v2tNID_X9_62_c2tnb191v3tNID_X9_62_c2pnb208w1tNID_X9_62_c2tnb239v1tNID_X9_62_c2tnb239v2tNID_X9_62_c2tnb239v3tNID_X9_62_c2pnb272w1tNID_X9_62_c2pnb304w1tNID_X9_62_c2tnb359v1tNID_X9_62_c2pnb368w1tNID_X9_62_c2tnb431r1tNID_wap_wsg_idm_ecid_wtls1tNID_wap_wsg_idm_ecid_wtls3tNID_wap_wsg_idm_ecid_wtls4tNID_wap_wsg_idm_ecid_wtls5tNID_wap_wsg_idm_ecid_wtls6tNID_wap_wsg_idm_ecid_wtls7tNID_wap_wsg_idm_ecid_wtls8tNID_wap_wsg_idm_ecid_wtls9tNID_wap_wsg_idm_ecid_wtls10tNID_wap_wsg_idm_ecid_wtls11tNID_wap_wsg_idm_ecid_wtls12RRRAR;RCRBRFRERHRL(((s1/usr/lib64/python2.7/site-packages/M2Crypto/EC.pyt<module>	s�$
																																																																	
�