Ejemplo n.º 1
0
        public HandleClientFinishedState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            Connection connection,
            HandshakeWriter writer,
            HandshakeFinishedService handshakeFinishedService,

            VersionConfig versionConfig,
            CipherSuiteConfig cipherSuiteConfig,

            FinishedMessage handshake)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;

            _connection = connection;
            _writer     = writer;
            _handshakeFinishedService = handshakeFinishedService;


            _versionConfig     = versionConfig;
            _cipherSuiteConfig = cipherSuiteConfig;

            _handshake = handshake;
        }
        public static IReadOnlyCollection <CipherSuite> GetAllSupportedSuites(this ICipherSuitesProvider cipherSuiteProvider, CipherSuitesRegistry cipherSuitesRegistry)
        {
            var suites = cipherSuitesRegistry.GetAll();

            return(suites
                   .Where(cipherSuiteProvider.IsSupported)
                   .OrderByDescending(x => x)
                   .ToList());
        }
Ejemplo n.º 3
0
 public DefaultNegotiator(
     ICipherSuitesProvider cipherSuitesProvider,
     CertificateManager certificateManager,
     CipherSuiteConfig cipherSuiteConfig)
 {
     _cipherSuitesProvider = cipherSuitesProvider;
     _certificateManager   = certificateManager;
     _cipherSuiteConfig    = cipherSuiteConfig;
 }
Ejemplo n.º 4
0
        public WaitingForServerChangeCipherSpecState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            CipherSuiteConfig cipherSuiteConfig,
            Connection connection)
            : base(serviceProvider, connection)
        {
            _cipherSuitesProvider = cipherSuitesProvider;
            _cipherSuiteConfig    = cipherSuiteConfig;
        }
Ejemplo n.º 5
0
        public HandshakeReader(
            ICipherSuitesProvider cipherSuitesProvider,
            PublicKeyReaderRegistry publicKeyReaderRegistry,

            HandshakeConfig handshakeConfig,
            CipherSuiteConfig cipherSuiteConfig)
        {
            _cipherSuitesProvider    = cipherSuitesProvider;
            _publicKeyReaderRegistry = publicKeyReaderRegistry;

            _handshakeConfig   = handshakeConfig;
            _cipherSuiteConfig = cipherSuiteConfig;
        }
        public HandleClientKeyExchangeState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            CipherSuiteConfig cipherSuiteConfig,
            ClientKeyExchangeMessage handshake)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;

            _cipherSuiteConfig = cipherSuiteConfig;
            _handshake         = handshake;
        }
        public HandshakeFinishedService(
            ICipherSuitesProvider cipherSuitesProvider,

            CipherSuiteConfig cipherSuiteConfig,
            EndConfig endConfig,
            HandshakeConfig handshakeConfig,
            KeyConfig keyConfig)
        {
            _cipherSuitesProvider = cipherSuitesProvider;
            _cipherSuiteConfig    = cipherSuiteConfig;
            _endConfig            = endConfig;
            _handshakeConfig      = handshakeConfig;
            _keyConfig            = keyConfig;
        }
        private HandleServerKeyExchangeState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            CipherSuiteConfig cipherSuiteConfig,

            ServerKeyExchangeMessage handshake)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;

            _cipherSuiteConfig = cipherSuiteConfig;

            _handshake = handshake;
        }
        public static IRecordWriterStrategy GetRecordWriterStrategy(
            this ICipherSuitesProvider cipherSuiteProvider,
            IServiceProvider serviceProvider,
            CipherSuite cipherSuite)
        {
            if (cipherSuiteProvider.IsBlockCipher(cipherSuite))
            {
                return(serviceProvider.GetRequiredService <BlockCipherStrategy>());
            }
            if (cipherSuiteProvider.IsAEADCipher(cipherSuite))
            {
                return(serviceProvider.GetRequiredService <AEADCipherStrategy>());
            }

            return(serviceProvider.GetRequiredService <CipherStrategy>());
        }
Ejemplo n.º 10
0
        public MasterSecretCalculator(
            ICipherSuitesProvider cipherSuitesProvider,

            RandomConfig randomConfig,
            CipherSuiteConfig cipherSuiteConfig,

            KeyConfig keyConfig,
            AEADCipherConfig aeadConfig,
            BlockCipherConfig blockConfig)
        {
            _cipherSuitesProvider = cipherSuitesProvider;

            _randomConfig      = randomConfig;
            _cipherSuiteConfig = cipherSuiteConfig;

            _keyConfig   = keyConfig;
            _aeadConfig  = aeadConfig;
            _blockConfig = blockConfig;
        }
