Validate RSA parameters when importing to OpenSSL
authorKevin Jones <kevin@vcsjones.com>
Wed, 26 Jun 2019 14:03:10 +0000 (10:03 -0400)
committerJeremy Barton <jbarton@microsoft.com>
Wed, 26 Jun 2019 14:03:09 +0000 (07:03 -0700)
commit7fb315d819255317205295211f9d7dd763684564
tree7ad8d72dafcace254336231ebfdd4fd20a097aa9
parent9b65fc765e04c21b6714f5a38136aea0e78a4370
Validate RSA parameters when importing to OpenSSL

This imports a key explicitly into the OpenSSL default software RSA implementation to call
`RSA_check_key` to determine that the key parameters are consistent.

After the key consistency is determined, then it imports into a second new key handle, using the
configured default (which may also be the default software RSA implementation), and returns that one.

Commit migrated from https://github.com/dotnet/corefx/commit/5590a9172a65be8cd6f93fdd76f547e63006c837
src/libraries/Common/tests/System/Security/Cryptography/AlgorithmImplementations/RSA/RSAXml.cs
src/libraries/Native/Unix/System.Security.Cryptography.Native/opensslshim.h
src/libraries/Native/Unix/System.Security.Cryptography.Native/pal_rsa.c