Spade
Mini Shell
| Directory:~$ /proc/self/root/usr/lib64/python2.7/site-packages/M2Crypto/ |
| [Home] [System Details] [Kill Me] |
�
�1Mc@s"dZddlZddlZddlZddlZddlZdefd��YZeje�ej Z ej
Z
ejZejZddd��YZ
de
fd��YZd �Zejd
�Zed�Zejd�Zejd
�Zejd�Zd�Zd�Zd�ZdS(scM2Crypto
wrapper for OpenSSL RSA API.
Copyright (c) 1999-2004 Ng Pheng Siong. All rights
reserved.i����NtRSAErrorcBseZRS((t__name__t
__module__(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyRstRSAcBs
eZdZejZdd�Zd�Zd�Zd�Z d�Z
d�Zd�Zd �Z
d
�Zdejd�Zdejd
�ZeZdejd�Zd�Zd�Zd�Zd�Zd�Zddd�Zddd�Zdd�Zdd�ZRS(s
RSA Key Pair.
icCs1tj|�std��||_||_dS(Ns'rsa' type
error(tm2trsa_type_checktAssertionErrortrsat_pyfree(tselfRR((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt__init__s cCs)t|dd�r%|j|j�ndS(NRi(tgetattrtm2_rsa_freeR(R ((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt__del__scCstj|j�d>S(Ni(Rtrsa_sizeR(R ((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt__len__"scCsB|dkrtj|j�S|dkr8tj|j�St�dS(Ntetn(Rt rsa_get_eRt rsa_get_ntAttributeError(R tname((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt__getattr__%s
cCs:|j�std��tj|j�tj|j�fS(Nskey is not
initialised(t check_keyRRRRR(R ((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytpub-scCs.|j�std��tj|j||�S(Nskey
is not
initialised(RRRtrsa_public_encryptR(R tdatatpadding((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytpublic_encrypt1scCs.|j�std��tj|j||�S(Nskey
is not
initialised(RRRtrsa_public_decryptR(R RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytpublic_decrypt5scCs.|j�std��tj|j||�S(Nskey
is not
initialised(RRRtrsa_private_encryptR(R RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytprivate_encrypt9scCs.|j�std��tj|j||�S(Nskey
is not
initialised(RRRtrsa_private_decryptR(R RR((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytprivate_decrypt=staes_128_cbccCs�|dkr(tj|j|j�|�Stt|d�}|dkrVtd|�n |�}tj|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(tNoneRtrsa_write_key_no_cipherRt_ptrRRt
rsa_write_key(R tbiotciphertcallbacktciph((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsave_key_bioAs 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,(R tfileR)R*R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsave_key\scCs)tj�}|j|||�|j�S(sB
Returns the key(pair) as a string in PEM format.
(R.tMemoryBufferR,tread(R R)R*R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytas_pemrscCstj|j|j��S(s�
Save the key pair to an M2Crypto.BIO.BIO object in DER format.
@type bio: M2Crypto.BIO.BIO
@param bio: M2Crypto.BIO.BIO object to save key to.
(Rtrsa_write_key_derRR&(R R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsave_key_der_biozscCstj|d�}|j|�S(s�
Save the key pair to a file in DER format.
@type file: str
@param file: Filename to save key to
R-(R.R/R6(R R0R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsave_key_der�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.
(Rtrsa_write_pub_keyRR&(R R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.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/RR8RR&(R R0R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsave_pub_key�scCstj|j�S(N(Rt
rsa_check_keyR(R ((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR�stsha1icCsbtt|d�}|dkr1tdt��ntj|j||�|�}|j|tj�S(s�
Signs a digest with the private key using RSASSA-PSS
@requires: OpenSSL 0.9.7h or later.
@type digest: str
@param digest: A digest created by using the digest method
@type salt_length: int
@param salt_length: The length of the salt to use
@type algo: str
@param algo: The hash algorithm to use
@return: a string which is the signature
snot such hash algorithm %sN( RRR$t
ValueErrort hash_algotrsa_padding_add_pkcs1_pssRR t
no_padding(R tdigesttalgotsalt_lengththasht signature((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsign_rsassa_pss�s
cCsett|d�}|dkr1tdt��n|j|tj�}tj|j|||�|�S(s
Verifies the signature RSASSA-PSS
@requires: OpenSSL 0.9.7h or later.
@type data: str
@param data: Data that has been signed
@type signature: str
@param signature: The signature signed with RSASSA-PSS
@type salt_length: int
@param salt_length: The length of the salt that was used
@type algo: str
@param algo: The hash algorithm to use
@return: 1 or 0, depending on whether the signature was
verified or not.
snot such hash algorithm
%sN( RRR$R=R>RR@trsa_verify_pkcs1_pssR(R RRERBRCRDtplain_signature((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytverify_rsassa_pss�s
cCsJttd|d�}|dkr4td|f�ntj|j||�S(st
Signs a digest with the private key
@type digest: str
@param digest: A digest created by using the digest method
@type algo: str
@param algo: The method that created the digest.
Legal values are 'sha1','sha224',
'sha256', 'ripemd160',
and 'md5'.
@return: a string which is the signature
tNID_sunknown
algorithmN(RRR$R=trsa_signR(R RARBtdigest_type((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytsign�scCsMttd|d�}|dkr4td|f�ntj|j|||�S(s
Verifies the signature with the public key
@type data: str
@param data: Data that has been signed
@type signature: str
@param signature: The signature signed with the private key
@type algo: str
@param algo: The method use to create digest from the data
before it was signed. Legal values are
'sha1','sha224',
'sha256', 'ripemd160', and 'md5'.
@return: True or False, depending on whether the signature was
verified.
RJsunknown algorithmN(RRR$R=t
rsa_verifyR(R RRERBRL((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytverify�s(RRt__doc__Rtrsa_freeRR
R
RRRRRR
R"tutiltpassphrase_callbackR,R1tsave_pemR4R6R7R9R:RRFRIRMRO(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyRs0
tRSA_pubcBsDeZdZd�Zd�Zd�Zd�Zd�Zd�ZRS(s0
Object interface to an RSA public key.
cCs)|dkrtd�n
||j|<dS(NRRs0use factory function
new_pub_key() to set (e,
n)(RR(Rt__dict__(R Rtvalue((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt__setattr__s cGs
td�dS(Ns!RSA_pub
object has no private
key(R(R targv((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR
scGs
td�dS(Ns!RSA_pub object has no private
key(R(R RY((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR"scOs
|j|�S(s*
Save public key to file.
(R:(R R0targstkw((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR1scOs
|j|�S(s)
Save public key to BIO.
(R9(R R(RZR[((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR,scCstj|j�S(N(Rtrsa_check_pub_keyR(R ((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyR)s( RRRPRXR
R"R1R,R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyRUs
cCsttjtj���dS(N(RRterr_reason_error_stringt
err_get_error(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt rsa_error-scCs1ddddg}|j||�|j�dS(s)
Default callback for gen_key().
t.t+t*s
N(twritetflush(tpRtouttch((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytkeygen_callback1scCsttj|||�d�S(s�
Generate an RSA key pair.
@type bits: int
@param bits: Key length, in bits.
@type e: int
@param e: The RSA public exponent.
@type callback: Python callable
@param callback: A Python callable object that is invoked
during key generation; its usual purpose is to provide visual
feedback. The default callback is keygen_callback.
@rtype: M2Crypto.RSA.RSA
@return: M2Crypto.RSA.RSA object.
i(RRtrsa_generate_key(tbitsRR*((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytgen_key:scCstj|�}t||�S(s�
Load an RSA key pair from file.
@type file: string
@param file: Name of file containing RSA public key in PEM format.
@type callback: Python callable
@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.
@rtype: M2Crypto.RSA.RSA
@return: M2Crypto.RSA.RSA object.
(R.R/tload_key_bio(R0R*R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytload_keyOscCs;tj|j�|�}|dkr.t�nt|d�S(s�
Load an RSA key pair from an M2Crypto.BIO.BIO object.
@type bio: M2Crypto.BIO.BIO
@param bio: M2Crypto.BIO.BIO object containing RSA key pair in PEM
format.
@type callback: Python callable
@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.
@rtype: M2Crypto.RSA.RSA
@return: M2Crypto.RSA.RSA object.
iN(Rtrsa_read_keyR&R$R_R(R(R*R((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyRlbs
cCstj|�}t||�S(s�
Load an RSA key pair from a string.
@type string: string
@param string: String containing RSA key pair in PEM format.
@type callback: Python callable
@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.
@rtype: M2Crypto.RSA.RSA
@return: M2Crypto.RSA.RSA object.
(R.R2Rl(tstringR*R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytload_key_stringxscCstj|�}t|�S(s�
Load an RSA public key from file.
@type file: string
@param file: Name of file containing RSA public key in PEM format.
@rtype: M2Crypto.RSA.RSA_pub
@return: M2Crypto.RSA.RSA_pub object.
(R.R/tload_pub_key_bio(R0R(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytload_pub_key�s
cCs8tj|j��}|dkr+t�nt|d�S(s
Load an RSA public key from an M2Crypto.BIO.BIO object.
@type bio: M2Crypto.BIO.BIO
@param bio: M2Crypto.BIO.BIO object containing RSA public key in PEM
format.
@rtype: M2Crypto.RSA.RSA_pub
@return: M2Crypto.RSA.RSA_pub object.
iN(Rtrsa_read_pub_keyR&R$R_RU(R(R((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyRq�s
cCsE|\}}tj�}tj||�tj||�t|d�S(s�
Instantiate an RSA_pub object from an (e, n) tuple.
@type e: string
@param e: The RSA public exponent; it is a string in OpenSSL's
MPINT
format - 4-byte big-endian bit-count followed by the appropriate
number of bits.
@type n: string
@param n: The RSA composite of primes; it is a string in OpenSSL's
MPINT
format - 4-byte big-endian bit-count followed by the appropriate
number of bits.
@rtype: M2Crypto.RSA.RSA_pub
@return: M2Crypto.RSA.RSA_pub object.
i(Rtrsa_newt rsa_set_et rsa_set_nRU(t.0RRR((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pytnew_pub_key�s
((RPtsysRRR.tErrRt ExceptionRtrsa_initR@t
pkcs1_paddingtsslv23_paddingtpkcs1_oaep_paddingRRUR_tstdoutRhRkRSRmRlRpRrRqRx(((s2/usr/lib64/python2.7/site-packages/M2Crypto/RSA.pyt<module>s&0
�'