public static byte[] signJwsRSASha512(final Key key, final byte[] value, final Map<String, Object> headers) {
        return JsonWebTokenSigner.builder()
            .key(key)
            .headers(headers)
            .algorithm(AlgorithmIdentifiers.RSA_USING_SHA512)
            .build()
            .sign(value);
    }
Sign jws.

@param key     the key
@param value   the value
@param headers the headers
@return the byte []
core/cas-server-core-util-api/src/main/java/org/apereo/cas/util/EncodingUtils.java