1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 import struct
17
18 import dns.rdata
19 import dns.rdatatype
20
21 -class SSHFP(dns.rdata.Rdata):
22 """SSHFP record
23
24 @ivar algorithm: the algorithm
25 @type algorithm: int
26 @ivar fp_type: the digest type
27 @type fp_type: int
28 @ivar fingerprint: the fingerprint
29 @type fingerprint: string
30 @see: draft-ietf-secsh-dns-05.txt"""
31
32 __slots__ = ['algorithm', 'fp_type', 'fingerprint']
33
34 - def __init__(self, rdclass, rdtype, algorithm, fp_type,
35 fingerprint):
40
41 - def to_text(self, origin=None, relativize=True, **kw):
42 return '%d %d %s' % (self.algorithm,
43 self.fp_type,
44 dns.rdata._hexify(self.fingerprint,
45 chunksize=128))
46
47 - def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
54
55 from_text = classmethod(from_text)
56
57 - def to_wire(self, file, compress = None, origin = None):
61
62 - def from_wire(cls, rdclass, rdtype, wire, current, rdlen, origin = None):
63 header = struct.unpack("!BB", wire[current : current + 2])
64 current += 2
65 rdlen -= 2
66 fingerprint = wire[current : current + rdlen]
67 return cls(rdclass, rdtype, header[0], header[1], fingerprint)
68
69 from_wire = classmethod(from_wire)
70
71 - def _cmp(self, other):
78