System.Security.Cryptography.CryptographicException : ASN1 corrupted data.\r\n---- System.Formats.Asn1.AsnContentException : The provided data does not represent a valid tag.
at System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest.ProcessResponse(ReadOnlyMemory`1 source, Rfc3161TimestampToken& token, Rfc3161RequestResponseStatus& status, Int32& bytesConsumed, Boolean shouldThrow)
at System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest.ProcessResponse(ReadOnlyMemory`1 responseBytes, Int32& bytesConsumed)
at Sign.Core.Timestamp.TimestampBuilder.SubmitTimestampRequest(Uri timestampUri, Oid digestOid, TimestampNonce nonce, TimeSpan timeout, Byte[] digest) in /_/src/Sign.Core/Tools/VsixSignTool/Timestamp/TimestampBuilder.netcoreapp.cs:line 34
at Sign.Core.OpcPackageTimestampBuilder.SignAsync(Uri timestampServer, HashAlgorithmName timestampAlgorithm) in /_/src/Sign.Core/Tools/VsixSignTool/OpcPackageTimestampBuilder.cs:line 51
at Sign.Core.Test.OpcPackageSigningTests.ShouldTimestampFileWithRsa(Int32 keySizeInBits, HashAlgorithmName hashAlgorithmName, HashAlgorithmName timestampDigestAlgorithm) in /_/test/Sign.Core.Test/Tools/VSIXSignTool/OpcPackageSigningTests.cs:line 83
--- End of stack trace from previous location ---
----- Inner Stack Trace -----
at System.Formats.Asn1.AsnDecoder.ReadEncodedValue(ReadOnlySpan`1 source, AsnEncodingRules ruleSet, Int32& contentOffset, Int32& contentLength, Int32& bytesConsumed)
at System.Formats.Asn1.AsnValueReader.PeekEncodedValue()
at System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest.ProcessResponse(ReadOnlyMemory`1 source, Rfc3161TimestampToken& token, Rfc3161RequestResponseStatus& status, Int32& bytesConsumed, Boolean shouldThrow)
Two tests failed then passed on rerun for 394fc50:
Sign.Core.Test.OpcPackageSigningTests.ShouldTimestampFileWithRsa(keySizeInBits: 2048, hashAlgorithmName: SHA256, timestampDigestAlgorithm: SHA256)details
Sign.Core.Test.Crypt32Tests.ShouldTimestampDatadetails
The next best step would probably be to add logging to the timestamp server to log every request/response. Or, if Visual Studio's "Run Until Failure" feature works well enough, locally debug a failure.
CC @javierdlg