Exemplo n.º 1
0
def make_revocation_key_subpacket(fingerprint, pub_algorithm_type,
                                  sensitive=False, critical=False,
                                  hashed=True):
    data = bytearray([0x80 + (0x40 if sensitive else 0x00),
                      pub_algorithm_type])
    data.extend(utils.hex_to_bytes(fingerprint, 20))
    return make_signature_subpacket(12, data, critical, hashed)
Exemplo n.º 2
0
    def content(self):
        hash_length = utils.hash_lengths.get(self.hash_algorithm, None)
        if hash_length is None:
            hash_length = self.hash_length

        return bytearray(
            [int(self.public_key_algorithm), int(self.hash_algorithm)] + utils.hex_to_bytes(self.hash, hash_length)
        )
Exemplo n.º 3
0
def make_revocation_key_subpacket(fingerprint,
                                  pub_algorithm_type,
                                  sensitive=False,
                                  critical=False,
                                  hashed=True):
    data = bytearray(
        [0x80 + (0x40 if sensitive else 0x00), pub_algorithm_type])
    data.extend(utils.hex_to_bytes(fingerprint, 20))
    return make_signature_subpacket(12, data, critical, hashed)
Exemplo n.º 4
0
    def content(self):
        hash_length = utils.hash_lengths.get(self.hash_algorithm, None)
        if hash_length is None:
            hash_length = self.hash_length

        return bytearray([
            int(self.public_key_algorithm),
            int(self.hash_algorithm),
        ] + utils.hex_to_bytes(self.hash, hash_length))
Exemplo n.º 5
0
 def content(self):
     warnings.warn("The additional recipients request signature subpacket "
                   "type is deprecated.")
     data = bytearray([
         0x80 if self.strong_request else 0x00,
         self.public_key_algorithm,
     ])
     data.extend(utils.hex_to_bytes(self.fingerprint, 20))
     return data
Exemplo n.º 6
0
 def __bytes__(self):
     result = bytearray(
             [self.hash_algorithm] +
             b'GNU' +
             [self.mode - 1000]
             )
     if self.mode == 1002 and self.serial_number is not None:
         result.append(self.serial_number_length)
         result.extend(utils.hex_to_bytes(self.serial_number,
                                          self.serial_number_length))
     return bytes(result)
Exemplo n.º 7
0
def make_issuer_key_subpacket(key_id, critical=False, hashed=True):
    data = utils.hex_to_bytes(key_id, 8)
    return make_signature_subpacket(16, data, critical, hashed)
Exemplo n.º 8
0
 def content(self):
     data = bytearray(utils.hex_to_bytes(self.key_id, 8))
     return data
Exemplo n.º 9
0
def make_issuer_key_subpacket(key_id, critical=False, hashed=True):
    data = utils.hex_to_bytes(key_id, 8)
    return make_signature_subpacket(16, data, critical, hashed)
Exemplo n.º 10
0
 def content(self):
     data = bytearray(utils.hex_to_bytes(self.key_id, 8))
     return data
Exemplo n.º 11
0
 def content(self):
     warnings.warn("The additional recipients request signature subpacket " "type is deprecated.")
     data = bytearray([0x80 if self.strong_request else 0x00, self.public_key_algorithm])
     data.extend(utils.hex_to_bytes(self.fingerprint, 20))
     return data