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

3 out of 27 Unit Tests are failing on Windows 7, but run ok on Windows 10 #36

Open
jlewis666 opened this issue Jun 29, 2021 · 2 comments

Comments

@jlewis666
Copy link

jlewis666 commented Jun 29, 2021

Hi,

The following 3 tests are failing on Windows 7, but run ok on Windows 10:

  1. ImportExportRsaPrivateKeyPublicKeyPairPem()
  2. ImportExportSingleChainedECPrivateKeyPublicKeyPairPem()
  3. ImportExportECPrivateKeyPublicKeyPairPem()

They are all failing with the Excepton:

"Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The specified network password is not correct."

Is there some further preparation to run these Tests successfully on Windows 7, some code changes required, or is this a known limitation of ASPNetCore on Windows 7 (e.g. rather like no .NET ALPN support in Win7)?

Exception stack trace details are listed below.

  1. ImportExportRsaPrivateKeyPublicKeyPairPem

CertificateManagerTests.ImportExportTests.ImportExportRsaPrivateKeyPublicKeyPairPem
Source: ImportExportTests.cs line 165
Duration: 204 ms

Message:
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The specified network password is not correct.

Stack Trace:
CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
X509Certificate.ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
X509Certificate2.ctor(Byte[] rawData, String password)
PemDecoder.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 151
ImportExportCertificate.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 193
ImportExportTests.ImportExportRsaPrivateKeyPublicKeyPairPem() line 182

  1. ImportExportSingleChainedECPrivateKeyPublicKeyPairPem

CertificateManagerTests.ImportExportTests.ImportExportSingleChainedECPrivateKeyPublicKeyPairPem
Source: ImportExportTests.cs line 220
Duration: 154 ms

Message:
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The specified network password is not correct.

Stack Trace:
CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
X509Certificate.ctor(Byte[] data)
X509Certificate2.ctor(Byte[] rawData)
PemDecoder.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 146
ImportExportCertificate.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 193
ImportExportTests.ImportExportSingleChainedECPrivateKeyPublicKeyPairPem() line 236

  1. ImportExportECPrivateKeyPublicKeyPairPem

CertificateManagerTests.ImportExportTests.ImportExportECPrivateKeyPublicKeyPairPem
Source: ImportExportTests.cs line 192
Duration: 129 ms

Message:
Internal.Cryptography.CryptoThrowHelper+WindowsCryptographicException : The specified network password is not correct.

Stack Trace:
CertificatePal.FilterPFXStore(Byte[] rawData, SafePasswordHandle password, PfxCertStoreFlags pfxCertStoreFlags)
CertificatePal.FromBlobOrFile(Byte[] rawData, String fileName, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags)
X509Certificate.ctor(Byte[] rawData, String password, X509KeyStorageFlags keyStorageFlags)
X509Certificate2.ctor(Byte[] rawData, String password)
PemDecoder.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 151
ImportExportCertificate.CreateCertificateWithPrivateKey(X509Certificate2 certificate, AsymmetricAlgorithm privateKey, String password) line 193
ImportExportTests.ImportExportECPrivateKeyPublicKeyPairPem() line 208

@damienbod
Copy link
Owner

@jlewis666 thanks for reporting, I would need to look into this, no idea why

@kdaveid
Copy link

kdaveid commented Jun 29, 2021

This might be a well known issue in Windows 7 where the creation of a X509Certificate2 needs access to the machine key set: https://stackoverflow.com/questions/8286110/asp-net-the-specified-network-password-is-not-correct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants