code: static String toSignedBase64(SignableSAMLObject signableObj,
                                   Credential signingCredential,
                                   String signatureAlgorithm) {
          sign(signableObj, signingCredential, signatureAlgorithm);
          final String messageStr = nodeToString(serialize(signableObj));
          return Base64.getEncoder().encodeToString(messageStr.getBytes(StandardCharsets.UTF_8));
      }
docs: Signs the specified {@link SignableSAMLObject} with the specified {@link Credential} and
  {@code signatureAlgorithm}, and then encodes the object into a base64 string.