Exemplo n.º 1
0
 private void RemovePrivateKeys(JsonWebKeyType jsonWebKeyType)
 {
     foreach (var securityKeyWithPrivate in _store.Get(jsonWebKeyType, _options.Value.AlgorithmsToKeep))
     {
         _store.Revoke(securityKeyWithPrivate);
     }
 }
Exemplo n.º 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(JsonWebKeyType.Jws, options.Value.AlgorithmsToKeep))
            {
                store.Revoke(securityKeyWithPrivate);
            }

            keyService.GenerateSigningCredentials();
            await httpContext.Response.CompleteAsync();
        }
        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();
        }
    public async Task Should_Remove_Private_Key_And_Update(string algorithm)
    {
        var alg         = Algorithm.Create(algorithm);
        var key         = new CryptographicKey(alg);
        var keyMaterial = new KeyMaterial(key);
        await _store.Store(keyMaterial);

        /*Remove private*/
        await _store.Revoke(keyMaterial);

        var current = await _store.Get(keyMaterial.KeyId);

        current.GetSecurityKey().HasPrivateKey.Should().BeFalse();
    }