3 lá˜_Êã@sÎddlmZmZmZddlZddlZddlmZddlm Z ddl m Z ej ej ƒGdd„deƒƒZejeƒGdd „d eƒƒZejeƒGd d „d eƒƒZejeƒGd d „d eƒƒZGdd„deƒZdd„ZdS)é)Úabsolute_importÚdivisionÚprint_functionN)Úutils)Úhashes)Úrsac@seZdZejdd„ƒZdS)ÚAsymmetricPaddingcCsdS)zE A string naming this padding (e.g. "PSS", "PKCS1"). N©)Úselfr r ú/usr/lib64/python3.6/padding.pyÚnameszAsymmetricPadding.nameN)Ú__name__Ú __module__Ú __qualname__ÚabcÚabstractpropertyr r r r r rsrc@seZdZdZdS)ÚPKCS1v15zEMSA-PKCS1-v1_5N)r rrr r r r r rsrc@seZdZeƒZdZdd„ZdS)ÚPSSzEMSA-PSScCsJ||_t|tjƒ r&||jk r&tdƒ‚||jk r@|dkr@tdƒ‚||_dS)Nzsalt_length must be an integer.rz$salt_length must be zero or greater.)Ú_mgfÚ isinstanceÚsixZ integer_typesÚ MAX_LENGTHÚ TypeErrorÚ ValueErrorZ _salt_length)r ÚmgfÚ salt_lengthr r r Ú__init__#s z PSS.__init__N)r rrÚobjectrr rr r r r rsrc@seZdZdZdd„ZdS)ÚOAEPzEME-OAEPcCs*t|tjƒstdƒ‚||_||_||_dS)Nz*Expected instance of hashes.HashAlgorithm.)rrÚ HashAlgorithmrrÚ _algorithmZ_label)r rÚ algorithmZlabelr r r r6s  z OAEP.__init__N)r rrr rr r r r r2src@seZdZeƒZdd„ZdS)ÚMGF1cCst|tjƒstdƒ‚||_dS)Nz*Expected instance of hashes.HashAlgorithm.)rrrrr )r r!r r r rBs z MGF1.__init__N)r rrrrrr r r r r"?sr"cCsFt|tjtjfƒstdƒ‚|jdd}||jd}|dksBt‚|S)Nz(key must be an RSA public or private keyééér)rrZ RSAPrivateKeyZ RSAPublicKeyrZkey_sizeZ digest_sizeÚAssertionError)ÚkeyZhash_algorithmZemlenrr r r Úcalculate_max_pss_salt_lengthIs  r()Z __future__rrrrrZ cryptographyrZcryptography.hazmat.primitivesrZ)cryptography.hazmat.primitives.asymmetricrZ add_metaclassÚABCMetarrZregister_interfacerrrr"r(r r r r Ús