/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher
NameSizeModeActions
AES.py42180644editdlrm
AES.pyc35670644editdlrm
AES.pyo35670644editdlrm
ARC2.py49170644editdlrm
ARC2.pyc42650644editdlrm
ARC2.pyo42650644editdlrm
ARC4.py42660644editdlrm
ARC4.pyc40590644editdlrm
ARC4.pyo40590644editdlrm
blockalgo.py125960644editdlrm
blockalgo.pyc63070644editdlrm
blockalgo.pyo63070644editdlrm
Blowfish.py44600644editdlrm
Blowfish.pyc38100644editdlrm
Blowfish.pyo38100644editdlrm
CAST.py44980644editdlrm
CAST.pyc38470644editdlrm
CAST.pyo38470644editdlrm
DES.py44030644editdlrm
DES.pyc37380644editdlrm
DES.pyo37380644editdlrm
DES3.py51300644editdlrm
DES3.pyc44810644editdlrm
DES3.pyo44810644editdlrm
PKCS1_OAEP.py93730644editdlrm
PKCS1_OAEP.pyc86490644editdlrm
PKCS1_OAEP.pyo86490644editdlrm
PKCS1_v1_5.py91030644editdlrm
PKCS1_v1_5.pyc92800644editdlrm
PKCS1_v1_5.pyo92800644editdlrm
XOR.py27370644editdlrm
XOR.pyc25310644editdlrm
XOR.pyo25310644editdlrm
_AES.so631280755editdlrm
_ARC2.so449770755editdlrm
_ARC4.so280800755editdlrm
_Blowfish.so559630755editdlrm
_CAST.so571030755editdlrm
_DES.so889340755editdlrm
_DES3.so890560755editdlrm
_XOR.so284280755editdlrm
__init__.py34400644editdlrm
__init__.pyc26470644editdlrm
__init__.pyo26470644editdlrm
Edit: /opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyc (8649B)
Ñò Bd\Rc @s¥dZddklZdZddgZddkZddkZddkTddk Zddk l Z dd k l Z dd d „ƒYZ dded ƒd „ZdS(s{RSA encryption protocol according to PKCS#1 OAEP See RFC3447__ or the `original RSA Labs specification`__ . This scheme is more properly called ``RSAES-OAEP``. As an example, a sender may encrypt a message in this way: >>> from Crypto.Cipher import PKCS1_OAEP >>> from Crypto.PublicKey import RSA >>> >>> message = 'To be encrypted' >>> key = RSA.importKey(open('pubkey.der').read()) >>> cipher = PKCS1_OAEP.new(key) >>> ciphertext = cipher.encrypt(message) At the receiver side, decryption can be done using the private part of the RSA key: >>> key = RSA.importKey(open('privkey.der').read()) >>> cipher = PKCS1_OAP.new(key) >>> message = cipher.decrypt(ciphertext) :undocumented: __revision__, __package__ .. __: http://www.ietf.org/rfc/rfc3447.txt .. __: http://www.rsa.com/rsalabs/node.asp?id=2125. iÿÿÿÿ(t nested_scopess$Id$tnewtPKCS1OAEP_CipherN(t*(tceil_div(tstrxorcBs;eZdZd„Zd„Zd„Zd„Zd„ZRS(sBThis cipher can perform PKCS#1 v1.5 OAEP encryption or decryption.cs_|ˆ_|o |ˆ_ntiiˆ_|o |ˆ_n‡fd†ˆ_|ˆ_dS(sŽInitialize this PKCS#1 OAEP cipher object. :Parameters: key : an RSA key object If a private half is given, both encryption and decryption are possible. If a public half is given, only encryption is possible. hashAlgo : hash object The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA` (that is, SHA-1) is used. mgfunc : callable A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 is used (a safe choice). label : string A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. :attention: Modify the mask generation function only if you know what you are doing. Sender and receiver must use the same one. cstiii||ˆiƒS((tCryptot Signaturet PKCS1_PSStMGF1t_hashObj(txty(tself(sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pytesN(t_keyR RtHashtSHAt_mgft_label(R tkeythashAlgotmgfunctlabel((R sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyt__init__Ds   cCs |iiƒS(s?Return True/1 if this cipher object can be used for encryption.(Rt can_encrypt(R ((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyRiscCs |iiƒS(s?Return True/1 if this cipher object can be used for decryption.(Rt can_decrypt(R ((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyRmscCsi|ii}tiii|iiƒ}t|dƒ}|ii }t |ƒ}||d|d}|djot dƒ‚n|ii |i ƒiƒ}tdƒ|} || tdƒ|} ||ƒ} |i| ||dƒ} t| | ƒ} |i| |ƒ}t| |ƒ}tdƒ|| }|ii|dƒd}tdƒ|t |ƒ|}|S(sÄProduce the PKCS#1 OAEP encryption of a message. This function is named ``RSAES-OAEP-ENCRYPT``, and is specified in section 7.1.1 of RFC3447. :Parameters: message : string The message to encrypt, also known as plaintext. It can be of variable length, but not longer than the RSA modulus (in bytes) minus 2, minus twice the hash output size. :Return: A string, the ciphertext in which the message is encrypted. It is as long as the RSA modulus (in bytes). :Raise ValueError: If the RSA key length is not sufficiently long to deal with the given message. iiisPlaintext is too long.i(Rt _randfuncRtUtiltnumbertsizetnRR t digest_sizetlent ValueErrorRRtdigesttbchrRRtencrypt(R tmessagetrandFunctmodBitstkthLentmLentps_lentlHashtpstdbtrostdbMasktmaskedDBtseedMaskt maskedSeedtemtmtc((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyR%qs(     cCsÃtiii|iiƒ}t|dƒ}|ii}t |ƒ|jp||djot dƒ‚n|ii |ƒ}t dƒ|t |ƒ|}|ii |iƒiƒ}|d}|d|d!} ||d} |i| |ƒ} t| | ƒ} |i| ||dƒ} t| | ƒ}d}||it dƒƒ}|| }||jo d}n|djo d}nt|ƒdjo d}n|pt dƒ‚n|||dS(sDecrypt a PKCS#1 OAEP ciphertext. This function is named ``RSAES-OAEP-DECRYPT``, and is specified in section 7.1.2 of RFC3447. :Parameters: ct : string The ciphertext that contains the message to recover. :Return: A string, the original message. :Raise ValueError: If the ciphertext length is incorrect, or if the decryption does not succeed. :Raise TypeError: If the RSA key has no private half. iis!Ciphertext with incorrect length.iisIncorrect decryption.(RRRRRRRR R R!R"tdecryptR$RRR#RRtfindtbord(R tctR(R)R*R6R5R-R R4R2R3tseedR1R/tvalidtonetlHash1((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyR8©s6 $       (t__name__t __module__t__doc__RRRR%R8(((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyRAs  %   8tcCst||||ƒS(sMReturn a cipher object `PKCS1OAEP_Cipher` that can be used to perform PKCS#1 OAEP encryption or decryption. :Parameters: key : RSA key object The key to use to encrypt or decrypt the message. This is a `Crypto.PublicKey.RSA` object. Decryption is only possible if *key* is a private RSA key. hashAlgo : hash object The hash function to use. This can be a module under `Crypto.Hash` or an existing hash object created from any of such modules. If not specified, `Crypto.Hash.SHA` (that is, SHA-1) is used. mgfunc : callable A mask generation function that accepts two parameters: a string to use as seed, and the lenth of the mask to generate, in bytes. If not specified, the standard MGF1 is used (a safe choice). label : string A label to apply to this particular encryption. If not specified, an empty string is used. Specifying a label does not improve security. :attention: Modify the mask generation function only if you know what you are doing. Sender and receiver must use the same one. (R(RRRR((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyRçs((RBt __future__Rt __revision__t__all__tCrypto.Signature.PKCS1_PSSRtCrypto.Hash.SHAtCrypto.Util.py3compattCrypto.Util.numberRtCrypto.Util.strxorRRtNonetbR(((sK/opt/alt/python27/lib64/python2.7/site-packages/Crypto/Cipher/PKCS1_OAEP.pyt2s     ¦