Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[iOS][libraries] Throw PNSE for Exportable and PersistKeySet flags iOS #57153

Merged
merged 4 commits into from
Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,15 @@ internal static ICertificatePal FromDerBlob(
// We ignore keyStorageFlags which is tracked in https://github.com/dotnet/runtime/issues/52434.
// The keys are always imported as ephemeral and never persisted. Exportability is ignored for
// the moment and it needs to be investigated how to map it to iOS keychain primitives.
if ((keyStorageFlags & X509KeyStorageFlags.Exportable) == X509KeyStorageFlags.Exportable)
{
throw new PlatformNotSupportedException(SR.Cryptography_X509_PKCS12_PersistKeySetNotSupported);
}
if ((keyStorageFlags & X509KeyStorageFlags.PersistKeySet) == X509KeyStorageFlags.PersistKeySet)
{
throw new PlatformNotSupportedException(SR.Cryptography_X509_PKCS12_ExportableNotSupported);
}

return ImportPkcs12(rawData, password, ephemeralSpecified);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,12 @@
<data name="Cryptography_X509_PKCS7_Unsupported" xml:space="preserve">
<value>PKCS#7 certificate format is not supported on this platform.</value>
</data>
<data name="Cryptography_X509_PKCS12_PersistKeySetNotSupported" xml:space="preserve">
<value>PKCS#12 persist key set flag is not supported on this iOS.</value>
</data>
<data name="Cryptography_X509_PKCS12_ExportableNotSupported" xml:space="preserve">
<value>PKCS#12 exportable flag is not supported on this iOS.</value>
</data>
<data name="Cryptography_X509_StoreAddFailure" xml:space="preserve">
<value>The X509 certificate could not be added to the store.</value>
</data>
Expand Down