Skip to content

Use OS-provided RSA OAEP implementation for Android - #71670

Merged
bartonjs merged 4 commits into
dotnet:mainfrom
vcsjones:android-rsa-oaep
Jul 6, 2022
Merged

bartonjs merged 4 commits into
dotnet:mainfrom
vcsjones:android-rsa-oaep

Conversation

@vcsjones

@vcsjones vcsjones commented Jul 5, 2022

Copy link
Copy Markdown
Member

Instead of using the managed OAEP implementatation, allow the OS to handle OAEP with SHA2 algorithms.

OAEPParameterSpec is in API Level 1.

Android also supports algorithm identifiers like "RSA/ECB/OAEPwithSHA-256andMGF1Padding" which would make the code simpler, but it makes the hash algorithm used in MGF1 ambiguous. Since the MGF1 algorithm is always the same as the OAEP algorithm, we explicitly use the OEAPParameterSpec so that we can control both the MGF1 digest algorithm and the OAEP digest algorithm.

Instead of using the managed OAEP implementatation, allow the OS to handle OAEP with SHA2 algorithms.

Android also supports algorithm identifiers like "RSA/ECB/OAEPwithSHA-256andMGF1Padding" which would make the code simpler, but it makes the hash algorithm used in MGF1 ambiguous. Since the MGF1 algorithm is always the same as the OAEP algorithm, we explicitly use the `OEAPParameterSpec` so that we can control both the MGF1 digest algorithm and the OAEP digest algorithm.
@ghost ghost added the area-System.Security label Jul 5, 2022
@ghost ghost assigned vcsjones Jul 5, 2022
@ghost

ghost commented Jul 5, 2022

Copy link
Copy Markdown

Tagging subscribers to this area: @dotnet/area-system-security, @vcsjones
See info in area-owners.md if you want to be subscribed.

Issue Details

Instead of using the managed OAEP implementatation, allow the OS to handle OAEP with SHA2 algorithms.

OAEPParameterSpec is in API Level 1.

Android also supports algorithm identifiers like "RSA/ECB/OAEPwithSHA-256andMGF1Padding" which would make the code simpler, but it makes the hash algorithm used in MGF1 ambiguous. Since the MGF1 algorithm is always the same as the OAEP algorithm, we explicitly use the OEAPParameterSpec so that we can control both the MGF1 digest algorithm and the OAEP digest algorithm.

Author: vcsjones
Assignees: -
Labels:

area-System.Security

Milestone: -

@ghost

ghost commented Jul 5, 2022

Copy link
Copy Markdown

Tagging subscribers to 'arch-android': @steveisok, @akoeplinger
See info in area-owners.md if you want to be subscribed.

Issue Details

Instead of using the managed OAEP implementatation, allow the OS to handle OAEP with SHA2 algorithms.

OAEPParameterSpec is in API Level 1.

Android also supports algorithm identifiers like "RSA/ECB/OAEPwithSHA-256andMGF1Padding" which would make the code simpler, but it makes the hash algorithm used in MGF1 ambiguous. Since the MGF1 algorithm is always the same as the OAEP algorithm, we explicitly use the OEAPParameterSpec so that we can control both the MGF1 digest algorithm and the OAEP digest algorithm.

Author: vcsjones
Assignees: vcsjones
Labels:

area-System.Security, os-android

Milestone: -

@vcsjones

This comment was marked as outdated.

@azure-pipelines

This comment was marked as outdated.

@vcsjones

vcsjones commented Jul 5, 2022

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

1 similar comment
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@jkoritzinsky jkoritzinsky left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

JNI interop looks good to me barring @bartonjs's comment

@vcsjones

vcsjones commented Jul 5, 2022

Copy link
Copy Markdown
Member Author

/azp run runtime-extra-platforms

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@vcsjones

vcsjones commented Jul 6, 2022

Copy link
Copy Markdown
Member Author

I don't believe any of the test failures are related. @bartonjs do we want any additional sign off for this, or is this okay to merge?

@bartonjs

bartonjs commented Jul 6, 2022

Copy link
Copy Markdown
Member

Merged since Jeremy K acted as the JNI Genie and the relevant tests are good.

@vcsjones
vcsjones deleted the android-rsa-oaep branch July 6, 2022 18:00
@steveisok

Copy link
Copy Markdown
Member

thanks @vcsjones!

@ghost ghost locked as resolved and limited conversation to collaborators Aug 6, 2022
@bartonjs bartonjs added the needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration label Aug 16, 2022
@vcsjones

vcsjones commented Aug 20, 2022 •

Copy link
Copy Markdown
Member Author

@bartonjs whats the reason for the needs further triage label on this PR?

@bartonjs

Copy link
Copy Markdown
Member

It was the label I chose for "I've incorporated it into the ECCN doc" rather than removing the label, since it means whatever the area owners want 😄. When the doc is done I'll double check, and then remove both labels.

@vcsjones

Copy link
Copy Markdown
Member Author

Ah, okay. Thought I might have broke something.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-System.Security needs-further-triage Issue has been initially triaged, but needs deeper consideration or reconsideration os-android

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants