docs: def sign(self, msg):
          '''
          Sign a message (digest) using the private key
  
          :param str msg: The message (digest) to sign
          :rtype: str
          :return: The signature, or an empty string if the encryption failed
          '''
          # Allocate a buffer large enough for the signature. Freed by ctypes.
          buf = create_string_buffer(libcrypto.RSA_size(self._rsa))
          msg = salt.utils.stringutils.to_bytes(msg)
          size = libcrypto.RSA_private_encrypt(len(msg), msg, buf, self._rsa, RSA_X931_PADDING)
          if size < 0:
              raise ValueError('Unable to encrypt message')
          return buf[0:size]