Skip to content

DataProtectionProviderTests.System_UsesProvidedDirectoryAndCertificate throws a CryptographicException on the Windows.10.Arm64.Open Helix queue #26871

@halter73

Description

@halter73

DataProtectionProviderTests.System_UsesProvidedDirectoryAndCertificate throws CryptographicException claiming "Keyset does not exist" on the Windows.10.Arm64.Open Helix queue.

System.Security.Cryptography.CryptographicException : Keyset does not exist
Stack trace
   at System.Security.Cryptography.Utils.CreateProvHandle(CspParameters parameters, Boolean randomKeyContainer)
   at System.Security.Cryptography.Utils.GetKeyPairHelper(CspAlgorithmType keyType, CspParameters parameters, Boolean randomKeyContainer, Int32 dwKeySize, SafeProvHandle& safeProvHandle, SafeKeyHandle& safeKeyHandle)
   at System.Security.Cryptography.RSACryptoServiceProvider.GetKeyPair()
   at System.Security.Cryptography.RSACryptoServiceProvider..ctor(Int32 dwKeySize, CspParameters parameters, Boolean useDefaultKeySize)
   at System.Security.Cryptography.X509Certificates.X509Certificate2.get_PrivateKey()
   at System.Security.Cryptography.X509Certificates.RSACertificateExtensions.GetRSAPrivateKey(X509Certificate2 certificate)
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlDecryptor.EncryptedXmlWithCertificateKeys.GetKeyFromCert(EncryptedKey encryptedKey, KeyInfoX509Data keyInfo) in /_/src/DataProtection/DataProtection/src/XmlEncryption/EncryptedXmlDecryptor.cs:line 147
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlDecryptor.EncryptedXmlWithCertificateKeys.DecryptEncryptedKey(EncryptedKey encryptedKey) in /_/src/DataProtection/DataProtection/src/XmlEncryption/EncryptedXmlDecryptor.cs:line 109
   at System.Security.Cryptography.Xml.EncryptedXml.GetDecryptionKey(EncryptedData encryptedData, String symmetricAlgorithmUri)
   at System.Security.Cryptography.Xml.EncryptedXml.DecryptDocument()
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.EncryptedXmlDecryptor.Decrypt(XElement encryptedElement) in /_/src/DataProtection/DataProtection/src/XmlEncryption/EncryptedXmlDecryptor.cs:line 68
   at Microsoft.AspNetCore.DataProtection.XmlEncryption.XmlEncryptionExtensions.DecryptElement(XElement element, IActivator activator) in /_/src/DataProtection/DataProtection/src/XmlEncryption/XmlEncryptionExtensions.cs:line 21
   at Microsoft.AspNetCore.DataProtection.KeyManagement.XmlKeyManager.Microsoft.AspNetCore.DataProtection.KeyManagement.Internal.IInternalXmlKeyManager.DeserializeDescriptorFromKeyElement(XElement keyElement) in /_/src/DataProtection/DataProtection/src/KeyManagement/XmlKeyManager.cs:line 454
   at Microsoft.AspNetCore.DataProtection.KeyManagement.DeferredKey.<>c__DisplayClass1_0.<GetLazyDescriptorDelegate>b__0() in /_/src/DataProtection/DataProtection/src/KeyManagement/DeferredKey.cs:line 45
   at System.Lazy`1.CreateValue()
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   at System.Lazy`1.get_Value()
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyBase.get_Descriptor() in /_/src/DataProtection/DataProtection/src/KeyManagement/KeyBase.cs:line 51
   at Microsoft.AspNetCore.DataProtection.AuthenticatedEncryption.CngGcmAuthenticatedEncryptorFactory.CreateEncryptorInstance(IKey key) in /_/src/DataProtection/DataProtection/src/AuthenticatedEncryption/CngGcmAuthenticatedEncryptorFactory.cs:line 32
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyBase.CreateEncryptor() in /_/src/DataProtection/DataProtection/src/KeyManagement/KeyBase.cs:line 59
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRing.KeyHolder.GetEncryptorInstance(Boolean& isRevoked) in /_/src/DataProtection/DataProtection/src/KeyManagement/KeyRing.cs:line 82
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRing.get_DefaultAuthenticatedEncryptor() in /_/src/DataProtection/DataProtection/src/KeyManagement/KeyRing.cs:line 45
   at Microsoft.AspNetCore.DataProtection.KeyManagement.KeyRingBasedDataProtector.Protect(Byte[] plaintext) in /_/src/DataProtection/DataProtection/src/KeyManagement/KeyRingBasedDataProtector.cs:line 102
   at Microsoft.AspNetCore.DataProtection.DataProtectionCommonExtensions.Protect(IDataProtector protector, String plaintext) in /_/src/DataProtection/Abstractions/src/DataProtectionCommonExtensions.cs:line 199
   at Microsoft.AspNetCore.DataProtection.Da

https://dev.azure.com/dnceng/public/_build/results?buildId=850263&view=ms.vss-test-web.build-test-results-tab&runId=27098036&resultId=102965&paneView=debug

Metadata

Metadata

Assignees

Labels

✔️ Resolution: FixedThe bug or enhancement requested in this issue has been checked-in!DoneThis issue has been fixedaffected-fewThis issue impacts only small number of customersarea-dataprotectionIncludes: DataProtectionseverity-minorThis label is used by an internal tooltasktest-failure

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions