Skip to content

Commit

Permalink
Linux test failure due to generic exception (#3405)
Browse files Browse the repository at this point in the history
  • Loading branch information
kartheekp-ms authored and heng-liu committed Jun 19, 2020
1 parent 56b29e2 commit 506689a
Showing 1 changed file with 10 additions and 0 deletions.
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

0 comments on commit 506689a

Please sign in to comment.