Pskfactories
Java TLS PSK JSSE Socket Factories powered by Bouncy Castle
Install / Use
/learn @clover/PskfactoriesREADME
PSK JSSE Socket Factories powered by Bouncy Castle
As of version 1.78 the Bouncy Castle JSSE provider supplies only an SSLSocketFactory and SSLServerSocketFactory with support for authentication via certificates. There is, however, an alternative mode of authentication available in the TLS standard which is supplied through the use of pre-shared keys (see https://datatracker.ietf.org/doc/html/rfc4279).
Bouncy Castle supports TLS PSK client and server connections but only through a non-standardized API and not through its JSSE implementation. The classes in this project bridge the gap, offerring developers JSSE standard SSLSocketFactory and SSLServerSocketFactory classes that support PSK cipher suites powered by Bouncy Castle.
At this time only OkHttp (client) and NanoHTTPD (server) have been lightly tested with this implementation.
TLS 1.2 and TLS 1.3 are supported.
Usage
To use one or both of these factories in your project do the following:
Include Dependencies
Include the Bouncy Castle bctls library and transitive dependencies in your project. If you are using Gradle with an Android project for example you would add the following to your dependencies:
implementation "org.bouncycastle:bctls-jdk18on:1.78"
See https://www.bouncycastle.org/latest_releases.html for other packaging options.
Copy Implementation
This project is not distributed via Maven Central.
To use this implementation copy the org.bchateau.pskfactories source code from this repository into your project.
Use
See the TestBcPskFactories#testServerClientConnect() method for example client and server use.
License
Copyright (C) 2024 Clover Network, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Related Skills
node-connect
342.5kDiagnose OpenClaw node connection and pairing failures for Android, iOS, and macOS companion apps
frontend-design
85.3kCreate distinctive, production-grade frontend interfaces with high design quality. Use this skill when the user asks to build web components, pages, or applications. Generates creative, polished code that avoids generic AI aesthetics.
openai-whisper-api
342.5kTranscribe audio via OpenAI Audio Transcriptions API (Whisper).
qqbot-media
342.5kQQBot 富媒体收发能力。使用 <qqmedia> 标签,系统根据文件扩展名自动识别类型(图片/语音/视频/文件)。
