a
©!cu- ã @ sô d dl mZ d dl mZ d dl mZ d dlmZ d dlZd dlZd dlZd dl Z d dl
mZ d dlZ
d dlZ
e d¡ZdZG d d
„ d
e
jjƒZddd
„ZG dd„ deƒZG dd„ dƒZG dd„ dƒZG dd„ dƒZdd„ Zdd„ ZG dd„ dƒZdS )é )Úprint_function)Úabsolute_import)Úunicode_literals)ÚEnumN©Ú_Údnfé= c @ s e Zd ZdZdd„ ZdS )ÚDnssecErrorz-
Exception used in the dnssec module
c C s d | jd ur| jnd¡S )Nzz
Not specified)ÚformatÚvalue©Úself© r ú./usr/lib/python3.9/site-packages/dnf/dnssec.pyÚ__repr__- s ÿzDnssecError.__repr__N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r r r r r r
) s r
Ú_openpgpkeyc C s€ | dd¡}t|ƒdkr$d}t|ƒ‚|d }|d }t ¡ }| | d¡¡ t | ¡ dd… ¡
d¡ ¡ }|d | d | S ) z‘
Implements RFC 7929, section 3
https://tools.ietf.org/html/rfc7929#section-3
:param email_address:
:param tag:
:return:
ú@é é z0Email address must contain exactly one '@' sign.r zutf-8é Ú.)ÚrsplitÚlenr
ÚhashlibZsha256ÚupdateÚencodeÚbase64Z b16encodeÚdigestÚdecodeÚlower)Z
email_addressÚtagÚsplitÚmsgÚlocalÚdomainÚhashr" r r r Úemail2location2 s ÿr+ c @ s( e Zd ZdZdZdZdZdZdZdZ dS ) ÚValidityzå
Output of the verification algorithm.
TODO: this type might be simplified in order to less reflect the underlying DNS layer.
TODO: more specifically the variants from 3 to 5 should have more understandable names
r r é é é é N)
r r r r ÚVALIDÚREVOKEDÚPROVEN_NONEXISTENCEÚRESULT_NOT_SECUREÚBOGUS_RESULTÚERRORr r r r r, J s r, c @ s e Zd ZdZdS )ÚNoKeyzŠ
This class represents an absence of a key in the cache. It is an expression of non-existence
using the Python's type system.
N)r r r r r r r r r7 X s r7 c @ s. e Zd ZdZd dd„Zdd„ Zedd„ ƒZdS )
ÚKeyInfozv
Wrapper class for email and associated verification key, where both are represented in
form of a string.
Nc C s || _ || _d S )N)ÚemailÚkey)r r9 r: r r r Ú__init__e s zKeyInfo.__init__c C s d | j| j d¡d d… ¡S )NzKeyInfo("{}", "{}...")Úasciié )r r9 r: r# r
r r r r i s zKeyInfo.__repr__c C s˜ t d| ¡}|du rt‚| d¡}| d¡ d¡}d}d}tdt|ƒƒD ]$}|| dkr\|}|| dkrH|}qHd ||d
|d … ¡ d¡}t
||ƒS )z”
Since dnf uses different format of the key than the one used in DNS RR, I need to convert
the former one into the new one.
ú <(.*@.*)>Nr r<