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

Linux test failure due to generic exception #3405

Merged
10 changes: 10 additions & 0 deletions src/NuGet.Core/NuGet.Commands/SignCommand/CertificateProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,14 @@ internal static class CertificateProvider

private const int MACOS_INVALID_CERT = -25257;


#if IS_SIGNING_SUPPORTED && IS_CORECLR
//Generic exception ASN1 corrupted data
private const int OPENSSL_ASN1_CORRUPTED_DATA_ERROR = unchecked((int)0x80131501);
#else
// OpenSSL: error:0D07803A:asn1 encoding routines:ASN1_ITEM_EX_D2I:nested asn1 error
private const int OPENSSL_ERR_R_NESTED_ASN1_ERROR = 0x0D07803A;
#endif

/// <summary>
/// Looks for X509Certificates using the CertificateSourceOptions.
Expand Down Expand Up @@ -77,7 +83,11 @@ public static async Task<X509Certificate2Collection> GetCertificatesAsync(Certif
options.CertificatePath)));

case CRYPT_E_NO_MATCH_HRESULT:
#if IS_SIGNING_SUPPORTED && IS_CORECLR
case OPENSSL_ASN1_CORRUPTED_DATA_ERROR:
#else
case OPENSSL_ERR_R_NESTED_ASN1_ERROR:
#endif
case MACOS_INVALID_CERT:
throw new SignCommandException(
LogMessage.CreateError(NuGetLogCode.NU3001,
Expand Down