Esempio n. 1
0
        public SigningCredentials GenerateSigningCredentials(JwksOptions options = null)
        {
            if (options == null)
            {
                options = _options.Value;
            }
            var key = _jwkService.Generate(options.Jws);
            var t   = new SecurityKeyWithPrivate();

            t.SetJwsParameters(key, options.Jws);
            _store.Save(t);

            return(new SigningCredentials(key, options.Jws));
        }
Esempio n. 2
0
        public void ShouldRemovePrivateAndUpdate(string algorithm, KeyType keyType)
        {
            var alg = Algorithm.Create(algorithm, keyType);
            var key = _keyService.Generate(new JwksOptions()
            {
                KeyPrefix = "ShouldGenerateManyRsa_", Algorithm = alg
            });
            var privateKey = new SecurityKeyWithPrivate();

            privateKey.SetParameters(key.Key, alg);
            _jsonWebKeyStore.Save(privateKey);

            /*Remove private*/
            privateKey.SetParameters();
            _jsonWebKeyStore.Update(privateKey);
        }