JWT creation using RS256

I’m trying to create a JWT using RS256. I’ve generated a public and private certificates.
.NET core is used to create the JWT. The following are the steps that I’m using to create the JWT.

var header = base64URLencode(HeaderDetails);
var payload = base64URLencode(payloadDetails);
var headerandpayload = header + “.” + payload;

var signature = base64URLencode(RSASHA256(headerandpayload, RSAprivateKey));

var encodedJWT = headerandpayload + “.” + signature;

When I try to validate the JWT using the debugger in jwt.io, the signature part in JWT changes when I provide the private key in the textarea. Though I get the message as a “Valid signature”, I’m not sure why the signature part of the JWT should change?

I have the same issue, did you manage to get this working?