def _serializePrelude(self): writer = TlsStructureWriter(Tack.LENGTH - 64) writer.add(self.public_key.getRawKey(), 64) writer.add(self.min_generation, 1) writer.add(self.generation, 1) writer.add(self.expiration, 4) writer.add(self.target_hash, 32) return writer.getBytes()
def serialize(self): w = TlsStructureWriter(self._getSerializedLength()) if self.tacks: w.add(len(self.tacks) * Tack.LENGTH, 2) for tack in self.tacks: w.add(tack.serialize(), Tack.LENGTH) else: w.add(0, 2) w.add(self.activation_flags, 1) return w.getBytes()
def serialize(self): """Return a bytearray containing the TACK_Break_Sig.""" w = TlsStructureWriter(TackBreakSig.LENGTH) w.add(self.public_key.getRawKey(), 64) w.add(self.signature, 64) assert (w.index == len(w.bytes)) return w.getBytes()
def serialize(self): """Return a bytearray containing the TACK_Break_Sig.""" w = TlsStructureWriter(TackBreakSig.LENGTH) w.add(self.public_key.getRawKey(), 64) w.add(self.signature, 64) assert(w.index == len(w.bytes)) return w.getBytes()
def _serializePreSig(self): writer = TlsStructureWriter(Tack.LENGTH - 64) writer.add(self.public_key.getRawKey(), 64) writer.add(self.min_generation, 1) writer.add(self.generation, 1) writer.add(self.expiration, 4) writer.add(self.target_hash, 32) return writer.getBytes()
def serialize(self): w = TlsStructureWriter(self._getSerializedLength()) if self.tack: w.add(Tack.LENGTH, 1) w.add(self.tack.serialize(), Tack.LENGTH) else: w.add(0, 1) if self.break_sigs: w.add(len(self.break_sigs) * TackBreakSig.LENGTH, 2) for break_sig in self.break_sigs: w.add(break_sig.serialize(), TackBreakSig.LENGTH) else: w.add(0, 2) w.add(self.pin_activation, 1) assert(w.index == len(w.bytes)) # did we fill entire bytearray? return w.getBytes()
def serialize(self): w = TlsStructureWriter(TackKeyFile.LENGTH) w.add(self.version, 1) w.add(self.iter_count, 4) w.add(self.salt, 16) w.add(self.ciphertext, 32) w.add(self.public_key.getRawKey(), 64) w.add(self.mac, 32) return w.getBytes()
def serialize(self, extenderFormat=False): assert (self.tacks) w = TlsStructureWriter(self._getSerializedLength(extenderFormat)) if extenderFormat: w.add(62208, 2) w.add(len(self.tacks) * Tack.LENGTH + 3, 2) w.add(len(self.tacks) * Tack.LENGTH, 2) for tack in self.tacks: w.add(tack.serialize(), Tack.LENGTH) w.add(self.activation_flags, 1) return w.getBytes()
def serialize(self): w = TlsStructureWriter(self._getSerializedLength()) if self.tack: w.add(Tack.LENGTH, 1) w.add(self.tack.serialize(), Tack.LENGTH) else: w.add(0, 1) if self.break_sigs: w.add(len(self.break_sigs) * TackBreakSig.LENGTH, 2) for break_sig in self.break_sigs: w.add(break_sig.serialize(), TackBreakSig.LENGTH) else: w.add(0, 2) w.add(self.pin_activation, 1) return w.getBytes()
def serialize(self): writer = TlsStructureWriter(64) writer.add(self.signature, 64) return self._serializePrelude() + writer.getBytes()
def serialize(self): w = TlsStructureWriter(TackKeyFile.LENGTH) w.add(self.version, 1) w.add(self.iter_count, 4) w.add(self.salt, 16) w.add(self.ciphertext, 32) w.add(self.public_key.getRawKey(), 64) w.add(self.mac, 32) assert (w.index == len(w.bytes)) # did we fill entire bytearray? return w.getBytes()
def serialize(self, extenderFormat=False): assert(self.tacks) w = TlsStructureWriter(self._getSerializedLength(extenderFormat)) if extenderFormat: w.add(62208, 2) w.add(len(self.tacks) * Tack.LENGTH + 3, 2) w.add(len(self.tacks) * Tack.LENGTH, 2) for tack in self.tacks: w.add(tack.serialize(), Tack.LENGTH) w.add(self.activation_flags, 1) return w.getBytes()
def serialize(self): w = TlsStructureWriter(TackKeyFile.LENGTH) w.add(self.version, 1) w.add(self.iter_count, 4) w.add(self.salt, 16) w.add(self.ciphertext, 32) w.add(self.public_key.getRawKey(), 64) w.add(self.mac, 32) assert(w.index == len(w.bytes)) # did we fill entire bytearray? return w.getBytes()