1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 import base64
19
20 import dns.exception
21 import dns.rdata
22 import dns.tokenizer
25
26 """OPENPGPKEY record
27
28 @ivar key: the key
29 @type key: bytes
30 @see: RFC 7929
31 """
32
33 - def __init__(self, rdclass, rdtype, key):
36
37 - def to_text(self, origin=None, relativize=True, **kw):
38 return dns.rdata._base64ify(self.key)
39
40 @classmethod
41 - def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
42 chunks = []
43 while 1:
44 t = tok.get().unescape()
45 if t.is_eol_or_eof():
46 break
47 if not t.is_identifier():
48 raise dns.exception.SyntaxError
49 chunks.append(t.value.encode())
50 b64 = b''.join(chunks)
51 key = base64.b64decode(b64)
52 return cls(rdclass, rdtype, key)
53
54 - def to_wire(self, file, compress=None, origin=None):
56
57 @classmethod
58 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin=None):
61