diff --git a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs index ccea2de41fc007..196af51bc4d91f 100644 --- a/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs +++ b/src/libraries/Common/src/System/Security/Cryptography/X509Certificates/X509CertificateLoader.Pkcs12.cs @@ -647,6 +647,12 @@ internal ReadOnlyMemory DecryptSafeContents( saveOffset, written); } + catch (PlatformNotSupportedException pnse) + { + // May be thrown by PBE decryption if the platform does not support the algorithm. + ThrowWithHResult(SR.Cryptography_Pfx_BadPassword, ERROR_INVALID_PASSWORD, pnse); + throw; // This is unreachable because of the throw helper, but the compiler does not know that. + } catch (CryptographicException e) { CryptographicOperations.ZeroMemory(