private string CreateJwt(string clientId, PrivateKeyWrapper keyWrapper, string username, string audience) =>
 Jwt.Jwt.CreateJwt(keyWrapper)
 .AddExpiration(DateTime.UtcNow)
 .AddSubject(username)
 .AddAudience(audience)
 .AddConsumerKey(clientId)
 .Build();
Пример #2
0
        public static byte[] CreateSignature(PrivateKeyWrapper privateKeyWrapper, byte[] bytesToSign)
        {
            var sig = SignerUtilities.GetSigner("SHA" + 256 + "withRSA");

            sig.Init(
                true,
                new RsaKeyParameters(
                    true,
                    privateKeyWrapper.Modulus,
                    privateKeyWrapper.Exponent
                    )
                );
            sig.BlockUpdate(bytesToSign, 0, bytesToSign.Length);
            return(sig.GenerateSignature());
        }
Пример #3
0
 public static Jwt CreateJwt(PrivateKeyWrapper privateKeyWrapper) => new Jwt(privateKeyWrapper);
Пример #4
0
 private Jwt(PrivateKeyWrapper privateKeyWrapper)
 {
     _privateKeyWrapper = privateKeyWrapper;
 }