ó Àb‹Xc@`söddlmZmZmZddlmZddlmZmZm Z ddl m Z m Z ddl mZddlmZmZmZmZeje jƒdefd„ƒYƒZeje jƒeje jƒd efd „ƒYƒƒZd S( i(tabsolute_importtdivisiontprint_function(tutils(t InvalidTagtUnsupportedAlgorithmt_Reasons(tcipherst constant_time(tmodes(tCFBtCFB8tCTRtOFBt_CipherContextcB`s#eZd„Zd„Zd„ZRS(c C`s||_||_||_||_d|_t|tjƒrnt|tt t t fƒ rn|j d|_ n d|_ |jj}y&|t|ƒt|ƒf\}}WnAtk rìtdj|j|r×|jn|ƒtjƒ‚nX|jjjdƒ}|jjj||jjƒ}t|tjƒr>|j} n-t|tjƒr\|j} n|jjj} t|t ƒrŒ|jj j!} nd} |jj j"||||jj j#| |j$t%|j$ƒ|jjjdd| |ƒ } |jj&| ƒ||_'dS(Niiis8cipher {0} in {1} mode is not supported by this backend.sCCCryptorRef *((t_backendt_ciphert_modet _operationt_bytes_processedt isinstanceRtBlockCipherAlgorithmR R R R t block_sizet_byte_block_sizet_cipher_registryttypetKeyErrorRtformattnameRtUNSUPPORTED_CIPHERt_ffitnewtgct_release_cipher_ctxR tModeWithInitializationVectortinitialization_vectort ModeWithNoncetnoncetNULLt_libtkCCModeOptionCTR_BEtCCCryptorCreateWithModet ccNoPaddingtkeytlent_check_cipher_responset_ctx( tselftbackendtciphertmodet operationtregistryt cipher_enumt mode_enumtctxtiv_noncet mode_optiontres((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyt__init__sF      &    cC`sÀ|jt|ƒ7_|jjjdt|ƒ|jdƒ}|jjjdƒ}|jjj|jd|t|ƒ|t|ƒ|jd|ƒ}|jj |ƒ|jjj |ƒ|d S(Nsunsigned char[]issize_t *i( RR,RRRRR'tCCCryptorUpdateR.R-tbuffer(R/tdatatbuftoutlenR:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pytupdateMs  cC`s¸|j|jrtdƒ‚n|jjjd|jƒ}|jjjdƒ}|jjj|jd|t |ƒ|ƒ}|jj |ƒ|jj |jƒ|jjj |ƒ|d S(NsFThe length of the provided data is not a multiple of the block length.sunsigned char[]ssize_t *i( RRt ValueErrorRRRR'tCCCryptorFinalR.R,R-R!R=(R/R?R@R:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pytfinalizeYs  (t__name__t __module__R;RARD(((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyRs 9 t_GCMCipherContextcB`s;eZd„Zd„Zd„Zd„ZejdƒZRS(c C`sž||_||_||_||_d|_|jj}y&|t|ƒt|ƒf\}}WnAtk r¢t dj |j |r|j n|ƒt j ƒ‚nX|jjjdƒ}|jjj||jjƒ}||_|jjj||||jjj|jjj|jt|jƒ|jjjddd|jƒ } |jj| ƒ|jjj|jd|jt|jƒƒ} |jj| ƒ|jdƒdS(Ns8cipher {0} in {1} mode is not supported by this backend.sCCCryptorRef *it(RRRRtNonet_tagRRRRRRRRRRR R!R.R'R)R*R&R+R,R-tCCCryptorGCMAddIVR#tauthenticate_additional_data( R/R0R1R2R3R4R5R6R7R:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyR;ls<      &     !  cC`s¦|jjjdt|ƒƒ}|jd|t|ƒ|f}|j|jjjkrm|jjj|Œ}n|jjj |Œ}|jj |ƒ|jjj |ƒS(Nsunsigned char[]i( RRRR,R.RR't kCCEncrypttCCCryptorGCMEncrypttCCCryptorGCMDecryptR-R=(R/R>R?targsR:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyRA™scC`sü|jdƒ|jjd}|jjjd|ƒ}|jjjd|ƒ}|jjj|jd||ƒ}|jj |ƒ|jj |jƒ|jjj |ƒ|_ |j |jjjkrøtj|j t|jjƒ |jjƒ røt‚ndS(NRHisunsigned char[]ssize_t *i(RARRRRRR'tCCCryptorGCMFinalR.R-R!R=RJRt kCCDecryptRtbytes_eqR,RttagR(R/ttag_sizettag_bufttag_lenR:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyRD¤s  & cC`s<|jjj|jd|t|ƒƒ}|jj|ƒdS(Ni(RR'tCCCryptorGCMAddAADR.R,R-(R/R>R:((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyRL»s RJ( RERFR;RARDRLRtread_only_propertyRT(((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyRGis  -  N(t __future__RRRt cryptographyRtcryptography.exceptionsRRRtcryptography.hazmat.primitivesRRt&cryptography.hazmat.primitives.ciphersR t,cryptography.hazmat.primitives.ciphers.modesR R R R tregister_interfacet CipherContexttobjectRtAEADCipherContexttAEADEncryptionContextRG(((sW/usr/lib64/python2.7/site-packages/cryptography/hazmat/backends/commoncrypto/ciphers.pyts"V