Skip to content
This repository has been archived by the owner on Jan 21, 2022. It is now read-only.

TLS1.3 support and ENCRYPTION_PADDING_NONE is added #392

Open
wants to merge 3 commits into
base: MAS-2.1.00
Choose a base branch
from

Conversation

arindamhit
Copy link
Contributor

@arindamhit arindamhit commented Aug 19, 2021

Issue: After Gateway 10 CR03, RSA-PSS support has been added in the Gateway but for Android 10 and above, we have missed it in our SDK. We need to enable ENCRYPTION_PADDING_NONE to support the same for Android 10 and above.

Apart from that, Android SDK 29 and above has started supporting TLS 1.3. As our gateway has the support for TLS 1.3, MAS SDK does not have that. So we enhanced it to support the TLS 1.3 protocol.

For the devices which are running below Android SDK 29(means Android 9 or below devices), they don't support TLS 1.3. In that case, we should enable TLS 1.2 and TLS 1.3 both on the gateway.

@arindamhit arindamhit self-assigned this Aug 19, 2021
private static final String[] SUPPORTED_TLS = {SSL_V3_PROTOCOL, SSL_TLS_V1_PROTOCOL, SSL_TLS_V1_1_PROTOCOL, SSL_TLS_V1_2_PROTOCOL};
private static final String[] SUPPORTED_TLS_Q = {SSL_V3_PROTOCOL, SSL_TLS_V1_PROTOCOL, SSL_TLS_V1_1_PROTOCOL, SSL_TLS_V1_2_PROTOCOL, SSL_TLS_V1_3_PROTOCOL};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUPPORTED_TLS_Q , I think you are trying to say, its android q onwards, but its difficult to understand still, please use a more meaningful keyword here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can I make SUPPORTED_TLS_FROM_ANDROID_Q ?

@@ -68,8 +72,14 @@ public Socket createSocket(InetAddress address, int port, InetAddress localAddre
}

private Socket enableTLS(Socket socket) {
if (socket != null && (socket instanceof SSLSocket)) {
((SSLSocket) socket).setEnabledProtocols(SUPPORTED_TLS);
if ((socket instanceof SSLSocket)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the null check removed here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because instanceof covers that null check. It is actually redundant. IDE was showing the same.

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

Successfully merging this pull request may close these issues.

3 participants