public void NoKeyMaterial()
        {
            KeyVaultKey key = new KeyVaultKey();

            ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(key);

            Assert.IsNull(provider);
        }
        public void Create(JsonWebKey jwk, Type clientType)
        {
            ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(new KeyVaultKey {
                Key = jwk
            });

            Assert.IsInstanceOf(clientType, provider, "Key {0} of type {1} did not yield client type {2}", jwk.Id, jwk.KeyType, clientType.Name);
        }
Exemple #3
0
        public void CreateThrows()
        {
            JsonWebKey jwk = new JsonWebKey
            {
                KeyId   = "invalid",
                KeyType = new KeyType("invalid"),
            };

            Assert.Throws <NotSupportedException>(() => LocalCryptographyProviderFactory.Create(jwk));
        }
        public void NoOctKeyMaterial()
        {
            JsonWebKey jwk = new(new[] { KeyOperation.WrapKey, KeyOperation.UnwrapKey })
            {
                KeyType = KeyType.OctHsm,
            };

            ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(jwk, null);

            Assert.IsNull(provider);
        }
        public void NotSupported()
        {
            JsonWebKey jwk = new JsonWebKey
            {
                Id      = "test",
                KeyType = new KeyType("invalid"),
            };

            ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(new KeyVaultKey {
                Key = jwk
            });

            Assert.IsNull(provider);
        }
Exemple #6
0
        public void Create(JsonWebKey jwk, Type clientType)
        {
            ICryptographyProvider client = LocalCryptographyProviderFactory.Create(jwk);

            Assert.IsInstanceOf(clientType, client, "Key {0} of type {1} did not yield client type {2}", jwk.KeyId, jwk.KeyType, clientType.Name);
        }
        public void NoKey()
        {
            ICryptographyProvider provider = LocalCryptographyProviderFactory.Create(null);

            Assert.IsNull(provider);
        }