tls-psk: use automatically assigned port
This commit is contained in:
@@ -164,15 +164,14 @@ public class KeyTransferInteractor {
|
|||||||
Socket socket;
|
Socket socket;
|
||||||
if (isServer) {
|
if (isServer) {
|
||||||
try {
|
try {
|
||||||
int port = 1336;
|
serverSocket = (SSLServerSocket) sslContext.getServerSocketFactory().createServerSocket(0);
|
||||||
serverSocket = (SSLServerSocket) sslContext.getServerSocketFactory().createServerSocket(port);
|
|
||||||
String[] supportedCipherSuites = serverSocket.getSupportedCipherSuites();
|
String[] supportedCipherSuites = serverSocket.getSupportedCipherSuites();
|
||||||
String[] enabledCipherSuites = intersectArrays(supportedCipherSuites, ALLOWED_CIPHERSUITES);
|
String[] enabledCipherSuites = intersectArrays(supportedCipherSuites, ALLOWED_CIPHERSUITES);
|
||||||
serverSocket.setEnabledCipherSuites(enabledCipherSuites);
|
serverSocket.setEnabledCipherSuites(enabledCipherSuites);
|
||||||
|
|
||||||
String presharedKeyEncoded = Hex.toHexString(presharedKey);
|
String presharedKeyEncoded = Hex.toHexString(presharedKey);
|
||||||
String qrCodeData =
|
String qrCodeData =
|
||||||
"pgp+transfer://" + presharedKeyEncoded + "@" + getIPAddress(true) + ":" + port;
|
"pgp+transfer://" + presharedKeyEncoded + "@" + getIPAddress(true) + ":" + serverSocket.getLocalPort();
|
||||||
qrCodeData = qrCodeData.toUpperCase(Locale.getDefault());
|
qrCodeData = qrCodeData.toUpperCase(Locale.getDefault());
|
||||||
invokeListener(CONNECTION_LISTENING, qrCodeData);
|
invokeListener(CONNECTION_LISTENING, qrCodeData);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user