#### [Abblix\.Jwt](https://www.abblix.com/docs/api/abblix-jwt 'index')
### [Abblix\.Jwt\.ExternalKeys](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys 'Abblix\.Jwt\.ExternalKeys')

## KeyCustodianUnavailableException Class

Thrown by an [IKeyCustodian](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.IKeyCustodian 'Abblix\.Jwt\.ExternalKeys\.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\.

```csharp
public sealed class KeyCustodianUnavailableException : System.Exception
```

Inheritance [System\.Object](https://learn.microsoft.com/en-us/dotnet/api/system.object 'System\.Object') → [System\.Exception](https://learn.microsoft.com/en-us/dotnet/api/system.exception '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\)](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.IKeyCustodian#Abblix.Jwt.ExternalKeys.IKeyCustodian.UnwrapKeyAsync(string,string,Abblix.Jwt.JsonWebTokenHeader,byte[],System.Threading.CancellationToken) 'Abblix\.Jwt\.ExternalKeys\.IKeyCustodian\.UnwrapKeyAsync\(string, string, Abblix\.Jwt\.JsonWebTokenHeader, byte\[\], System\.Threading\.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 {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception)}

Reports that the custodian is temporarily unable to perform [operation](https://www.abblix.com/docs/api/abblix-jwt/Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception).operation 'Abblix\.Jwt\.ExternalKeys\.KeyCustodianUnavailableException\.KeyCustodianUnavailableException\(string, string, System\.Nullable\<System\.TimeSpan\>, System\.Exception\)\.operation')\.

```csharp
public KeyCustodianUnavailableException(string operation, string message, System.Nullable<System.TimeSpan> retryAfter=null, System.Exception? innerException=null);
```
#### Parameters

###### `operation` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception).operation}

What was being asked of the custodian, named for a log line and nothing else:
            it never reaches a response body\.

###### `message` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception).message}

What the custodian said, for the log\.

###### `retryAfter` [System\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1') {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception).retryAfter}

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](https://learn.microsoft.com/en-us/dotnet/api/system.exception 'System\.Exception') {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.KeyCustodianUnavailableException(string,string,System.Nullable_System.TimeSpan_,System.Exception).innerException}

The failure as the custodian's own client reported it\.
### Properties

## KeyCustodianUnavailableException\.Operation Property {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.Operation}

What was being asked of the custodian when it declined\.

```csharp
public string Operation { get; }
```

#### Property Value
[System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String')

## KeyCustodianUnavailableException\.RetryAfter Property {#Abblix.Jwt.ExternalKeys.KeyCustodianUnavailableException.RetryAfter}

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\.

```csharp
public System.Nullable<System.TimeSpan> RetryAfter { get; }
```

#### Property Value
[System\.Nullable&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')[System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.nullable-1 'System\.Nullable\`1')
