예제 #1
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);
        }
예제 #2
0
 private void RemovePrivateKeys()
 {
     foreach (var securityKeyWithPrivate in _store.Get(_options.Value.AlgorithmsToKeep))
     {
         securityKeyWithPrivate.SetParameters();
         _store.Update(securityKeyWithPrivate);
     }
 }
        public async Task Invoke(HttpContext httpContext, IJsonWebKeySetService keyService, IJsonWebKeyStore store, IOptions <JwksOptions> options)
        {
            foreach (var securityKeyWithPrivate in store.Get(options.Value.AlgorithmsToKeep))
            {
                securityKeyWithPrivate.SetParameters();
                store.Update(securityKeyWithPrivate);
            }

            keyService.Generate();
            await httpContext.Response.CompleteAsync();
        }