google / google/conscrypt

RSA "NoPadding" encryption is considered not secure but required by conscrypt to support TLS RSA-PSS signing algorithm

Open
#1,201 8 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
1.4k
Forks
326
Avg merge
16h 22m
Merged PRs (30d)
17

Description

**Describe the issue:**

TLS handshake fails if client certificate keypair is created in Android Keystore which specifies OEAP encryption padding. `setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_OEAP)`

This happens when the server requests `RSA-PSS` signature algorithms in `Certificate Request`.
In order for the keypair to work with RSA-PSS signature, client needs to set 'RSA NoPadding' by `setEncryptionPaddings(KeyProperties.ENCRYPTION_PADDING_NONE)`.

Refs:
https://developer.android.com/reference/android/security/keystore/KeyGenParameterSpec.Builder#setEncryptionPaddings(java.lang.String[])
https://developer.android.com/reference/android/security/keystore/KeyProperties#ENCRYPTION_PADDING_NONE

There are articles saying that RSA NoPadding shall not be used for encryption as it's not considered sure. Company SDL also forbids using RSA NoPadding encryption. Is there any way that we can explain why RSA NoPadding encryption is needed for TLS RSA-PSS signature and it's secure?

**Sample code to reproduce the issue:**
Please find the steps to create keypair in Android keystore in previously reported issue: SSL Handshake failure in Android 10 https://github.com/google/conscrypt/issues/718

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.