ó 9(Zc@`sdZddlmZmZmZmZddlZddlZddlm Z m Z m Z m Z m Z mZmZddlmZddlmZmZmZddlmZmZmZdd lmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)dd l*m+Z+m,Z,d e'fd „ƒYZ-d e(fd„ƒYZ.defd„ƒYZ/de'fd„ƒYZ0de'fd„ƒYZ1de'fd„ƒYZ2dfd„ƒYZ3de$e3fd„ƒYZ4de#e3fd„ƒYZ5defd„ƒYZ6de"fd „ƒYZ7d!e"fd"„ƒYZ8d#e'fd$„ƒYZ9d%e'fd&„ƒYZ:d'e'fd(„ƒYZ;d)e'fd*„ƒYZ<d+e'fd,„ƒYZ=d-e"fd.„ƒYZ>d/efd0„ƒYZ?d1efd2„ƒYZ@d3e'fd4„ƒYZAd5e'fd6„ƒYZBd7e'fd8„ƒYZCd9e)fd:„ƒYZDd;e"fd<„ƒYZEd=ee'fd>„ƒYZFd?e'fd@„ƒYZGdAe'fdB„ƒYZHdCe'fdD„ƒYZIdEe'fdF„ƒYZJdGe"fdH„ƒYZKdIee'fdJ„ƒYZLdKe'fdL„ƒYZMdS(Mu' ASN.1 type classes for public and private keys. Exports the following items: - DSAPrivateKey() - ECPrivateKey() - EncryptedPrivateKeyInfo() - PrivateKeyInfo() - PublicKeyInfo() - RSAPrivateKey() - RSAPublicKey() Other type classes are defined that help compose the types listed above. i(tunicode_literalstdivisiontabsolute_importtprint_functionNi(tSECP192R1_BASE_POINTtSECP224R1_BASE_POINTtSECP256R1_BASE_POINTtSECP384R1_BASE_POINTtSECP521R1_BASE_POINTt PrimeCurvet PrimePoint(tunwrap(t type_nametstr_clstbyte_cls(t_ForceNullParameterstDigestAlgorithmtEncryptionAlgorithm(tAnyt Asn1Valuet BitStringtChoicetIntegertIntegerOctetStringtNulltObjectIdentifiertOctetBitStringt OctetStringtParsableOctetStringtParsableOctetBitStringtSequencet SequenceOftSetOf(tint_from_bytest int_to_bytestOtherPrimeInfocB`s/eZdZdefdefdefgZRS(u= Source: https://tools.ietf.org/html/rfc3447#page-46 uprimeuexponentu coefficient(t__name__t __module__t__doc__Rt_fields(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR#6s  tOtherPrimeInfoscB`seZdZeZRS(u= Source: https://tools.ietf.org/html/rfc3447#page-46 (R$R%R&R#t _child_spec(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR(BstRSAPrivateKeyVersioncB`s"eZdZidd6dd6ZRS(uX Original Name: Version Source: https://tools.ietf.org/html/rfc3447#page-45 u two-primeiumultii(R$R%R&t_map(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR*Jst RSAPrivateKeycB`sxeZdZdefdefdefdefdefdefdefdefd efd eied 6fg ZRS( u= Source: https://tools.ietf.org/html/rfc3447#page-45 uversionumodulusupublic_exponentuprivate_exponentuprime1uprime2u exponent1u exponent2u coefficientuother_prime_infosuoptional(R$R%R&R*RR(tTrueR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR,Vs         t RSAPublicKeycB`s&eZdZdefdefgZRS(u= Source: https://tools.ietf.org/html/rfc3447#page-44 umodulusupublic_exponent(R$R%R&RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR.is t DSAPrivateKeycB`sJeZdZdefdefdefdefdefdefgZRS(u& The ASN.1 structure that OpenSSL uses to store a DSA private key that is not part of a PKCS#8 structure. Reversed engineered from english-language description on linked OpenSSL documentation page. Original Name: None Source: https://www.openssl.org/docs/apps/dsa.html uversionupuqugu public_keyu private_key(R$R%R&RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR/ts     t_ECPointcB`s&eZdZed„ƒZd„ZRS(u  In both PublicKeyInfo and PrivateKeyInfo, the EC public key is a byte string that is encoded as a bit string. This class adds convenience methods for converting to and from the byte string to a pair of integers that are the X and Y coordinates. cC`s•ttjtj|dƒdƒƒ}ttjtj|dƒdƒƒ}t||ƒ}d}|t|d|ƒ7}|t|d|ƒ7}||ƒS(u Creates an ECPoint object from the X and Y integer coordinates of the point :param x: The X coordinate, as an integer :param y: The Y coordinate, as an integer :return: An ECPoint object ig @stwidth(tinttmathtceiltlogtmaxR"(tclstxtytx_bytesty_bytest num_bytest byte_string((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt from_coordss%%cC`s¬|j}|dd!}|dkri|d}t|ƒd}t|d|!ƒ}t||ƒ}||fS|tddgƒkr–ttdƒƒ‚nttdƒƒ‚d S( u± Returns the X and Y coordinates for this EC point, as native Python integers :return: A 2-element tuple containing integers (X, Y) iisissuQ Invalid EC public key - first byte is incorrect u| Compressed representations of EC public keys are not supported due to patent US6252960 N(tnativetlenR!tsett ValueErrorR (tselftdatat first_bytet remainingt field_lenR8R9((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt to_coords«s     (R$R%R&t classmethodR>RH(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR0ˆstECPointcB`seZRS((R$R%(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRJÎstECPointBitStringcB`seZRS((R$R%(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRKÓstSpecifiedECDomainVersioncB`s)eZdZidd6dd6dd6ZRS(u: Source: http://www.secg.org/sec1-v2.pdf page 104 uecdpVer1iuecdpVer2iuecdpVer3i(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRLØs t FieldTypecB`s"eZdZidd6dd6ZRS(uR Original Name: None Source: http://www.secg.org/sec1-v2.pdf page 101 u prime_fieldu1.2.840.10045.1.1ucharacteristic_two_fieldu1.2.840.10045.1.2(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRMãstCharacteristicTwoBasiscB`s)eZdZidd6dd6dd6ZRS(uR Original Name: None Source: http://www.secg.org/sec1-v2.pdf page 102 ugn_basisu1.2.840.10045.1.2.1.1utp_basisu1.2.840.10045.1.2.1.2upp_basisu1.2.840.10045.1.2.1.3(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRNïs t PentanomialcB`s/eZdZdefdefdefgZRS(u: Source: http://www.secg.org/sec1-v2.pdf page 102 uk1uk2uk3(R$R%R&RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyROüs  tCharacteristicTwocB`sPeZdZdefdefdefgZdZied6ed6e d6Z RS(u` Original Name: Characteristic-two Source: http://www.secg.org/sec1-v2.pdf page 101 umubasisu parametersugn_basisutp_basisupp_basis(ubasisu parameters( R$R%R&RRNRR't _oid_pairRROt _oid_specs(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRPs  tFieldIDcB`s@eZdZdefdefgZdZied6ed6Z RS(u: Source: http://www.secg.org/sec1-v2.pdf page 100 u field_typeu parametersu prime_fielducharacteristic_two_field(u field_typeu parameters( R$R%R&RMRR'RQRRPRR(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRSs tCurvecB`s9eZdZdefdefdeied6fgZRS(u: Source: http://www.secg.org/sec1-v2.pdf page 104 uaubuseeduoptional(R$R%R&RRR-R'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRT-s  tSpecifiedECDomainc B`sgeZdZdefdefdefdefdefdeied6fde ied6fgZ RS( u: Source: http://www.secg.org/sec1-v2.pdf page 103 uversionufield_iducurveubaseuorderucofactoruoptionaluhash( R$R%R&RLRSRTRJRR-RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRU9s     t NamedCurvecB`s,eZdZi(dd6dd6dd6dd6d d 6d d 6d d6dd6dd6dd6dd6dd6dd6dd6dd6dd 6d!d"6d#d$6d%d&6d'd(6d)d*6d+d,6d-d.6d/d06d1d26d3d46d5d66d7d86d9d:6d;d<6d=d>6d?d@6dAdB6dCdD6dEdF6dGdH6dIdJ6dKdL6dMdN6dOdP6ZRS(Qu§ Various named curves Original Name: None Source: https://tools.ietf.org/html/rfc3279#page-23, https://tools.ietf.org/html/rfc5480#page-5 u c2pnb163v1u1.2.840.10045.3.0.1u c2pnb163v2u1.2.840.10045.3.0.2u c2pnb163v3u1.2.840.10045.3.0.3u c2pnb176w1u1.2.840.10045.3.0.4u c2tnb191v1u1.2.840.10045.3.0.5u c2tnb191v2u1.2.840.10045.3.0.6u c2tnb191v3u1.2.840.10045.3.0.7u c2onb191v4u1.2.840.10045.3.0.8u c2onb191v5u1.2.840.10045.3.0.9u c2pnb208w1u1.2.840.10045.3.0.10u c2tnb239v1u1.2.840.10045.3.0.11u c2tnb239v2u1.2.840.10045.3.0.12u c2tnb239v3u1.2.840.10045.3.0.13u c2onb239v4u1.2.840.10045.3.0.14u c2onb239v5u1.2.840.10045.3.0.15u c2pnb272w1u1.2.840.10045.3.0.16u c2pnb304w1u1.2.840.10045.3.0.17u c2tnb359v1u1.2.840.10045.3.0.18u c2pnb368w1u1.2.840.10045.3.0.19u c2tnb431r1u1.2.840.10045.3.0.20u prime192v2u1.2.840.10045.3.1.2u prime192v3u1.2.840.10045.3.1.3u prime239v1u1.2.840.10045.3.1.4u prime239v2u1.2.840.10045.3.1.5u prime239v3u1.2.840.10045.3.1.6u sect163k1u 1.3.132.0.1u sect163r2u 1.3.132.0.15u secp192r1u1.2.840.10045.3.1.1u secp224r1u 1.3.132.0.33u sect233k1u 1.3.132.0.26u secp256r1u1.2.840.10045.3.1.7u sect233r1u 1.3.132.0.27u sect283k1u 1.3.132.0.16u sect283r1u 1.3.132.0.17u secp384r1u 1.3.132.0.34u sect409k1u 1.3.132.0.36u sect409r1u 1.3.132.0.37u secp521r1u 1.3.132.0.35u sect571k1u 1.3.132.0.38u sect571r1u 1.3.132.0.39(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRVIsTtECDomainParameterscB`s/eZdZdefdefdefgZRS(u: Source: http://www.secg.org/sec1-v2.pdf page 102 u specifiedunamedu implicit_ca(R$R%R&RURVRt _alternatives(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRW€s  tECPrivateKeyVersioncB`seZdZidd6ZRS(uR Original Name: None Source: http://www.secg.org/sec1-v2.pdf page 108 u ecPrivkeyVer1i(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRYŒst ECPrivateKeycB`sZeZdZdefdefdeidd6ed6fdeidd6ed6fgZRS( u: Source: http://www.secg.org/sec1-v2.pdf page 108 uversionu private_keyu parametersiuexplicituoptionalu public_keyi( R$R%R&RYRRWR-RKR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRZ—s   t DSAParamscB`s/eZdZdefdefdefgZRS(u‰ Parameters for a DSA public or private key Original Name: Dss-Parms Source: https://tools.ietf.org/html/rfc3279#page-9 upuqug(R$R%R&RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR[¤s  t AttributecB`s0eZdZdefdeied6fgZRS(uq Source: https://www.itu.int/rec/dologin_pub.asp?lang=e&id=T-REC-X.501-198811-S!!PDF-E&type=items page 8 utypeuvaluesuspec(R$R%R&RR RR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR\³s t AttributescB`seZdZeZRS(u< Source: https://tools.ietf.org/html/rfc5208#page-3 (R$R%R&R\R)(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR]¾stPrivateKeyAlgorithmIdcB`s)eZdZidd6dd6dd6ZRS(u» These OIDs for various public keys are reused when storing private keys inside of a PKCS#8 structure Original Name: None Source: https://tools.ietf.org/html/rfc3279 ursau1.2.840.113549.1.1.1udsau1.2.840.10040.4.1uecu1.2.840.10045.2.1(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR^Æs tPrivateKeyAlgorithmcB`sJeZdZdefdeied6fgZdZied6e d6Z RS(um Original Name: PrivateKeyAlgorithmIdentifier Source: https://tools.ietf.org/html/rfc5208#page-3 u algorithmu parametersuoptionaludsauec(u algorithmu parameters( R$R%R&R^RR-R'RQR[RWRR(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR_Ùs tPrivateKeyInfocB`seZdZdefdefdefdeidd6ed6fgZd„Z ie d6Z dZ dZ dZdZed „ƒZd „Zd „Zed „ƒZed „ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZed„ƒZRS(u< Source: https://tools.ietf.org/html/rfc5208#page-3 uversionuprivate_key_algorithmu private_keyu attributesiuimplicituoptionalcC`s.|ddj}itd6td6td6|S(Nuprivate_key_algorithmu algorithmursaudsauec(R?R,RRZ(RCt algorithm((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt_private_key_spec÷s cC`sËt|tƒ r>t|tƒ r>ttdt|ƒƒƒ‚n|dkrwt|tƒsktj|ƒ}ntƒ}nß|dkrît|t ƒs¤t j|ƒ}nt ƒ}|d|d<|d|d<|d|d<|d}|d}nh|d kr;t|t ƒst j|ƒ}n |j ƒ}|d }|d =nt td t|ƒƒƒ‚tƒ}t|ƒ|d <||d <|ƒ}||_td ƒ|d<||d<||d<|dkrÇ||_n|S(u' Wraps a private key in a PrivateKeyInfo structure :param private_key: A byte string or Asn1Value object of the private key :param algorithm: A unicode string of "rsa", "dsa" or "ec" :return: A PrivateKeyInfo object uX private_key must be a byte string or Asn1Value, not %s ursaudsaupuqugu public_keyu private_keyuecu parametersuU algorithm must be one of "rsa", "dsa", "ec", not %s u algorithmiuversionuprivate_key_algorithm(t isinstanceRRt TypeErrorR R R,tloadRR/R[RZtcopyRBtreprR_R^t _algorithmRt _public_key(R7t private_keyRatparamst public_keytprivate_key_algot container((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pytwrapsJ                   c C`sù|jdkrK|dd}tt|dj|djj|djƒƒS|jdkr‡|dj}ti|dd6|d d 6ƒS|jd krõ|j\}}|d krÆttd ƒƒ‚n|d krg|dddkrûttdƒƒ‚nt |ddt |ddƒt |ddƒƒ}|ddj dj ƒ\}}t |||ƒ}n`|dkrÇ|dkr—ttd|ƒƒ‚nitd6td6td6td6td6|}n||djdj} tj| j| jƒSdS(uæ Computes the public key corresponding to the current private key. :return: For RSA keys, an RSAPublicKey object. For DSA keys, an Integer object. For EC keys, an ECPointBitString. udsauprivate_key_algorithmu parametersugu private_keyupursaumodulusupublic_exponentuecu implicit_cau‚ Unable to compute public key for EC key using Implicit CA parameters u specifiedufield_idu field_typeucharacteristic_two_fieldu‘ Unable to compute public key for EC key over a characteristic two field ucurveuaububaseunamedu secp192r1u secp224r1u secp256r1u secp384r1u secp521r1uŸ Unable to compute public key for EC named curve %s, parameters not currently included N(u secp192r1u secp224r1u secp256r1u secp384r1u secp521r1(RaRtpowR?tparsedR.tcurveRBR R R!tchosenRHR RRRRRRKR>R8R9( RCRktkeyt curve_typetdetailsRrtbase_xtbase_yt base_pointt public_point((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt_compute_public_keyLsP        !   cC`sÄ|jdkr|djS|jdkr|dd}tidd6|dd6|d d 6|d d 6|jd 6|djd6ƒS|jd krÀ|dj}|dd|d<|j|d <|Sd S(u Unwraps the private key into an RSAPrivateKey, DSAPrivateKey or ECPrivateKey object :return: An RSAPrivateKey, DSAPrivateKey or ECPrivateKey object ursau private_keyudsauprivate_key_algorithmu parametersiuversionupuqugu public_keyuecN(RaRqR/Rl(RCRktoutput((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR •s        cC`su|jdkr0ttd|jjƒƒƒ‚n|dd}|j}|jdkr_d}n |j}|j|fS(u# Returns information about the curve used for an EC key :raises: ValueError - when the key is not an EC key :return: A two-element tuple, with the first element being a unicode string of "implicit_ca", "specified" or "named". If the first element is "implicit_ca", the second is None. If "specified", the second is an OrderedDict that is the native version of SpecifiedECDomain. If "named", the second is a unicode string of the curve name. uecuK Only EC keys have a curve, this key is %s uprivate_key_algorithmu parametersu implicit_caN(RaRBR tupperRstnametNoneR?(RCRkRstvalue((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRr²s   cC`si|jdkr0ttd|jjƒƒƒ‚ntj|dddjdƒd}|dkred Sd S( uò Returns the name of the family of hash algorithms used to generate a DSA key :raises: ValueError - when the key is not a DSA key :return: A unicode string of "sha1" or "sha2" udsaut Only DSA keys are generated using a hash algorithm, this key is %s uprivate_key_algorithmu parametersuqiiiusha1usha2(RaRBR R}R3R5R?(RCtbyte_len((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt hash_algoÔs %cC`s-|jdkr&|ddj|_n|jS(uO :return: A unicode string of "rsa", "dsa" or "ec" uprivate_key_algorithmu algorithmN(RhRR?(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRaîscC`sß|jd krØ|jdkr5|djdj}nM|jdkr\|dddj}n&|jdkr‚|djdj}nttjtj|d ƒƒƒ|_|jd }|d krØ|jd |7_qØn|jS( uU :return: The bit size of the private key, as an integer ursau private_keyumodulusudsauprivate_key_algorithmu parametersupueciiiN( t _bit_sizeRRaRqR?R2R3R4R5(RCtprimetmodulus((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pytbit_sizeùs$  cC`sttj|jdƒƒS(uV :return: The byte size of the private key, as an integer i(R2R3R4R†(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt byte_size scC`sv|jdkro|jdkr]|dj}|drK|djƒ|_ql|jƒ|_qo|jƒ|_n|jS(u¤ :return: If an RSA key, an RSAPublicKey object. If a DSA key, an Integer object. If an EC key, an ECPointBitString object. uecu private_keyu public_keyN(RiRRaRqtuntagR{(RCRt((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRls  cC`s4tii|jd6|ddd6d6|jd6ƒS(u\ :return: A PublicKeyInfo object derived from this private key. u algorithmuprivate_key_algorithmu parametersu public_key(t PublicKeyInfoRaRl(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pytpublic_key_info*s  cC`sî|jdkrç|dd}|dj}|jdkrZd|dj|djf}nQ|jdkr£|j}d |d j|d j|d j|jf}n|jd kr«|dj}|dkrÚ|jj}n|jdkrd|jj}|jdƒ}||7}q«|jdkr-|}q«|jdkr«d|jddj}|jdƒ}|d|jddj7}|d|jddj7}||7}q«nt |t ƒrÌ|jdƒ}nt j |ƒj ƒ|_n|jS(uY Creates a fingerprint that can be compared with a public key to see if the two form a pair. This fingerprint is not compatible with fingerprints generated by any other software. :return: A byte string that is a sha256 hash of selected components (based on the key type) uprivate_key_algorithmu parametersu private_keyursau%d:%dumodulusupublic_exponentudsau %d:%d:%d:%dupuquguecu public_keyunamedu%s:uutf-8u implicit_cau specifiedufield_idt:ucurveuaubN(t _fingerprintRRqRaR?RlR~RstencodeRcR thashlibtsha256tdigest(RCRkRttto_hashRl((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt fingerprint9sD          N(R$R%R&RR_RR]R-R'Rbt_spec_callbacksRRhRƒRiRŒRIRoR{R tpropertyRrR‚RaR†R‡RlRŠR’(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR`ës.      D I "  tEncryptedPrivateKeyInfocB`s&eZdZdefdefgZRS(u< Source: https://tools.ietf.org/html/rfc5208#page-4 uencryption_algorithmuencrypted_data(R$R%R&RRR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR•vs tValidationParmscB`s&eZdZdefdefgZRS(u= Source: https://tools.ietf.org/html/rfc3279#page-10 useedu pgen_counter(R$R%R&RRR'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR–ƒs tDomainParametersc B`sUeZdZdefdefdefdeied6fdeied6fgZRS(u= Source: https://tools.ietf.org/html/rfc3279#page-10 upuguqujuoptionaluvalidation_params(R$R%R&RR-R–R'(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR—Žs    tPublicKeyAlgorithmIdcB`s0eZdZidd6dd6dd6dd6ZRS( uM Original Name: None Source: https://tools.ietf.org/html/rfc3279 ursau1.2.840.113549.1.1.1udsau1.2.840.10040.4.1uecu1.2.840.10045.2.1udhu1.2.840.10046.2.1(R$R%R&R+(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR˜œs tPublicKeyAlgorithmcB`sQeZdZdefdeied6fgZdZied6e d6e d6Z RS(ud Original Name: AlgorithmIdentifier Source: https://tools.ietf.org/html/rfc5280#page-18 u algorithmu parametersuoptionaludsauecudh(u algorithmu parameters( R$R%R&R˜RR-R'RQR[RWR—RR(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR™®s R‰cB`sêeZdZdefdefgZd„Zied6ZdZ dZ dZ dZ dZ ed„ƒZd„Zed„ƒZed„ƒZed„ƒZed „ƒZed „ƒZed „ƒZed „ƒZed „ƒZRS(ue Original Name: SubjectPublicKeyInfo Source: https://tools.ietf.org/html/rfc5280#page-17 u algorithmu public_keycC`s;|ddj}itd6td6tdfd6td6|S(Nu algorithmursaudsauecudh(R?R.RRKR(RCRa((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyt_public_key_specÌs cC`sÙt|tƒ r>t|tƒ r>ttdt|ƒƒƒ‚n|dkrhttdt|ƒƒƒ‚ntƒ}t |ƒ|d algorithm must "rsa", not %s u algorithmu parametersu public_key(RcRRRdR R RBRgR™R˜RRˆtdumpR(R7RlRatalgoRn((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRoás"      cC`s]|jdkr|djS|jjƒ}|dkr;dnd}ttd||ƒƒ‚dS(uÖ Unwraps an RSA public key into an RSAPublicKey object. Does not support DSA or EC public keys since they do not have an unwrapped form. :return: An RSAPublicKey object ursau public_keyuECuanuauj Only RSA public keys may be unwrapped - this key is %s %s public key N(RaRqR}RBR (RCtkey_typeta_an((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR s  cC`su|jdkr0ttd|jjƒƒƒ‚n|dd}|j}|jdkr_d}n |j}|j|fS(u# Returns information about the curve used for an EC key :raises: ValueError - when the key is not an EC key :return: A two-element tuple, with the first element being a unicode string of "implicit_ca", "specified" or "named". If the first element is "implicit_ca", the second is None. If "specified", the second is an OrderedDict that is the native version of SpecifiedECDomain. If "named", the second is a unicode string of the curve name. uecuK Only EC keys have a curve, this key is %s u algorithmu parametersu implicit_caN(RaRBR R}RsR~RR?(RCRkRsR€((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRr#s   cC`s‚|jdkr0ttd|jjƒƒƒ‚n|dd}|jd krQd Stj|djdƒd}|dkr~d Sd S( u# Returns the name of the family of hash algorithms used to generate a DSA key :raises: ValueError - when the key is not a DSA key :return: A unicode string of "sha1" or "sha2" or None if no parameters are present udsaut Only DSA keys are generated using a hash algorithm, this key is %s u algorithmu parametersuqiiiusha1usha2N(RaRBR R}R?RR3R5(RCt parametersR((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR‚EscC`s-|jdkr&|ddj|_n|jS(uO :return: A unicode string of "rsa", "dsa" or "ec" u algorithmN(RhRR?(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyRadscC`sí|jd kræ|jdkrCt|djƒddd|_qæ|jdkri|djdj}n'|jdkr|d d d j}nttjtj |dƒƒƒ|_|jd}|d kræ|jd|7_qæn|jS(uT :return: The bit size of the public key, as an integer uecu public_keyiiiursaumodulusudsau algorithmu parametersupiN( RƒRRaR@R?RqR2R3R4R5(RCR„R…((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR†os%$  cC`sttj|jdƒƒS(uU :return: The byte size of the public key, as an integer i(R2R3R4R†(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR‡…scC`s;|jdkr4tjt|dƒƒjƒ|_n|jS(ue :return: The SHA1 hash of the DER-encoded bytes of this public key info u public_keyN(t_sha1RRŽtsha1RR(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR¡Žs%cC`s;|jdkr4tjt|dƒƒjƒ|_n|jS(uh :return: The SHA-256 hash of the DER-encoded bytes of this public key info u public_keyN(t_sha256RRŽRRR(RC((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR™s%cC`så|jdkrÞ|ddj}|dd}|dkrh|dj}d|dj|djf}n:|dkr²|dj}d |d j|d j|d j|jf}nð|d kr¢|d}|jdkrd|jj}|jdƒ}||j7}q¢|jdkr!|j}q¢|jdkr¢d|jddj}|jdƒ}|d|jddj7}|d|jddj7}||j7}q¢nt|tƒrÃ|jdƒ}nt j |ƒj ƒ|_n|jS(uZ Creates a fingerprint that can be compared with a private key to see if the two form a pair. This fingerprint is not compatible with fingerprints generated by any other software. :return: A byte string that is a sha256 hash of selected components (based on the key type) u algorithmu parametersursau public_keyu%d:%dumodulusupublic_exponentudsau %d:%d:%d:%dupuquguecunamedu%s:uutf-8u implicit_cau specifiedufield_idR‹ucurveuaubN( RŒRR?RqR~RsRRcR RŽRR(RCRRkRtR‘((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR’¤sB           N(R$R%R&R™RR'RšR“RRhRƒRŒR R¢RIRoR R”RrR‚RaR†R‡R¡RR’(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pyR‰Ás*   + "    (NR&t __future__RRRRRŽR3t_elliptic_curveRRRRRR R t_errorsR t_typesR R RtalgosRRRtcoreRRRRRRRRRRRRRRR tutilR!R"R#R(R*R,R.R/R0RJRKRLRMRNRORPRSRTRURVRWRYRZR[R\R]R^R_R`R•R–R—R˜R™R‰(((s3/tmp/pip-build-wDUJoH/asn1crypto/asn1crypto/keys.pytsV"  4 d   F     7    ÿŒ