예제 #1
0
        public void Register(
            CipherSuite suite,
            TLSCipherAlgorithm cipher,
            TLSHashAlgorithm digest,
            TLSSignatureAlgorithm signature,
            TLSKeyExchange exchange)
        {
            _suites.Add(suite);

            _cipherMapping.Add(suite, cipher);
            _hashMapping.Add(suite, digest);
            _signatureMapping.Add(suite, signature);
            _keyExchangeMapping.Add(suite, exchange);
        }
예제 #2
0
        public static IServiceCollection RegisterCipherSuite(
            this IServiceCollection serviceCollection,
            CipherSuite suite,
            TLSCipherAlgorithm cipher,
            TLSHashAlgorithm digest,
            TLSSignatureAlgorithm signature,
            TLSKeyExchange exchange)
        {
            return(serviceCollection.Update <CipherSuitesRegistry>(prev =>
            {
                prev = prev ?? new CipherSuitesRegistry();

                prev.Register(
                    suite: suite,
                    cipher: cipher,
                    digest: digest,
                    signature: signature,
                    exchange: exchange);

                return prev;
            }));
        }
예제 #3
0
        public static IServiceCollection RegisterKeyExchange <T>(this IServiceCollection serviceCollection, TLSKeyExchange keyExchange)
            where T : class, IKeyExchange
        {
            serviceCollection.AddTransient <T>();

            return(serviceCollection.Update <KeyExchangeRegistry>(prev =>
            {
                prev = prev ?? new KeyExchangeRegistry();

                prev.Register(keyExchange, sp => sp.GetRequiredService <T>());

                return prev;
            }));
        }
 public bool IsSupported(TLSKeyExchange keyExchange)
 {
     return(_keyExchangeRegistry.IsSupported(keyExchange));
 }
 public IKeyExchange Create(TLSKeyExchange keyExchange)
 {
     return(_keyExchangeRegistry.Resolve(_serviceProvider, keyExchange));
 }