Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib64/python2.7/site-packages/M2Crypto/ |
| [Home] [System Details] [Kill Me] |
�
�1Mc@s�dZddlmZmZmZmZddlZdefd��YZej e�d�Z
ddd��YZd dd
��YZdd�Z
d
dd��YZddd��YZejd�Zejd�Zejd�ZdS(s�M2Crypto
wrapper for OpenSSL EVP API.
Copyright (c) 1999-2004 Ng Pheng Siong. All rights reserved.
Portions Copyright (c) 2004-2007 Open Source Applications Foundation.
Author: Heikki Toivonen
i����(tErrtutiltBIOtRSANtEVPErrorcBseZRS((t__name__t
__module__(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRscCstj||||�S(s�
Derive a key from password using PBKDF2 algorithm specified in RFC
2898.
@param password: Derive the key from this password.
@type password: str
@param salt: Salt.
@type salt: str
@param iter: Number of iterations to perform.
@type iter: int
@param keylen: Length of key to produce.
@type keylen: int
@return: Key.
@rtype: str
(tm2tpkcs5_pbkdf2_hmac_sha1(tpasswordtsalttitertkeylen((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytpbkdf2st
MessageDigestcBsAeZdZejZd�Zd�Zd�Zd�Z e Z
RS(s
Message Digest
cCsett|d�}|dkr0td|f�n|�|_tj�|_tj|j|j�dS(Nsunknown
algorithm(tgetattrRtNonet
ValueErrortmdt
md_ctx_newtctxtdigest_init(tselftalgoR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt__init__(scCs)t|dd�r%|j|j�ndS(NR(RRtm2_md_ctx_freeR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt__del__0scCstj|j|�S(s
Add data to be digested.
@return: -1 for Python error, 1 for success, 0 for OpenSSL failure.
(Rt
digest_updateR(Rtdata((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytupdate4scCstj|j�S(N(Rtdigest_finalR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytfinal<s(RRt__doc__Rtmd_ctx_freeRRRRRtdigest(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR"s tHMACcBsGeZejZdd�Zd�Zd�Zd�Zd�Z e Z
RS(tsha1cCshtt|d�}|dkr0td|f�n|�|_tj�|_tj|j||j�dS(Nsunknown
algorithm(RRRRRthmac_ctx_newRt hmac_init(RtkeyRR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRGscCs)t|dd�r%|j|j�ndS(NR(RRtm2_hmac_ctx_freeR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyROscCstj|j||j�dS(N(RR&RR(RR'((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytresetSscCstj|j|�dS(N(Rthmac_updateR(RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRVscCstj|j�S(N(Rt
hmac_finalR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRYs(RRRt
hmac_ctx_freeR(RRR)RRR"(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR#Cs R$cCsFtt|d�}|dkr0td|f�ntj|||��S(Nsunknown
algorithm(RRRRthmac(R'RRR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR-^stCiphercBsPeZejZdddddd�Zd�Zd�Zd�Zdd�Z RS( itmd5t12345678ic
Cs�tt|d�}
|
dkr0td|f�n|
�|_|r�tt|d�}|dkrrtd|f�ntj|j|�||||�}ntj�|_tj|j|j|||�|j | �~dS(Nsunknown
ciphersunknown message digest(
RRRRtciphertbytes_to_keytcipher_ctx_newRtcipher_inittset_padding(RtalgR'tivtoptkey_as_bytestdR
titpaddingR1tkmd((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRis'
cCs)t|dd�r%|j|j�ndS(NR(RRtm2_cipher_ctx_freeR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRxscCstj|j|�S(N(Rt
cipher_updateR(RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR|scCstj|j�S(N(Rtcipher_finalR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRscCstj|j|�S(N(Rtcipher_set_paddingR(RR<((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR5�s(
RRRtcipher_ctx_freeR>RRRRR5(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR.es tPKeycBseZdZejZejZdddd�Z d�Z
d�Zd�Zdd�Z
d�Zd �Zd
�ZeZeZd�Zd�Zd
�Zdd�Zd�Zdejd�Zdejd�Zdejd�Zd�Zd�Zd�ZRS(s
Public Key
iR$cCsJ|dk r!||_||_ntj�|_d|_|j|�dS(Ni(Rtpkeyt_pyfreeRtpkey_newt_set_context(RRDRER((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR�s cCsNt|dd�r%|j|j�nt|dd�rJ|j|j�ndS(NREiR(Rtm2_pkey_freeRDRRR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR�scCs|jS(N(RD(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt_ptr�scCsOtt|d�}|dkr0td|f�n|�|_tj�|_dS(Nsunknown
message
digest(RRRRRRR(RRtmda((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRG�s
cCs|j|�dS(s�
Reset internal message digest context.
@type md: string
@param md: The message digest algorithm.
N(RG(RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt
reset_context�scCstj|j|j�dS(s9
Initialise signing operation with self.
N(Rt sign_initRR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRL�scCstj|j|�dS(su
Feed data to signing operation.
@type data: string
@param data: Data to be signed.
N(Rtsign_updateR(RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRM�scCstj|j|j�S(s[
Return signature.
@rtype: string
@return: The signature.
(Rt
sign_finalRRD(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRN�scCstj|j|j�dS(sH
Initialise signature verification operation with self.
N(Rtverify_initRR(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRO�scCstj|j|�S(s�
Feed data to verification operation.
@type data: string
@param data: Data to be verified.
@return: -1 on Python error, 1 for success, 0 for OpenSSL error
(Rt
verify_updateR(RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRP�scCstj|j||j�S(s�
Return result of verification.
@param sign: Signature to use for verification
@rtype: int
@return: Result of verification: 1 for success, 0 for failure, -1
on
other error.
(Rtverify_finalRRD(Rtsign((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRQ�s icCsO|r3tj|j|j�}|rKd|_qKntj|j|j�}|S(s�
Assign the RSA key pair to self.
@type rsa: M2Crypto.RSA.RSA
@param rsa: M2Crypto.RSA.RSA object to be assigned to self.
@type capture: boolean
@param capture: If true (default), this PKey object will own the
RSA
object, meaning that once the PKey object gets
deleted it is no longer safe to use the RSA object.
@rtype: int
@return: Return 1 for success and 0 for failure.
i(Rtpkey_assign_rsaRDtrsaREt
pkey_set1_rsa(RRTtcapturetret((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt
assign_rsa�scCsCtj|j�}|dkr-td��ntj|d�}|S(sd
Return the underlying RSA key if that is what the EVP
instance is holding.
s&PKey instance is not holding a RSA
keyiN(Rt
pkey_get1_rsaRDRRRtRSA_pub(Rtrsa_ptrRT((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytget_rsa�s
taes_128_cbccCs%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(Rtopenfiletsave_key_bio(RtfileR1tcallbacktbio((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytsave_key
scCs||dkr(tj|j|j�|�Stt|d�}|dkrVtd|�ntj|j|j�|�|�SdS(sN
Save the key pair to the M2Crypto.BIO object 'bio' in PEM
format.
@type bio: M2Crypto.BIO
@param bio: M2Crypto.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.
sno such cipher
%sN(RRtpkey_write_pem_no_cipherRDRIRRtpkey_write_pem(RRcR1Rbtproto((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyR`scCs)tj�}|j|||�|j�S(s�
Return key in PEM format in a string.
@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.
(RtMemoryBufferR`tread_all(RR1RbRc((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytas_pem7scCs+tj|j�}tj|�}|j�S(s6
Return key in DER format in a string
(Rtpkey_as_derRDRRhRi(RtbufRc((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytas_derIscCstj|j�S(s6
Return the size of the key in bytes.
(Rt pkey_sizeRD(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytsizeQscCstj|j�S(s3
Return the modulus in hex format.
(Rtpkey_get_modulusRD(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytget_modulusWsN(
RRR
Rt pkey_freeRHR!RRRRRIRGRKRLRMRNRRRORPRQRXR\Rtpassphrase_callbackRdR`RjRmRoRq(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyRC�s0
cCs�tj|d�}|dkr6tjtj���ntj||�}tj|�|dkrvt tj���nt
|d�S(sj
Load an M2Crypto.EVP.PKey from file.
@type file: string
@param file: Name of file containing the key in PEM format.
@type callback: Python callable
@param callback: A Python callable object that is invoked
to acquire a passphrase with which to protect the key.
@rtype: M2Crypto.EVP.PKey
@return: M2Crypto.EVP.PKey object.
triN(Rtbio_new_fileRRtBIOErrorRt get_errort
pkey_read_pemtbio_freeRRC(RaRbRctcptr((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytload_key^s
cCsFtj|j�|�}|dkr9ttj���nt|d�S(s�
Load an M2Crypto.EVP.PKey from an M2Crypto.BIO object.
@type bio: M2Crypto.BIO
@param bio: M2Crypto.BIO object containing the key in PEM format.
@type callback: Python callable
@param callback: A Python callable object that is invoked
to acquire a passphrase with which to protect the key.
@rtype: M2Crypto.EVP.PKey
@return: M2Crypto.EVP.PKey object.
iN(RRxRIRRRRwRC(RcRbRz((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytload_key_biouscCstj|�}t||�S(sl
Load an M2Crypto.EVP.PKey from a string.
@type string: string
@param string: String containing the key in PEM format.
@type callback: Python callable
@param callback: A Python callable object that is invoked
to acquire a passphrase with which to protect the key.
@rtype: M2Crypto.EVP.PKey
@return: M2Crypto.EVP.PKey object.
(RRhR|(tstringRbRc((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pytload_key_string�s(((((R
tM2CryptoRRRRRt ExceptionRtevp_initR
RR#R-R.RCRsR{R|R~(((s2/usr/lib64/python2.7/site-packages/M2Crypto/EVP.pyt<module>s"
!!