Skip to content

Commit 82c2984

Browse files
committed
test(dcv): classify CA rejection — unsupported algorithm vs out-of-credits
First live run of the algorithm matrix skipped all 10: the supported algos (RSA 2048/3072/4096, ECC P-256/P-384) failed on 'Insufficient Credits' while the rest returned 'Invalid key size' / 'Something went Wrong'. The old Skip text called every rejection 'likely an unsupported key algorithm', which is wrong for the credit-blocked supported ones. Add KeyAlgorithms.ClassifyRejection so the Skip reason distinguishes an unsupported algorithm from an account/credit limitation, and report the CA's verbatim message either way.
1 parent 394c357 commit 82c2984

3 files changed

Lines changed: 27 additions & 9 deletions

File tree

CERTInext.IntegrationTests/AlgorithmMatrixTests.cs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,12 @@ public async Task Enroll_AcceptsKeyAlgorithm(string tag)
161161
}
162162
catch (Exception ex)
163163
{
164-
// Per agreed scope: a CA-side rejection (algorithm not supported, or other
165-
// account/provisioning gap) becomes an explicit Skip carrying the CA's message,
166-
// so the matrix documents real CERTInext support without a hard failure.
167-
_output.WriteLine($"[SKIP] {tag}: CERTInext rejected submission — {ex.Message}");
168-
Skip.If(true,
169-
$"CERTInext did not accept a {tag} order. This may be an unsupported key algorithm " +
170-
$"or an account/provisioning limitation. CA message: {ex.Message}");
164+
// Per agreed scope: a CA-side rejection becomes an explicit Skip carrying the CA's
165+
// message (classified so an unsupported algorithm isn't confused with a credit/
166+
// account limitation), so the matrix documents real CERTInext support honestly.
167+
string reason = KeyAlgorithms.ClassifyRejection(ex.Message);
168+
_output.WriteLine($"[SKIP] {tag}: {reason}{ex.Message}");
169+
Skip.If(true, $"CERTInext did not accept a {tag} order: {reason}. CA message: {ex.Message}");
171170
}
172171

173172
enrollResult.Should().NotBeNull($"{tag}: Enroll must return a non-null result when accepted");

CERTInext.IntegrationTests/DcvLifecycleTests.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,9 @@ public async Task EnrollWithDcvOn_IssuesPerKeyAlgorithm(string tag)
415415
}
416416
catch (Exception ex)
417417
{
418-
_output.WriteLine($"[SKIP] {tag}: CERTInext rejected the DV order at submission — {ex.Message}");
419-
Skip.If(true, $"CERTInext did not accept a {tag} DV order (likely an unsupported key algorithm). CA message: {ex.Message}");
418+
string reason = KeyAlgorithms.ClassifyRejection(ex.Message);
419+
_output.WriteLine($"[SKIP] {tag}: {reason}{ex.Message}");
420+
Skip.If(true, $"CERTInext did not issue a {tag} cert: {reason}. CA message: {ex.Message}");
420421
return; // unreachable — Skip throws
421422
}
422423

CERTInext.IntegrationTests/KeyAlgorithms.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,5 +115,23 @@ public static byte[] DerFromPem(string pem)
115115

116116
/// <summary>A filesystem/DNS-safe slug for a tag, e.g. "ECDSA-P256" → "ecdsap256".</summary>
117117
public static string Slug(string tag) => tag.ToLowerInvariant().Replace("-", string.Empty);
118+
119+
/// <summary>
120+
/// Classifies a CERTInext order-rejection message so the algorithm matrix doesn't
121+
/// conflate "this key algorithm is unsupported" with "the account can't place orders
122+
/// right now". CERTInext's live envelope (observed): RSA 2048/3072/4096 + ECC P-256/P-384
123+
/// are accepted; larger RSA, P-521, and the Ed* curves return "Invalid key size" /
124+
/// "Something went Wrong". A credit shortfall returns "Insufficient Credits" regardless
125+
/// of algorithm.
126+
/// </summary>
127+
public static string ClassifyRejection(string caMessage)
128+
{
129+
caMessage ??= string.Empty;
130+
if (caMessage.IndexOf("Invalid key size", StringComparison.OrdinalIgnoreCase) >= 0)
131+
return "key algorithm/size not supported by CERTInext";
132+
if (caMessage.IndexOf("Insufficient Credits", StringComparison.OrdinalIgnoreCase) >= 0)
133+
return "CERTInext account is out of credits — algorithm support was not exercised";
134+
return "rejected by CERTInext";
135+
}
118136
}
119137
}

0 commit comments

Comments
 (0)