Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SSL/TLS #75

Open
Carmy85 opened this issue Oct 17, 2019 · 2 comments
Open

SSL/TLS #75

Carmy85 opened this issue Oct 17, 2019 · 2 comments
Labels

Comments

@Carmy85
Copy link

Carmy85 commented Oct 17, 2019

It's possible to enable communications using protocols such as SSL / TLS ?

Thanks

@kpavlov
Copy link
Owner

kpavlov commented Oct 17, 2019

Hi,
You should configure netty's SslContext using ConnectorConfigurer.

@VovkaSOL
Copy link

VovkaSOL commented Dec 18, 2023

May be @kpavlov return to this good project

  client = Iso8583Client(socketAddress, configuration, isoMessageFactory).apply {
            configurer = object : ConnectorConfigurer<ClientConfiguration, Bootstrap> {
                override fun configurePipeline(pipeline: ChannelPipeline, configuration: ClientConfiguration) {
                    super.configurePipeline(pipeline, configuration)
                    if (sslConnectionProps.enableSsl) {
                        LOGGER.debug("Инициализация ssl клиента")
                        val ctx = getSslContext(sslConnectionProps.useClientCert, false)
                        //SslContextBuilder.forClient().trustManager()
                        val handler = ctx.newHandler(pipeline.channel().alloc()).apply {
                            engine().needClientAuth = true
                            engine().wantClientAuth = true
                            engine().useClientMode = true
                            this.handshakeFuture().addListener { f ->
                                if (!f.isSuccess) LOGGER.error("Клиентский SSL handshake failed" + f.cause().message)
                            }
                        }
                        pipeline.addAfter("Iso8583ChannelInitializer#0", "SSLHandler#0", handler)
                    }
                    if (showHexDumpLogs) {
                        pipeline.addAfter("iso8583Decoder", "hexLog", LoggingHandler(LogLevel.DEBUG))
                    }
                }
            }
        }
        client.addMessageListener(ClientResponseMessageListener(channelsCache, jsonIsoConverter))
        //client.configuration.replyOnError()=true
        client.init();
        client.connect()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants