question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Test failure: System_CanUnprotectWithCert

See original GitHub issue

This test fails occasionally with the following error:

System.Security.Cryptography.CryptographicException : An error occurred while trying to encrypt the provided data. Refer to the inner exception for more information.
---- System.IO.FileNotFoundException : Could not load file or assembly 'System.Security.Cryptography.Pkcs, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/KeyRingBasedDataProtector.cs:line 141
   at Microsoft.AspNetCore.DataProtection.DataProtectionCommonExtensions.Protect(IDataProtector protector, String plaintext) in /_/src/Microsoft.AspNetCore.DataProtection.Abstractions/DataProtectionCommonExtensions.cs:line 199
   at Microsoft.AspNetCore.DataProtection.DataProtectionProviderTests.<>c__DisplayClass7_0.<System_CanUnprotectWithCert>b__0(DirectoryInfo directory) in /_/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs:line 272
   at Microsoft.AspNetCore.DataProtection.DataProtectionProviderTests.WithUniqueTempDirectory(Action`1 testCode) in /_/test/Microsoft.AspNetCore.DataProtection.Extensions.Test/DataProtectionProviderTests.cs:line 298
----- Inner Stack Trace -----
   at System.Security.Cryptography.Xml.KeyInfoX509Data.GetXml(XmlDocument xmlDocument)
   at System.Security.Cryptography.Xml.KeyInfo.GetXml(XmlDocument xmlDocument)
   at System.Security.Cryptography.Xml.EncryptedKey.GetXml(XmlDocument document)
   at System.Security.Cryptography.Xml.KeyInfo.GetXml(XmlDocument xmlDocument)
   at System.Security.Cryptography.Xml.EncryptedData.GetXml(XmlDocument document)
   at System.Security.Cryptography.Xml.EncryptedXml.ReplaceElement(XmlElement inputElement, EncryptedData encryptedData, Boolean content)
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateXmlEncryptor.EncryptElement(XElement plaintextElement) in /_/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs:line 104
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.CertificateXmlEncryptor.Encrypt(XElement plaintextElement) in /_/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/CertificateXmlEncryptor.cs:line 85
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.XmlEncryptionExtensions.EncryptIfNecessary(IXmlEncryptor encryptor, XElement element) in /_/src/Microsoft.AspNetCore.DataProtection/XmlEncryption/XmlEncryptionExtensions.cs:line 100
   at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.CreateNewKey(Guid keyId, DateTimeOffset creationDate, DateTimeOffset activationDate, DateTimeOffset expirationDate) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/XmlKeyManager.cs:line 414
   at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.CreateNewKey(DateTimeOffset activationDate, DateTimeOffset expirationDate) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/XmlKeyManager.cs:line 133
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.CreateCacheableKeyRingCore(DateTimeOffset now, IKey keyJustAdded) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/KeyRingProvider.cs:line 102
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingProvider.GetCurrentKeyRingCore(DateTime utcNow) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/KeyRingProvider.cs:line 177
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) in /_/src/Microsoft.AspNetCore.DataProtection/KeyManagement/KeyRingBasedDataProtector.cs:line 102

Other tests within that build may have failed with a similar message, but they are not listed here. Check the link above for more info.

This test failed on master.

CC @Eilon (because the bot doesn’t know who else to pick)

This issue was made automatically. If there is a problem contact ryanbrandenburg.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Eiloncommented, Sep 5, 2018

@muratg might be a good idea to send mail too.

0reactions
aspnet-hellocommented, Sep 6, 2018

ThrowsIfProvidedCertificateDoesHavePrivateKey failed with about the same error on master. System_UsesProvidedCertificateNotFromStore failed with about the same error on master. ThrowsIfProvidedCertificateDoesNotMatch failed with about the same error on master. System_UsesInMemoryCertificate failed with about the same error on master. ThrowsIfProvidedCertificateDoesHavePrivateKey failed with about the same error on master. System_CanUnprotectWithCert failed with about the same error on master. XmlCanRoundTrip failed with about the same error on master. XmlCanRoundTrip failed with about the same error on master. ThrowsIfProvidedCertificateDoesHavePrivateKey failed with about the same error on master. System_UsesInMemoryCertificate failed with about the same error on master. XmlCanRoundTrip failed with about the same error on master. ThrowsIfCannotDecrypt failed with about the same error on master. ThrowsIfProvidedCertificateDoesNotMatch failed with about the same error on master. ThrowsIfProvidedCertificateDoesHavePrivateKey failed with about the same error on master. System_UsesProvidedDirectoryAndCertificate failed with about the same error on master. ThrowsIfCannotDecrypt failed with about the same error on master. System_CanUnprotectWithCert failed with about the same error on master. ThrowsIfProvidedCertificateDoesHavePrivateKey failed with about the same error on master. XmlCanRoundTrip failed with about the same error on master.

This comment was made automatically. If there is a problem contact ryanbrandenburg.

Read more comments on GitHub >

github_iconTop Results From Across the Web

HTTP Server Test Fails with SSL Error
An HTTP Server test or the HTTP Server view of a Page Load test may display the following error message: SSL certificate problem:...
Read more >
Why it's important to test for expiring TLS/SSL certificates
The test reports a failure if a certificate expires within the next 30 days. A service dependency with a failed Certificate Expiry test...
Read more >
Security certificate validation fails - Windows Server
Certificate validation fails when a certificate has multiple trusted certification ... Log on to the web server as a system administrator.
Read more >
Certificate warning from AD FS when sign in to ...
This issue occurs when a validation error is encountered during a certificate test. Before a certificate can be used to help secure a...
Read more >
iOS 11 HTTPS network request failure with self-signed cert
For testing purpose, we use a self-signed cert, loaded as a bundle resource for network requests. It works fine on Xcode8 + iOS10...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found