Ejemplo n.º 11
0
        public SignatureAlgorithmsExtension(
            ICipherSuitesProvider cipherSuiteProvider,
            CipherSuitesRegistry cipherSuitesRegistry,

            HashAlgorithmRegistry hashAlgorithmRegistry,
            SignatureAlgorithmsRegistry signatureAlgorithmsRegistry,

            EndConfig endConfig,
            Config config)
        {
            _cipherSuiteProvider  = cipherSuiteProvider;
            _cipherSuitesRegistry = cipherSuitesRegistry;

            _hashAlgorithmRegistry       = hashAlgorithmRegistry;
            _signatureAlgorithmsRegistry = signatureAlgorithmsRegistry;

            _endConfig = endConfig;
            _config    = config;
        }
Ejemplo n.º 12
0
        public CipherStrategy(
            ICipherSuitesProvider cipherSuitesProvider,

            Connection connection,

            EndConfig endConfig,
            SequenceConfig sequenceConfig,
            BlockCipherConfig blockCipherConfig,
            CipherSuiteConfig cipherSuiteConfig)
        {
            _cipherSuitesProvider = cipherSuitesProvider;

            _connection = connection;

            _endConfig         = endConfig;
            _sequenceConfig    = sequenceConfig;
            _blockCipherConfig = blockCipherConfig;
            _cipherSuiteConfig = cipherSuiteConfig;
        }
        public SendingServerHelloState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            HandshakeWriter writer,

            VersionConfig versionConfig,
            RandomConfig randomConfig,
            SessionConfig sessionConfig,
            CipherSuiteConfig cipherSuiteConfig)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;

            _writer = writer;

            _versionConfig     = versionConfig;
            _randomConfig      = randomConfig;
            _sessionConfig     = sessionConfig;
            _cipherSuiteConfig = cipherSuiteConfig;
        }
Ejemplo n.º 14
0
        public HandleServerHelloDoneState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,

            Connection connection,
            HandshakeWriter writer,
            HandshakeFinishedService handshakeFinishedService,

            CipherSuiteConfig cipherSuiteConfig,
            VersionConfig versionConfig)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;

            _connection = connection;
            _writer     = writer;
            _handshakeFinishedService = handshakeFinishedService;

            _cipherSuiteConfig = cipherSuiteConfig;
            _versionConfig     = versionConfig;
        }
Ejemplo n.º 15
0
        public AEADCipherStrategy(
            IRandom random,
            ICipherSuitesProvider cipherSuitesProvider,

            Connection connection,

            CipherSuiteConfig cipherSuiteConfig,
            SequenceConfig sequenceConfig,
            EndConfig endConfig,
            AEADCipherConfig aeadConfig)
        {
            _random = random;
            _cipherSuitesProvider = cipherSuitesProvider;

            _connection = connection;

            _cipherSuiteConfig = cipherSuiteConfig;
            _sequenceConfig    = sequenceConfig;
            _endConfig         = endConfig;
            _aeadConfig        = aeadConfig;
        }
Ejemplo n.º 16
0
        public SendingClientHelloState(
            IServiceProvider serviceProvider,
            ICipherSuitesProvider cipherSuitesProvider,
            CipherSuitesRegistry cipherSuitesRegistry,

            IRandom random,
            HandshakeWriter writer,

            VersionConfig versionConfig,
            RandomConfig randomConfig,
            SessionConfig sessionConfig)
        {
            _serviceProvider      = serviceProvider;
            _cipherSuitesProvider = cipherSuitesProvider;
            _cipherSuitesRegistry = cipherSuitesRegistry;

            _random = random;
            _writer = writer;

            _versionConfig = versionConfig;
            _randomConfig  = randomConfig;
            _sessionConfig = sessionConfig;
        }
        public static bool IsAEADCipher(this ICipherSuitesProvider cipherSuiteProvider, CipherSuite cipherSuite)
        {
            var cipherAlgorithm = cipherSuiteProvider.ResolveCipherAlgorithm(cipherSuite);

            return(cipherAlgorithm is AEADCipherAdapter || cipherAlgorithm is IAEADBlockCipher);
        }