code: def _raw_to_der(self, raw_signature):
          
          component_length = self._sig_component_length()
          if len(raw_signature) != int(2 * component_length):
              raise ValueError("Invalid signature")
  
          r_bytes = raw_signature[:component_length]
          s_bytes = raw_signature[component_length:]
          r = int_from_bytes(r_bytes, "big")
          s = int_from_bytes(s_bytes, "big")
          return encode_dss_signature(r, s)
docs: Convert signature from RAW encoding to DER encoding.