Ejemplo n.º 1
0
 def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
     flags = tok.get_uint16()
     protocol = tok.get_uint8()
     algorithm = dnssec.algorithm_from_text(tok.get_string())
     chunks = []
     while 1:
         t = tok.get().unescape()
         if t.is_eol_or_eof():
             break
         if not t.is_identifier():
             raise exception.SyntaxError
         chunks.append(t.value)
     b64 = ''.join(chunks)
     key = b64.decode('base64_codec')
     return cls(rdclass, rdtype, flags, protocol, algorithm, key)
Ejemplo n.º 2
0
 def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
     flags = tok.get_uint16()
     protocol = tok.get_uint8()
     algorithm = dnssec.algorithm_from_text(tok.get_string())
     chunks = []
     while 1:
         t = tok.get().unescape()
         if t.is_eol_or_eof():
             break
         if not t.is_identifier():
             raise exception.SyntaxError
         chunks.append(t.value)
     b64 = ''.join(chunks)
     key = b64.decode('base64_codec')
     return cls(rdclass, rdtype, flags, protocol, algorithm, key)
Ejemplo n.º 3
0
 def from_text(cls, rdclass, rdtype, tok, origin=None, relativize=True):
     certificate_type = _ctype_from_text(tok.get_string())
     key_tag = tok.get_uint16()
     algorithm = dnssec.algorithm_from_text(tok.get_string())
     if algorithm < 0 or algorithm > 255:
         raise exception.SyntaxError("bad algorithm type")
     chunks = []
     while 1:
         t = tok.get().unescape()
         if t.is_eol_or_eof():
             break
         if not t.is_identifier():
             raise exception.SyntaxError
         chunks.append(t.value)
     b64 = "".join(chunks)
     certificate = b64.decode("base64_codec")
     return cls(rdclass, rdtype, certificate_type, key_tag, algorithm, certificate)
Ejemplo n.º 4
0
Archivo: CERT.py Proyecto: v1cker/wiper
 def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
     certificate_type = _ctype_from_text(tok.get_string())
     key_tag = tok.get_uint16()
     algorithm = dnssec.algorithm_from_text(tok.get_string())
     if algorithm < 0 or algorithm > 255:
         raise exception.SyntaxError("bad algorithm type")
     chunks = []
     while 1:
         t = tok.get().unescape()
         if t.is_eol_or_eof():
             break
         if not t.is_identifier():
             raise exception.SyntaxError
         chunks.append(t.value)
     b64 = ''.join(chunks)
     certificate = b64.decode('base64_codec')
     return cls(rdclass, rdtype, certificate_type, key_tag,
                algorithm, certificate)
Ejemplo n.º 5
0
 def from_text(cls, rdclass, rdtype, tok, origin = None, relativize = True):
     type_covered = rdatatype.from_text(tok.get_string())
     algorithm = dnssec.algorithm_from_text(tok.get_string())
     labels = tok.get_int()
     original_ttl = tok.get_ttl()
     expiration = sigtime_to_posixtime(tok.get_string())
     inception = sigtime_to_posixtime(tok.get_string())
     key_tag = tok.get_int()
     signer = tok.get_name()
     signer = signer.choose_relativity(origin, relativize)
     chunks = []
     while 1:
         t = tok.get().unescape()
         if t.is_eol_or_eof():
             break
         if not t.is_identifier():
             raise exception.SyntaxError
         chunks.append(t.value)
     b64 = ''.join(chunks)
     signature = b64.decode('base64_codec')
     return cls(rdclass, rdtype, type_covered, algorithm, labels,
                original_ttl, expiration, inception, key_tag, signer,
                signature)