Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Encrypting JWT Token

$
0
0

Hi All,

Can anybody help in getting me the code to encrypt the JWT Token in C Sharp? I could able to do the encoding but I want to encrypt payload and then generate JWT token.

I found the sample code in java but not in c sharp.

String token = Jwts.builder().setSubject("sgsdss")

                                .claim("dsfsd", "1234")

                                .setExpiration(new Date(System.currentTimeMillis() + tokenExpirationDuration))

                                .compressWith(CompressionCodecs.GZIP)

                                .signWith(SignatureAlgorithm.HS512, key)

                                .compact();

Here they are using GZIP to compress and then signwith. do we have similar functionality in c sharp?

Thanks.


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>