KeyCustodianUnavailableException Class
Thrown by an IKeyCustodian when the custodian could not answer for a reason that a later attempt
may resolve on its own: it is sealed, unreachable, throttling, or failing internally. The library turns this
into a 503 carrying Retry-After, because that is a statement the caller can act on.
public sealed class KeyCustodianUnavailableException : System.ExceptionInheritance System.Object → System.Exception → KeyCustodianUnavailableException
Remarks
The distinction this type carries is the one the library cannot make for itself. An endpoint sees an exception and nothing more; only the custodian knows whether its backend said "not now" or "not you". So a custodian throws this for the first case and anything else for the second, and the second answers 500 - the honest status for a condition that will not clear on its own, such as a missing permission or a key that is gone. Defaulting the other way would promise a retry that cannot help, so an unclassified failure is treated as permanent.
This is not the way a DECRYPTION failure is reported. UnwrapKeyAsync(string, string, JsonWebTokenHeader, byte[], CancellationToken) returns null for a CEK it could not recover, which keeps a wrong key indistinguishable from bad padding; that mitigation is about what an attacker can learn from a well-formed answer, and is unrelated to the custodian being unable to answer at all.
Constructors
KeyCustodianUnavailableException(string, string, Nullable<TimeSpan>, Exception) Constructor
Reports that the custodian is temporarily unable to perform operation.
public KeyCustodianUnavailableException(string operation, string message, System.Nullable<System.TimeSpan> retryAfter=null, System.Exception? innerException=null);Parameters
operation System.String
What was being asked of the custodian, named for a log line and nothing else: it never reaches a response body.
message System.String
What the custodian said, for the log.
retryAfter System.Nullable<System.TimeSpan>
How long the custodian suggests waiting, when it says so. Null when it does
not: the library then answers 503 without Retry-After rather than inventing an interval.
innerException System.Exception
The failure as the custodian's own client reported it.
Properties
KeyCustodianUnavailableException.Operation Property
What was being asked of the custodian when it declined.
public string Operation { get; }Property Value
KeyCustodianUnavailableException.RetryAfter Property
How long to wait before trying again, when the custodian named an interval. Null means it did not, and the library says so by omitting the header rather than by guessing.
public System.Nullable<System.TimeSpan> RetryAfter { get; }