Skip to content
This repository was archived by the owner on May 25, 2022. It is now read-only.

Commit c6f0520

Browse files
committed
Use STARTTLS for now
1 parent 36a1cc9 commit c6f0520

File tree

1 file changed

+0
-28
lines changed
  • simplekotlinmail-server/src/main/kotlin/net/axay/simplekotlinmail/server/tls

1 file changed

+0
-28
lines changed

simplekotlinmail-server/src/main/kotlin/net/axay/simplekotlinmail/server/tls/SMTPServerTLS.kt

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package net.axay.simplekotlinmail.server.tls
33
import net.axay.simplekotlinmail.server.SMTPServerBuilder
44
import java.net.InetSocketAddress
55
import javax.net.ssl.SSLContext
6-
import javax.net.ssl.SSLServerSocket
76
import javax.net.ssl.SSLSocket
87

98
/**
@@ -15,9 +14,6 @@ import javax.net.ssl.SSLSocket
1514
* @param overrideCipherSuites if true, the default enabled cipher suites will be replaced with
1615
* the cipher suites chosen by SimpleKotlinMail - you can see them here: [TLSVersions]
1716
* @param requireClientAuth [SSLSocket.setNeedClientAuth]
18-
* @param starttlsOnly enable this, if you wish to only use the sometimes deprecated STARTTLS
19-
* variant of TLS
20-
* @param tlsSocketBuilder use this builder to configure the TLS socket
2117
* @param starttlsSocketBuilder use this builder to configure the STARTTLS socket
2218
*/
2319
fun SMTPServerBuilder.setupTLS(
@@ -26,34 +22,10 @@ fun SMTPServerBuilder.setupTLS(
2622
protocolVersions: Array<TLSVersions> = arrayOf(TLSVersions.TLS_1_3, TLSVersions.TLS_1_2),
2723
overrideCipherSuites: Boolean = false,
2824
requireClientAuth: Boolean = true,
29-
starttlsOnly: Boolean = false,
30-
tlsSocketBuilder: (SSLServerSocket.() -> Unit)? = null,
3125
starttlsSocketBuilder: (SSLSocket.() -> Unit)? = null,
3226
) {
3327
if (requireTLS) builder.requireTLS() else builder.enableTLS()
3428

35-
if (!starttlsOnly) builder.serverSocketFactory {
36-
(tlsContext.serverSocketFactory.createServerSocket() as SSLServerSocket).apply {
37-
useClientMode = false
38-
39-
enabledProtocols = (
40-
protocolVersions
41-
.mapTo(LinkedHashSet()) { it.protocolVersion } intersect supportedProtocols.toList()
42-
).toTypedArray()
43-
44-
if (overrideCipherSuites) {
45-
enabledCipherSuites = (
46-
protocolVersions
47-
.flatMapTo(LinkedHashSet()) { it.cipherSuites } intersect supportedCipherSuites.toList()
48-
).toTypedArray()
49-
}
50-
51-
needClientAuth = requireClientAuth
52-
53-
tlsSocketBuilder?.invoke(this)
54-
}
55-
}
56-
5729
builder.startTlsSocketFactory { socketIn ->
5830
(tlsContext.socketFactory.createSocket(
5931
socketIn, (socketIn.remoteSocketAddress as InetSocketAddress).hostString, socketIn.port, true

0 commit comments

Comments
 (0)