/usr/lib/python3.9/site-packages/dns/__pycache__
NameSizeModeActions
asyncbackend.cpython-39.opt-1.pyc26160644editdlrm
asyncbackend.cpython-39.pyc26160644editdlrm
asyncquery.cpython-39.opt-1.pyc178050644editdlrm
asyncquery.cpython-39.pyc178170644editdlrm
asyncresolver.cpython-39.opt-1.pyc129580644editdlrm
asyncresolver.cpython-39.pyc130020644editdlrm
dnssec.cpython-39.opt-1.pyc321600644editdlrm
dnssec.cpython-39.pyc321880644editdlrm
dnssectypes.cpython-39.opt-1.pyc16160644editdlrm
dnssectypes.cpython-39.pyc16160644editdlrm
e164.cpython-39.opt-1.pyc34520644editdlrm
e164.cpython-39.pyc34520644editdlrm
edns.cpython-39.opt-1.pyc147200644editdlrm
edns.cpython-39.pyc147340644editdlrm
entropy.cpython-39.opt-1.pyc33480644editdlrm
entropy.cpython-39.pyc33480644editdlrm
enum.cpython-39.opt-1.pyc32490644editdlrm
enum.cpython-39.pyc32490644editdlrm
exception.cpython-39.opt-1.pyc55180644editdlrm
exception.cpython-39.pyc57140644editdlrm
flags.cpython-39.opt-1.pyc22080644editdlrm
flags.cpython-39.pyc22080644editdlrm
grange.cpython-39.opt-1.pyc10890644editdlrm
grange.cpython-39.pyc11330644editdlrm
immutable.cpython-39.opt-1.pyc24280644editdlrm
immutable.cpython-39.pyc24280644editdlrm
inet.cpython-39.opt-1.pyc46030644editdlrm
inet.cpython-39.pyc46030644editdlrm
ipv4.cpython-39.opt-1.pyc18440644editdlrm
ipv4.cpython-39.pyc18440644editdlrm
ipv6.cpython-39.opt-1.pyc39380644editdlrm
ipv6.cpython-39.pyc39380644editdlrm
message.cpython-39.opt-1.pyc506310644editdlrm
message.cpython-39.pyc506720644editdlrm
name.cpython-39.opt-1.pyc350740644editdlrm
name.cpython-39.pyc350890644editdlrm
namedict.cpython-39.opt-1.pyc29860644editdlrm
namedict.cpython-39.pyc29860644editdlrm
nameserver.cpython-39.opt-1.pyc89080644editdlrm
nameserver.cpython-39.pyc89080644editdlrm
node.cpython-39.opt-1.pyc116050644editdlrm
node.cpython-39.pyc116050644editdlrm
opcode.cpython-39.opt-1.pyc24750644editdlrm
opcode.cpython-39.pyc24750644editdlrm
query.cpython-39.opt-1.pyc402980644editdlrm
query.cpython-39.pyc403430644editdlrm
rcode.cpython-39.opt-1.pyc32530644editdlrm
rcode.cpython-39.pyc32530644editdlrm
rdata.cpython-39.opt-1.pyc236090644editdlrm
rdata.cpython-39.pyc236090644editdlrm
rdataclass.cpython-39.opt-1.pyc27920644editdlrm
rdataclass.cpython-39.pyc27920644editdlrm
rdataset.cpython-39.opt-1.pyc154370644editdlrm
rdataset.cpython-39.pyc154510644editdlrm
rdatatype.cpython-39.opt-1.pyc66730644editdlrm
rdatatype.cpython-39.pyc66730644editdlrm
renderer.cpython-39.opt-1.pyc98220644editdlrm
renderer.cpython-39.pyc98410644editdlrm
resolver.cpython-39.opt-1.pyc524720644editdlrm
resolver.cpython-39.pyc526250644editdlrm
reversename.cpython-39.opt-1.pyc30550644editdlrm
reversename.cpython-39.pyc30550644editdlrm
rrset.cpython-39.opt-1.pyc78850644editdlrm
rrset.cpython-39.pyc78990644editdlrm
serial.cpython-39.opt-1.pyc29330644editdlrm
serial.cpython-39.pyc29330644editdlrm
set.cpython-39.opt-1.pyc87990644editdlrm
set.cpython-39.pyc87990644editdlrm
tokenizer.cpython-39.opt-1.pyc172420644editdlrm
tokenizer.cpython-39.pyc172560644editdlrm
transaction.cpython-39.opt-1.pyc202610644editdlrm
transaction.cpython-39.pyc202610644editdlrm
tsig.cpython-39.opt-1.pyc103810644editdlrm
tsig.cpython-39.pyc103810644editdlrm
tsigkeyring.cpython-39.opt-1.pyc18350644editdlrm
tsigkeyring.cpython-39.pyc18350644editdlrm
ttl.cpython-39.opt-1.pyc16800644editdlrm
ttl.cpython-39.pyc16800644editdlrm
update.cpython-39.opt-1.pyc88860644editdlrm
update.cpython-39.pyc88860644editdlrm
version.cpython-39.opt-1.pyc5630644editdlrm
version.cpython-39.pyc5630644editdlrm
versioned.cpython-39.opt-1.pyc87230644editdlrm
versioned.cpython-39.pyc87750644editdlrm
win32util.cpython-39.opt-1.pyc56530644editdlrm
win32util.cpython-39.pyc56530644editdlrm
wire.cpython-39.opt-1.pyc33270644editdlrm
wire.cpython-39.pyc33550644editdlrm
xfr.cpython-39.opt-1.pyc77710644editdlrm
xfr.cpython-39.pyc77890644editdlrm
zone.cpython-39.opt-1.pyc452680644editdlrm
zone.cpython-39.pyc454120644editdlrm
zonefile.cpython-39.opt-1.pyc176630644editdlrm
zonefile.cpython-39.pyc176870644editdlrm
zonetypes.cpython-39.opt-1.pyc10230644editdlrm
zonetypes.cpython-39.pyc10230644editdlrm
_asyncbackend.cpython-39.opt-1.pyc42080644editdlrm
_asyncbackend.cpython-39.pyc42080644editdlrm
_asyncio_backend.cpython-39.opt-1.pyc89840644editdlrm
_asyncio_backend.cpython-39.pyc90020644editdlrm
_ddr.cpython-39.opt-1.pyc40710644editdlrm
_ddr.cpython-39.pyc40710644editdlrm
_features.cpython-39.opt-1.pyc23670644editdlrm
_features.cpython-39.pyc23670644editdlrm
_immutable_ctx.cpython-39.opt-1.pyc21590644editdlrm
_immutable_ctx.cpython-39.pyc21590644editdlrm
__init__.cpython-39.opt-1.pyc6670644editdlrm
__init__.cpython-39.pyc6670644editdlrm
Edit: /usr/lib/python3.9/site-packages/dns/__pycache__/dnssec.cpython-39.pyc (32188B)
a àMÒeõžã@s<dZddlZddlZddlZddlZddlZddlZddlmZddlm Z m Z m Z m Z m Z mZmZmZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlZddlmZmZm Z ddlm!Z!m"Z"m#Z#m$Z$ddl%m&Z&ddl'm(Z(dd l)m*Z*dd l+m,Z,dd l-m.Z.m/Z/dd l0m1Z1dd l2m3Z3m4Z4ddl5m6Z6edZ7edZ8e ej9j:ej;jedœdd„Z?eee@fe>dœdd„ZAeee>eBe@fe@dœdd„ZCee*e&fe@dœdd„ZDGdd„dƒZEGdd„deEƒZFeFejGejHejIejJhejGejHejIhejKejLejMhejKhƒZNeFeOƒeOƒeOƒeOƒƒZPeNZQdeeejRjSe>fejTjUeee>fe ejRjSe eEeVe,d!œd"d#„ZWdfeejRjSe>fejTjUeee>fe ejRjSe(d$œd%d&„ZXe ejRjSeejYjZej[j\ffe3e e e*d'œd(d)„Z]eej;je@eBfe eee>e@eBfe e@eVe eEe ejRjSe3d6œ d7d8„Zcdjeej;jfe@e@e*d=œd>d?„Zfe6jedfe@e@e&d=œd@dA„ZgeejRjSe>fe ee>e_fe@ee@e>fe>dBœdCdD„Zhdkeej;jfe ejRjSejYjZdEœdFdG„ZiejYjZejYjZdHœdIdJ„ZjdleejRjSe>fejYjZeee>fe ejRjSejYjZdKœdLdM„ZkejYjZejYjZdHœdNdO„Zldmej9j:ej;je@eBfe eee>e@eBfe e@e eEe ejRjSddPœ dQdR„Zmdnejnjoe ej9j:e e ee8e*feVe e@e eee>e@eBfe eee>e@eBfe e@e e1e e=e eEddTœ dUdV„Zpdoejnjoej9j:e e=ddWœdXdY„ZqdZd[„Zrejs td\¡�rºdd]lumvZvdd^lwmxZxdd_lwmyZydd`lwmzZzddalwm{Z{ddblwm|Z|ddcl}m~Z~mZdddl€m�Z�m‚Z‚ebZƒeaZ„ecZ…efZ†egZ‡dSZˆnerZƒerZ„erZ…erZ†erZ‡d ZˆejGZGej‰Z‰ejHZHejŠZŠej‹Z‹ejIZIejŒZŒej�Z�ejŽZŽejJZJej�Z�ej�Z�ej‘Z‘ej’Z’ej“Z“ej”Z”ej•Z•dS)pz.Common DNSSEC-related functions and constants.éN)Údatetime)ÚCallableÚDictÚListÚOptionalÚSetÚTupleÚUnionÚcast)Ú AlgorithmÚDSDigestÚ NSEC3Hash)ÚAlgorithmKeyMismatchÚDeniedByPolicyÚUnsupportedAlgorithmÚValidationFailure)ÚCDNSKEY)ÚCDS)ÚDNSKEY)ÚDS)ÚNSECÚBitmap)Ú NSEC3PARAM)ÚRRSIGÚsigtime_to_posixtime)ÚFlag)ÚGenericPublicKeyzrsa.RSAPublicKeyzec.EllipticCurvePublicKeyzed25519.Ed25519PublicKeyzed448.Ed448PublicKey)ÚGenericPrivateKeyzrsa.RSAPrivateKeyzec.EllipticCurvePrivateKeyzed25519.Ed25519PrivateKeyzed448.Ed448PrivateKey)ÚtextÚreturncCs t |¡S)z‘Convert text into a DNSSEC algorithm value. *text*, a ``str``, the text to convert to into an algorithm value. Returns an ``int``. )r Ú from_text)r©r!ú./usr/lib/python3.9/site-packages/dns/dnssec.pyÚalgorithm_from_textLsr#)ÚvaluercCs t |¡S)z�Convert a DNSSEC algorithm value to text *value*, a ``dns.dnssec.Algorithm``. Returns a ``str``, the name of a DNSSEC algorithm. )r Zto_text©r$r!r!r"Úalgorithm_to_textWsr&cCsTt|tƒrt| ¡ƒSt|tƒr(t|ƒSt|tƒr:t|ƒSt|tƒrH|Stdƒ‚dS)z%Convert various format to a timestampzUnsupported timestamp typeN)Ú isinstancerÚintZ timestampÚstrrÚfloatÚ TypeErrorr%r!r!r"Ú to_timestampbs     r,©ÚkeyrcCsª| ¡}|jtjkr(|dd>|dSd}tt|ƒdƒD](}||d|d>|d|d7}q7}||d?d@7}|d@Sd S) z›Return the key id (a 16-bit number) for the specified key. *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` Returns an ``int`` between 0 and 65535 éýÿÿÿééþÿÿÿréééiÿÿN)Úto_wireÚ algorithmr ÚRSAMD5ÚrangeÚlen)r.ÚrdataÚtotalÚir!r!r"Úkey_idps &r=c@sTeZdZdd„Zeedœdd„Zeedœdd„Zeedœdd „Z eedœd d „Z d S) ÚPolicycCsdS©Nr!)Úselfr!r!r"Ú__init__†szPolicy.__init__)Ú_rcCsdS©NFr!©r@rBr!r!r"Ú ok_to_sign‰szPolicy.ok_to_signcCsdSrCr!rDr!r!r"Úok_to_validateŒszPolicy.ok_to_validatecCsdSrCr!rDr!r!r"Úok_to_create_ds�szPolicy.ok_to_create_dscCsdSrCr!rDr!r!r"Úok_to_validate_ds’szPolicy.ok_to_validate_dsN) Ú__name__Ú __module__Ú __qualname__rArÚboolrErFr rGrHr!r!r!r"r>…s r>cs\eZdZ‡fdd„Zeedœdd„Zeedœdd„Zeedœd d „Z eedœd d „Z ‡Z S) Ú SimpleDenycs&tƒ ¡||_||_||_||_dSr?)ÚsuperrAÚ _deny_signÚ_deny_validateÚ_deny_create_dsÚ_deny_validate_ds)r@Z deny_signZ deny_validateZdeny_create_dsZdeny_validate_ds©Ú __class__r!r"rA—s  zSimpleDeny.__init__r-cCs |j|jvSr?)r6rO©r@r.r!r!r"rEžszSimpleDeny.ok_to_signcCs |j|jvSr?)r6rPrUr!r!r"rF¡szSimpleDeny.ok_to_validate)r6rcCs ||jvSr?)rQ©r@r6r!r!r"rG¤szSimpleDeny.ok_to_create_dscCs ||jvSr?)rRrVr!r!r"rH§szSimpleDeny.ok_to_validate_ds) rIrJrKrArrLrErFr rGrHÚ __classcell__r!r!rSr"rM–s  rMF)Únamer.r6ÚoriginÚpolicyÚ validatingrc CsZ|dur t}zt|tƒr$t| ¡}WntyDtd|ƒ‚Yn0|rR|j}n|j}||ƒsdt ‚t|t t fƒszt dƒ‚|tj krŽt ¡}n4|tjkr¢t ¡}n |tjkr¶t ¡}n td|ƒ‚t|tƒrÚtj ||¡}| ¡ ¡}|dusòJ‚| |¡| |j|d�¡| ¡} t dt|ƒ|j|¡| } tj  tj!j"tj#j$| dt%| ƒ¡} t&t$| ƒS)a—Create a DS record for a DNSSEC key. *name*, a ``dns.name.Name`` or ``str``, the owner name of the DS record. *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` or ``dns.rdtypes.ANY.DNSKEY.CDNSKEY``, the key the DS is about. *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case does not matter for these strings. *origin*, a ``dns.name.Name`` or ``None``. If *key* is a relative name, then it will be made absolute using the specified origin. *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. *validating*, a ``bool``. If ``True``, then policy is checked in validating mode, i.e. "Is it ok to validate using this digest algorithm?". Otherwise the policy is checked in creating mode, i.e. "Is it ok to create a DS with this digest algorithm?". Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. Raises ``DeniedByPolicy`` if the algorithm is denied by policy. Returns a ``dns.rdtypes.ANY.DS.DS`` Núunsupported algorithm "%s"zkey is not a DNSKEY/CDNSKEY©rYz!HBBr)'Údefault_policyr'r)r ÚupperÚ ExceptionrrHrGrrrÚ ValueErrorÚSHA1ÚhashlibÚsha1ZSHA256Zsha256ZSHA384Zsha384ÚdnsrXr Ú canonicalizer5ÚupdateÚdigestÚstructÚpackr=r6r:Z from_wireÚ rdataclassÚINÚ rdatatyperr9r ) rXr.r6rYrZr[ÚcheckZdshashZwirerhZdsrdataÚdsr!r!r"Úmake_ds¸sB%             ÿrp)rXr.r6rYrcCs0t||||ƒ}t|jtjj|j|j|j|jd�S)a�Create a CDS record for a DNSSEC key. *name*, a ``dns.name.Name`` or ``str``, the owner name of the DS record. *key*, a ``dns.rdtypes.ANY.DNSKEY.DNSKEY`` or ``dns.rdtypes.ANY.DNSKEY.CDNSKEY``, the key the DS is about. *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case does not matter for these strings. *origin*, a ``dns.name.Name`` or ``None``. If *key* is a relative name, then it will be made absolute using the specified origin. Raises ``UnsupportedAlgorithm`` if the algorithm is unknown. Returns a ``dns.rdtypes.ANY.DS.CDS`` ©ÚrdclassÚrdtypeÚkey_tagr6Ú digest_typerh) rprrrrermrtr6rurh)rXr.r6rYror!r!r"Úmake_cdssúrv)ÚkeysÚrrsigrcsR| ˆj¡}t|tjjƒr0| tjjtj j ¡}n|}|dur@dS‡fdd„|DƒS)NcsLg|]D}|jˆjkrt|ƒˆjkr|jtj@tjkr|jdkrtt|ƒ‘qS)é) r6r=rtÚflagsrÚZONEÚprotocolr r)Ú.0Zrd©rxr!r"Ú 2s   ûz(_find_candidate_keys..) ÚgetÚsignerr'reÚnodeÚNodeZ get_rdatasetrkrlrmr)rwrxr$Úrdatasetr!r~r"Ú_find_candidate_keys(s  þr…)ÚrrsetrcCs(t|tƒr|d|dfS|j|fSdS)Nrr3)r'ÚtuplerX)r†r!r!r"Ú_get_rrname_rdataset<s rˆ)ÚsigÚdatar.rcCsDt|ƒj}z| |¡}Wnty2tdƒ‚Yn0| ||¡dS)Nzinvalid public key)Úget_algorithm_cls_from_dnskeyÚ public_clsZ from_dnskeyrarÚverify)r‰rŠr.rŒÚ public_keyr!r!r"Ú_validate_signatureEs   r�)r†rxrwrYÚnowrZrc Csº|dur t}t||ƒ}|dur&tdƒ‚|dur6t ¡}|j|krHtdƒ‚|j|krZtdƒ‚t|||ƒ}|D]B}| |¡szqjzt|j ||ƒWdSt tfyªYqjYqj0qjtdƒ‚dS)aÖValidate an RRset against a single signature rdata, throwing an exception if validation is not successful. *rrset*, the RRset to validate. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *rrsig*, a ``dns.rdata.Rdata``, the signature to validate. *keys*, the key dictionary, used to find the DNSKEY associated with a given name. The dictionary is keyed by a ``dns.name.Name``, and has ``dns.node.Node`` or ``dns.rdataset.Rdataset`` values. *origin*, a ``dns.name.Name`` or ``None``, the origin to use for relative names. *now*, a ``float`` or ``None``, the time, in seconds since the epoch, to use as the current time when validating. If ``None``, the actual current time is used. *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. Raises ``ValidationFailure`` if the signature is expired, not yet valid, the public key is invalid, the algorithm is unknown, the verification fails, etc. Raises ``UnsupportedAlgorithm`` if the algorithm is recognized by dnspython but not implemented. Nz unknown keyZexpiredz not yet validzverify failure) r^r…rÚtimeÚ expirationÚ inceptionÚ_make_rrsig_signature_datarFr�Ú signatureÚInvalidSignature) r†rxrwrYr�rZZcandidate_keysrŠZ candidate_keyr!r!r"Ú_validate_rrsigNs*(      r—)r†ÚrrsigsetrwrYr�rZrc Csæ|dur t}t|tƒr(tj |tjj¡}t|tƒr<|d}n|j}t|tƒr^|d}|d}n |j}|}| |¡}| |¡}||krŒt dƒ‚|D]H} t| t ƒs¦t dƒ‚zt || ||||ƒWdSt t fyÖYq�0q�t dƒ‚dS)a¹Validate an RRset against a signature RRset, throwing an exception if none of the signatures validate. *rrset*, the RRset to validate. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *rrsigset*, the signature RRset. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *keys*, the key dictionary, used to find the DNSKEY associated with a given name. The dictionary is keyed by a ``dns.name.Name``, and has ``dns.node.Node`` or ``dns.rdataset.Rdataset`` values. *origin*, a ``dns.name.Name``, the origin to use for relative names; defaults to None. *now*, an ``int`` or ``None``, the time, in seconds since the epoch, to use as the current time when validating. If ``None``, the actual current time is used. *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. Raises ``ValidationFailure`` if the signature is expired, not yet valid, the public key is invalid, the algorithm is unknown, the verification fails, etc. Nrr3zowner names do not matchzexpected an RRSIGzno RRSIGs validated) r^r'r)rerXr Úrootr‡Zchoose_relativityrrr—r) r†r˜rwrYr�rZÚrrnameZ rrsignameZ rrsigrdatasetrxr!r!r"Ú _validate“s2'        r›) r†Ú private_keyr�Údnskeyr“r’Úlifetimer�rZrYrc  Csx|dur t}| |¡st‚t|tƒrL|dj} |dj} |d} |dj} n|j} |j} |j} |j} |durvt |ƒ}n t t   ¡ƒ}|dur”t |ƒ}n|dur¦||}nt dƒ‚| durÀ|   | ¡} t| ƒd}|  ¡rÜ|d8}t| tjj| |j|| ||t|ƒ|dd� }tj ||| ¡}t|tƒ�r&|}n4zt|ƒ}||d�}Wnt�yXtdƒ‚Yn0| ||¡}tt|j|d �ƒS) aSign RRset using private key. *rrset*, the RRset to validate. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *private_key*, the private key to use for signing, a ``cryptography.hazmat.primitives.asymmetric`` private key class applicable for DNSSEC. *signer*, a ``dns.name.Name``, the Signer's name. *dnskey*, a ``DNSKEY`` matching ``private_key``. *inception*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature inception time. If ``None``, the current time is used. If a ``str``, the format is "YYYYMMDDHHMMSS" or alternatively the number of seconds since the UNIX epoch in text form; this is the same the RRSIG rdata's text form. Values of type `int` or `float` are interpreted as seconds since the UNIX epoch. *expiration*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature expiration time. If ``None``, the expiration time will be the inception time plus the value of the *lifetime* parameter. See the description of *inception* above for how the various parameter types are interpreted. *lifetime*, an ``int`` or ``None``, the signature lifetime in seconds. This parameter is only meaningful if *expiration* is ``None``. *verify*, a ``bool``. If set to ``True``, the signer will verify signatures after they are created; the default is ``False``. *policy*, a ``dns.dnssec.Policy`` or ``None``. If ``None``, the default policy, ``dns.dnssec.default_policy`` is used; this policy defaults to that of RFC 8624. *origin*, a ``dns.name.Name`` or ``None``. If ``None``, the default, then all names in the rrset (including its owner name) must be absolute; otherwise the specified origin will be used to make names absolute when signing. Raises ``DeniedByPolicy`` if the signature is denied by policy. Nr3rz(expiration or lifetime must be specifiedó) rrrsZ type_coveredr6ÚlabelsÚ original_ttlr’r“rtr�r•©r.zUnsupported key algorithm)r•)r^rErr'r‡rrrsÚttlrXr,r(r‘raÚ derelativizer9Úis_wildrrermr6r=Údnssecr”rr‹rr+Úsignr Úreplace)r†rœr�r�r“r’ržr�rZrYrrrsršr¡Zrrsig_inceptionZrrsig_expirationr Zrrsig_templaterŠZ signing_keyZ private_clsr•r!r!r"Ú_signÜsb5           õ  r©)r†rxrYrcs‚tˆtƒrtj ˆtjj¡‰|j}| ¡sDˆdur:tdƒ‚|  ˆ¡}t |ƒ\}}d}||j |d�dd…7}||j  |¡7}| ¡sžˆdur”tdƒ‚|  ˆ¡}t |ƒ}| ¡rÄ|j|dkrÄtdƒ‚|d|jkrÜtd ƒ‚n2|j|dk�r| |jd¡d}tj d |¡}|  ¡} t d |j|j|j¡} ‡fd d „|Dƒ} t| ƒD]6} || 7}|| 7}t dt | ƒ¡} || 7}|| 7}�qF|S)aáCreate signature rdata. *rrset*, the RRset to sign/validate. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *rrsig*, a ``dns.rdata.Rdata``, the signature to validate, or the signature template used when signing. *origin*, a ``dns.name.Name`` or ``None``, the origin to use for relative names. Raises ``UnsupportedAlgorithm`` if the algorithm is recognized by dnspython but not implemented. Nz,relative RR name without an origin specifiedrŸr]ér2z&wild owner name has wrong label lengthr3z#owner name longer than RRSIG labelsÚ*z!HHIcsg|]}| ˆ¡‘qSr!)Ú to_digestable)r}r:r]r!r"r‹rŸz._make_rrsig_signature_data..z!H)r'r)rerXr r™r�Ú is_absoluterr¤rˆr5r¬r9r¥r Úsplitrirjrsrrr¡Úsorted)r†rxrYr�ršr„rŠZname_lenÚsuffixZ rrnamebufZrrfixedZrdatasr:Zrrlenr!r]r"r”UsB       r”ry)rŽr6rzr|rcCsDt |¡}t|tƒr"|j||d�St|ƒj}||d�j||d�SdS)a€Convert a public key to DNSKEY Rdata *public_key*, a ``PublicKey`` (``GenericPublicKey`` or ``cryptography.hazmat.primitives.asymmetric``) to convert. *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. *flags*: DNSKEY flags field as an integer. *protocol*: DNSKEY protocol field as an integer. Raises ``ValueError`` if the specified key algorithm parameters are not unsupported, ``TypeError`` if the key type is unsupported, `UnsupportedAlgorithm` if the algorithm is unknown and `AlgorithmKeyMismatch` if the algorithm does not match the key type. Return DNSKEY ``Rdata``. )rzr|r¢N)r Zmaker'rZ to_dnskeyÚget_algorithm_clsrŒ)rŽr6rzr|rŒr!r!r"Ú _make_dnskey–s    r²cCs0t||||ƒ}t|jtjj|j|j|j|jd�S)a•Convert a public key to CDNSKEY Rdata *public_key*, the public key to convert, a ``cryptography.hazmat.primitives.asymmetric`` public key class applicable for DNSSEC. *algorithm*, a ``str`` or ``int`` specifying the DNSKEY algorithm. *flags*: DNSKEY flags field as an integer. *protocol*: DNSKEY protocol field as an integer. Raises ``ValueError`` if the specified key algorithm parameters are not unsupported, ``TypeError`` if the key type is unsupported, `UnsupportedAlgorithm` if the algorithm is unknown and `AlgorithmKeyMismatch` if the algorithm does not match the key type. Return CDNSKEY ``Rdata``. ©rrrsrzr|r6r.) r²rrrrermrzr|r6r.)rŽr6rzr|r�r!r!r"Ú _make_cdnskey¸súr´)ÚdomainÚsaltÚ iterationsr6rc Cst dd¡}zt|tƒr$t| ¡}Wnty@tdƒ‚Yn0|tjkrTtdƒ‚|durbd}n4t|tƒr’t|ƒddkrˆt   |¡}q–tdƒ‚n|}t|t j j ƒs°t j  |¡}| ¡ ¡}|dusÈJ‚t ||¡ ¡}t|ƒD]}t ||¡ ¡}qât |¡ d ¡} |  |¡} | S) aà Calculate the NSEC3 hash, according to https://tools.ietf.org/html/rfc5155#section-5 *domain*, a ``dns.name.Name`` or ``str``, the name to hash. *salt*, a ``str``, ``bytes``, or ``None``, the hash salt. If a string, it is decoded as a hex string. *iterations*, an ``int``, the number of iterations. *algorithm*, a ``str`` or ``int``, the hash algorithm. The only defined algorithm is SHA1. Returns a ``str``, the encoded NSEC3 hash. Z ABCDEFGHIJKLMNOPQRSTUVWXYZ234567Z 0123456789ABCDEFGHIJKLMNOPQRSTUVz-Wrong hash algorithm (only SHA1 is supported)NrŸr2rzInvalid salt lengthzutf-8)r)Ú maketransr'r r_r`rarbr9ÚbytesÚfromhexrerXÚNamer rfr5rcrdrhr8Úbase64Z b32encodeÚdecodeÚ translate) rµr¶r·r6Zb32_conversionZ salt_encodedZdomain_encodedrhrBÚoutputr!r!r"Ú nsec3_hashÞs6ÿ           rÀ)r†Ú algorithmsrYrc Cst|ƒ\}}|jtjjtjjtjjfvr0tdƒ‚tƒ}|D]H}zt |t ƒrVt |  ¡}Wnt yvtd|ƒ‚Yn0| |¡q:|jtjjkrÜg}t|ƒD]}|j|vrž| |¡qžt|ƒdkrÌtdƒ‚tj |j|¡Sg}|D]}| t||||ƒ¡qätj |j|¡S)aCreate a DS record from DNSKEY/CDNSKEY/CDS. *rrset*, the RRset to create DS Rdataset for. This can be a ``dns.rrset.RRset`` or a (``dns.name.Name``, ``dns.rdataset.Rdataset``) tuple. *algorithms*, a set of ``str`` or ``int`` specifying the hash algorithms. The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case does not matter for these strings. If the RRset is a CDS, only digest algorithms matching algorithms are accepted. *origin*, a ``dns.name.Name`` or ``None``. If `key` is a relative name, then it will be made absolute using the specified origin. Raises ``UnsupportedAlgorithm`` if any of the algorithms are unknown and ``ValueError`` if the given RRset is not usable. Returns a ``dns.rdataset.Rdataset`` zrrset not a DNSKEY/CDNSKEY/CDSr\rzno acceptable CDS rdata found)rˆrsrermrrrraÚsetr'r)r r_r`rÚaddÚcds_rdataset_to_ds_rdatasetruÚappendr9r„Úfrom_rdata_listr£ÚextendÚdnskey_rdataset_to_cds_rdataset) r†rÁrYršr„Z _algorithmsr6Úresr:r!r!r"Úmake_ds_rdatasets6 ý       rÊ)r„rc Cs\|jtjjkrtdƒ‚g}|D],}| t|jtjj|j|j |j |j d�¡qtj   |j|¡S)zÊCreate a CDS record from DS. *rdataset*, a ``dns.rdataset.Rdataset``, to create DS Rdataset for. Raises ``ValueError`` if the rdataset is not CDS. Returns a ``dns.rdataset.Rdataset`` zrdataset not a CDSrq)rsrermrrarÅrrrrtr6rurhr„rÆr£©r„rÉr:r!r!r"rÄUs úÿ rÄ)rXr„r6rYrcCsP|jtjjtjjfvrtdƒ‚g}|D]}| t||||ƒ¡q&tj  |j |¡S)a±Create a CDS record from DNSKEY/CDNSKEY. *name*, a ``dns.name.Name`` or ``str``, the owner name of the CDS record. *rdataset*, a ``dns.rdataset.Rdataset``, to create DS Rdataset for. *algorithm*, a ``str`` or ``int`` specifying the hash algorithm. The currently supported hashes are "SHA1", "SHA256", and "SHA384". Case does not matter for these strings. *origin*, a ``dns.name.Name`` or ``None``. If `key` is a relative name, then it will be made absolute using the specified origin. Raises ``UnsupportedAlgorithm`` if the algorithm is unknown or ``ValueError`` if the rdataset is not DNSKEY/CDNSKEY. Returns a ``dns.rdataset.Rdataset`` zrdataset not a DNSKEY/CDNSKEY) rsrermrrrarÅrvr„rÆr£)rXr„r6rYrÉr:r!r!r"rÈrs rÈc CsZ|jtjjkrtdƒ‚g}|D]*}| t|j|j|j|j |j |j d�¡qtj   |j|¡S)z Create a CDNSKEY record from DNSKEY. *rdataset*, a ``dns.rdataset.Rdataset``, to create CDNSKEY Rdataset for. Returns a ``dns.rdataset.Rdataset`` zrdataset not a DNSKEYr³)rsrermrrarÅrrrrzr|r6r.r„rÆr£rËr!r!r"Ú#dnskey_rdataset_to_cdnskey_rdataset“s úÿ rÌ) Útxnr†r�ÚksksÚzsksr“r’ržrZrYrc  Csr|jttjjjtjjjtjjjgƒvr,|} n|} | D]8\} } tjj || | |||||| d� } |  |j |j | ¡q4dS)zDefault RRset signer) r†rœr�r“r’ržr�rZrYN) rsrÂrermÚ RdataTyperrrr¦r§rÃrXr£)rÍr†r�rÎrÏr“r’ržrZrYrwrœr�rxr!r!r"Údefault_rrset_signer®s*ýÿ ÷ rÑT) ÚzonerÍrwÚ add_dnskeyÚ dnskey_ttlr“r’ržÚnsec3Ú rrset_signerrZrc  CsBg} g} |rN|D]*} | djtj@r0|  | ¡q|  | ¡q| sD|} | sR|} ng}|rbt |¡}n| ¡}|�¾}|rÐ|dur²| |jt j j ¡}|rš|j }n| |jt j j ¡}|j }|D]\}}| |j||¡q¶|rÞtdƒ‚n@| �ptjt|j| | |||| |jd� }t|||ƒWdƒSWdƒn1�s40YdS)a?Sign zone. *zone*, a ``dns.zone.Zone``, the zone to sign. *txn*, a ``dns.transaction.Transaction``, an optional transaction to use for signing. *keys*, a list of (``PrivateKey``, ``DNSKEY``) tuples, to use for signing. KSK/ZSK roles are assigned automatically if the SEP flag is used, otherwise all RRsets are signed by all keys. *add_dnskey*, a ``bool``. If ``True``, the default, all specified DNSKEYs are automatically added to the zone on signing. *dnskey_ttl*, a``int``, specifies the TTL for DNSKEY RRs. If not specified the TTL of the existing DNSKEY RRset used or the TTL of the SOA RRset. *inception*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature inception time. If ``None``, the current time is used. If a ``str``, the format is "YYYYMMDDHHMMSS" or alternatively the number of seconds since the UNIX epoch in text form; this is the same the RRSIG rdata's text form. Values of type `int` or `float` are interpreted as seconds since the UNIX epoch. *expiration*, a ``datetime``, ``str``, ``int``, ``float`` or ``None``, the signature expiration time. If ``None``, the expiration time will be the inception time plus the value of the *lifetime* parameter. See the description of *inception* above for how the various parameter types are interpreted. *lifetime*, an ``int`` or ``None``, the signature lifetime in seconds. This parameter is only meaningful if *expiration* is ``None``. *nsec3*, a ``NSEC3PARAM`` Rdata, configures signing using NSEC3. Not yet implemented. *rrset_signer*, a ``Callable``, an optional function for signing RRsets. The function requires two arguments: transaction and RRset. If the not specified, ``dns.dnssec.default_rrset_signer`` will be used. Returns ``None``. r3Nz&Signing with NSEC3 not yet implemented)r�rÎrÏr“r’ržrZrY)rzrZSEPrÅÚ contextlibÚ nullcontextÚwriterr€rYrermrr£ZSOArÃÚNotImplementedErrorÚ functoolsÚpartialrÑÚ_sign_zone_nsec)rÒrÍrwrÓrÔr“r’ržrÕrÖrZrÎrÏr.ÚcmZ_txnr�ZsoarBZ _rrset_signerr!r!r"Ú sign_zoneÖsN6      ÷ rß)rÒrÍrÖrc Cs8dtjjtjjttjjtjjttt ddœdd„}|  ¡j }d}d}t |  ¡ƒD]Ä}|rh| |¡rhqRn$| |tjj¡rˆ||jkrˆ|}nd}|rô| |¡}|rô|jD]N} | jtjjkrºq¤q¤|rÐ| jtjjkrÐq¤q¤tjj|| jg| ¢RŽ} ||| ƒq¤|du�r|||||j||ƒ|}qR|�r4||||j|j||ƒdS)zNSEC zone signerN)rÍrXÚ next_securerrr£rÖrc SsŽttjjjtjjjgƒ}| |¡}|rŠ|rŠtdd„|jDƒƒ|B}t  t |ƒ¡} tj   ||t|tjjj|| d�¡} |  | ¡|rŠ||| ƒdS)zNSEC zone signer helpercSsg|] }|j‘qSr!)rs)r}r„r!r!r"rVrŸz:_sign_zone_nsec.._txn_add_nsec..)rrrsÚnextÚwindowsN)rÂrermrÐrrÚget_nodeÚ rdatasetsrZ from_rdtypesÚlistr†Ú from_rdatarÃ) rÍrXràrrr£rÖZmandatory_typesr‚Útypesrâr†r!r!r"Ú _txn_add_nsecGs* ÿ ÿüý z&_sign_zone_nsec.._txn_add_nsec)N)reÚ transactionÚ TransactionrXr»rrkZ RdataClassr(Ú RRsetSignerZget_soaZminimumr¯Z iterate_namesZ is_subdomainr€rmZNSrYrãrärsrrr†rær£rr) rÒrÍrÖrèZ rrsig_ttlZ delegationZ last_securerXr‚r„r†r!r!r"rÝ@sH ú ù     ÿrÝcOs tdƒ‚dS)Nz.DNSSEC validation requires python cryptography)Ú ImportError)ÚargsÚkwargsr!r!r"Ú _need_pyca�sÿrïr¦)r–)Údsa)Úec)Úed448)Úrsa)Úed25519)r±r‹)rr)NNF)N)NNN)NNN)NNNFNN)N)N)N)NNNNN) NNTNNNNNNN)N)–Ú__doc__r¼r×rÛrcrir‘rÚtypingrrrrrrr r Z dns._featuresreZ dns.exceptionZdns.nameZdns.nodeZ dns.rdataZdns.rdataclassZ dns.rdatasetZ dns.rdatatypeZ dns.rrsetZdns.transactionZdns.zoneZdns.dnssectypesr r r rrrrZdns.rdtypes.ANY.CDNSKEYrZdns.rdtypes.ANY.CDSrZdns.rdtypes.ANY.DNSKEYrZdns.rdtypes.ANY.DSrZdns.rdtypes.ANY.NSECrrZdns.rdtypes.ANY.NSEC3PARAMrZdns.rdtypes.ANY.RRSIGrrZdns.rdtypes.dnskeybaserZ PublicKeyZ PrivateKeyrérêr†ZRRsetrër)r#r(r&r*r,r=r>rMr7ZDSAZ DSANSEC3SHA1ZECCGOSTZNULLrbZGOSTZrfc_8624_policyrÂZallow_all_policyr^rXr»r:ZRdatarLrprvr„ZRdatasetr‚rƒr…rˆr¹r�r—r›r©r”r{r²r´rÀrÊrÄrÈrÌrÑrÒZZonerßrÝrïZ _featuresZhaveZcryptography.exceptionsr–Z)cryptography.hazmat.primitives.asymmetricrðrñròrórôZdns.dnssecalgsr±r‹Zdns.dnssecalgs.baserrZvalidateZvalidate_rrsigr§Z make_dnskeyZ make_cdnskeyZ _have_pycaZDHZECCZRSASHA1ZRSASHA1NSEC3SHA1Z RSASHA256Z RSASHA512ZECDSAP256SHA256ZECDSAP384SHA384ZED25519ZED448ZINDIRECTZ PRIVATEDNSZ PRIVATEOIDr!r!r!r"Ús (      ÿÿ  üú  ù Pü  û %  þ þ  ú ù Iú ù Nö õ |ý ü Dü û %ü û ' û @ý ü ;þ !ü  û "þ !ö õ *õ ô mýü O