smartboot 开源组织 smartboot 开源组织
首页
  • smart-socket
  • smart-http
  • smart-servlet
  • smart-mqtt
  • smart-license
  • feat
❤️开源捐赠
💰付费服务
🏠加入社区
  • Gitee (opens new window)
  • Github (opens new window)
首页
  • smart-socket
  • smart-http
  • smart-servlet
  • smart-mqtt
  • smart-license
  • feat
❤️开源捐赠
💰付费服务
🏠加入社区
  • Gitee (opens new window)
  • Github (opens new window)
  • smart-socket 首页
  • 概要

    • 关于 smart-socket
    • 我们的用户
  • 快速上手

    • 🚩五分钟上手
    • 🚩通信协议
    • 性能压测
    • 新手常见问题
  • 高级进阶

    • 1.状态机
    • 2.服务端绑定网卡
  • 插件

    • 1. 关于插件💬
    • 2. 心跳插件
    • 2. 闲置超时插件
    • 3. 通信调参插件
    • 4. 黑名单插件🛡
    • 5. 加密通信插件🛡
      • 准备SSL证书
      • 示例
        • 服务端配置
        • 客户端配置
    • 6. 流量防控插件🛡
    • 7. 码流监测插件🛡
    • 8. proxy-protocol插件
  • 公众号

    • 💰单机百万长连接背后的故事
    • 💰揭秘百万长连接背后的黑科技
    • 💰让通信数据无所遁形
    • 性能分析的一柄利刃
    • 💰smart-socket的那点事之内存池
  • smart-socket
  • 插件
三刀
2022-11-02
目录

5. 加密通信插件🛡

# 准备SSL证书

执行以下命令生成证书

keytool -genkey -validity 36000 -alias www.smartboot.org -keyalg RSA -keystore server.keystore
1

# 示例

完整示例见:SslDemo (opens new window)

# 服务端配置

ServerSSLContextFactory serverFactory = new ServerSSLContextFactory(SslDemo.class.getClassLoader().getResourceAsStream("server.keystore"), "123456", "123456");
SslPlugin sslServerPlugin = new SslPlugin(serverFactory, ClientAuth.OPTIONAL);
serverProcessor.addPlugin(sslServerPlugin);
1
2
3

# 客户端配置

ClientSSLContextFactory clientFactory=new ClientSSLContextFactory();
SslPlugin sslPlugin = new SslPlugin(clientFactory);
clientProcessor.addPlugin(sslPlugin);
1
2
3
4. 黑名单插件🛡
6. 流量防控插件🛡

← 4. 黑名单插件🛡 6. 流量防控插件🛡→

Theme by Vdoing | Copyright © 2017-2025 三刀
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式