CryptoServiceClient¶
Namespace CryptoService.Sdk.
A typed client for the Crypto Service v2 REST API (crypto-server). It performs no cryptography: every method is one HTTP call to the server, which holds the keys and does the work.
Remarks¶
One instance is safe to share across threads and concurrent calls: its state is fixed at construction, and it sends through one pooled HttpClient. Create it once and reuse it; a client per call wastes connections.
Every method is asynchronous and takes a CancellationToken; there is no blocking variant, which is the .NET idiom for I/O. A status outside 2xx raises CryptoApiException with the server's RFC 9457 problem; no usable answer raises CryptoTransportException; a cancelled token raises OperationCanceledException.
Methods¶
CryptoServiceClient(CryptoServiceClientOptions)¶
Creates a client with its own pooled connection handler (CryptoServiceClient.CreateHandler), disposed with the client.
| Parameter | Description |
|---|---|
options |
The server, credentials, timeouts and retry policy. |
| Exception | When |
|---|---|
ArgumentNullException |
options is null. |
ArgumentException |
The base URL is missing or relative, or a timeout is not positive. |
CryptoServiceClient(HttpClient, CryptoServiceClientOptions)¶
Creates a client that sends through httpClient, which the caller owns and disposes: the typed-client pattern of IHttpClientFactory. The client never changes its settings; configure its primary handler with CryptoServiceClient.CreateHandler so it refuses redirects.
| Parameter | Description |
|---|---|
httpClient |
The HTTP client to send through. |
options |
The server, credentials, timeouts and retry policy. |
| Exception | When |
|---|---|
ArgumentNullException |
An argument is null. |
ArgumentException |
The base URL is missing or relative, or a timeout is not positive. |
CryptoServiceClient(HttpMessageHandler, CryptoServiceClientOptions, Boolean)¶
Creates a client that sends through handler, for a custom transport or a test.
| Parameter | Description |
|---|---|
handler |
The HTTP message handler. |
options |
The server, credentials, timeouts and retry policy. |
disposeHandler |
Whether disposing the client disposes the handler. |
| Exception | When |
|---|---|
ArgumentNullException |
An argument is null. |
ArgumentException |
The base URL is missing or relative, or a timeout is not positive. |
AlgorithmsAsync(CancellationToken)¶
Lists the supported algorithms by category (GET /v2/algorithms).
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
CreateHandler()¶
A connection handler with the client's defaults: pooled keep-alive connections recycled every five minutes, HTTP/2 when the server offers it over TLS, no redirects and no cookies. TLS certificates are always verified.
Returns: A new handler; the caller owns it.
DecryptAsync(DecryptRequest, CancellationToken)¶
Decrypts a ciphertext from CryptoServiceClient.EncryptAsync (POST /v2/decrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
DeleteKeyAsync(KeyIdRequest, CancellationToken)¶
Deletes a server-held key (POST /v2/keys/delete). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
Dispose()¶
Disposes the HTTP client when this client created it; an HttpClient passed in is left alone.
DisposeAsync()¶
Disposes the client; see CryptoServiceClient.Dispose.
Returns: A completed task.
EncryptAsync(EncryptRequest, CancellationToken)¶
Encrypts with XChaCha20-Poly1305 under a 256-bit hex key (POST /v2/encrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
ExportKeyAsync(KeyIdRequest, CancellationToken)¶
Exports a server-held key, private parts included (POST /v2/keys/export); needs the crypto:keys:export scope, which crypto:admin does not imply.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
GenerateKeyPairAsync(GenerateKeyRequest, CancellationToken)¶
Generates a server-held key pair (POST /v2/keys/generate); the private key stays on the server. Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request, or null for the server defaults. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
GetCbomAsync(CancellationToken)¶
Gets the CycloneDX 1.6 Cryptographic Bill of Materials (GET /v2/compliance/cbom), which the route returns unwrapped.
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The answer.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
GetDoraComplianceAsync(CancellationToken)¶
Gets the DORA Article 9 and 13 self-assessment (GET /v2/compliance/dora).
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
GetServiceInfoAsync(CancellationToken)¶
Gets the service metadata (GET /).
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The answer.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
HashAsync(HashRequest, CancellationToken)¶
Computes a digest (POST /v2/hash).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
HealthAsync(CancellationToken)¶
Checks the server is up (GET /health, a public route: no credentials are sent).
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The answer.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
HpkeGenerateKeyPairAsync(HpkeKeygenRequest, CancellationToken)¶
Generates a server-held HPKE key pair, classical or post-quantum hybrid (POST /v2/hpke/keygen). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request, or null for the server defaults. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
HpkeOpenAsync(HpkeOpenRequest, CancellationToken)¶
Opens an HPKE ciphertext with a server-held key (POST /v2/hpke/open); the answer has the plaintext as text and as hex.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
HpkeSealAsync(HpkeSealRequest, CancellationToken)¶
Seals a message with HPKE, RFC 9180 (POST /v2/hpke/seal).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KdfAsync(KdfRequest, CancellationToken)¶
Derives a key from a password (POST /v2/kdf); the server enforces OWASP floors.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KeyUnwrapAsync(KeyUnwrapRequest, CancellationToken)¶
Unwraps a key (POST /v2/keys/unwrap); the server answers the key as a bare hex string.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KeyWrapAsync(KeyWrapRequest, CancellationToken)¶
Wraps a key with AES-KW or AES-KWP (POST /v2/keys/wrap).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsCreateKeyAsync(KmsCreateKeyRequest, CancellationToken)¶
Creates a managed key in a KMS provider (POST /v2/kms/create-key). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request, or null for the server defaults. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsDecryptAsync(KmsDecryptRequest, CancellationToken)¶
Decrypts with a managed KMS key (POST /v2/kms/decrypt); the answer has the plaintext as text and as hex.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsEncryptAsync(KmsEncryptRequest, CancellationToken)¶
Encrypts with a managed KMS key (POST /v2/kms/encrypt); build the request with KmsEncryptRequest.FromText or KmsEncryptRequest.FromBytes.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsGenerateDataKeyAsync(KmsGenerateDataKeyRequest, CancellationToken)¶
Generates a data encryption key under a managed KMS key (POST /v2/kms/generate-data-key).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsUnwrapAsync(KmsUnwrapRequest, CancellationToken)¶
Unwraps a key with a managed KMS key (POST /v2/kms/unwrap).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
KmsWrapAsync(KmsWrapRequest, CancellationToken)¶
Wraps a key with a managed KMS key (POST /v2/kms/wrap).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
LiveAsync(CancellationToken)¶
The liveness probe (GET /live, a public route: no credentials are sent).
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The answer.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MacAsync(HmacRequest, CancellationToken)¶
Computes an HMAC (POST /v2/hmac).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MacVerifyAsync(HmacVerifyRequest, CancellationToken)¶
Verifies an HMAC (POST /v2/hmac/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MlKemDecapsulateAsync(MlKemDecapsulateRequest, CancellationToken)¶
Recovers an ML-KEM shared secret with a server-held key (POST /v2/pq/decapsulate).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MlKemEncapsulateAsync(MlKemEncapsulateRequest, CancellationToken)¶
Encapsulates a shared secret to an ML-KEM-768 public key (POST /v2/pq/encapsulate).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MlKemGenerateKeyPairAsync(CancellationToken)¶
Generates a server-held ML-KEM-768 key pair (POST /v2/pq/keygen). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
MultiRecipientEncryptAsync(MultiRecipientEncryptRequest, CancellationToken)¶
Encrypts for several recipients with hybrid key wrapping (POST /v2/multi-recipient/encrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
OpaqueLoginFinishAsync(OpaqueLoginFinishRequest, CancellationToken)¶
Finishes an OPAQUE login and returns the session key (POST /v2/opaque/login/finish).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
OpaqueLoginInitAsync(OpaqueLoginInitRequest, CancellationToken)¶
Starts an OPAQUE login (POST /v2/opaque/login/init).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
OpaqueRegisterFinishAsync(OpaqueRegisterFinishRequest, CancellationToken)¶
Stores an OPAQUE registration record (POST /v2/opaque/register/finish). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
OpaqueRegisterInitAsync(OpaqueRegisterInitRequest, CancellationToken)¶
Starts an OPAQUE registration (POST /v2/opaque/register/init). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PasswordDecryptAsync(PasswordDecryptRequest, CancellationToken)¶
Decrypts a CryptoServiceClient.PasswordEncryptAsync envelope (POST /v2/password/decrypt); the server answers the plaintext as a bare string.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PasswordEncryptAsync(PasswordEncryptRequest, CancellationToken)¶
Encrypts with a password, Argon2id and XChaCha20-Poly1305 (POST /v2/password/encrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PasswordHashAsync(PasswordHashRequest, CancellationToken)¶
Hashes a password with Argon2id (POST /v2/password/hash).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PasswordVerifyAsync(PasswordVerifyRequest, CancellationToken)¶
Verifies a password against a stored Argon2id hash (POST /v2/password/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqDecapsulateAsync(HybridDecapsulateRequest, CancellationToken)¶
Recovers a hybrid KEM shared secret with a server-held key (POST /v2/pq/hybrid/decapsulate).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqEncapsulateAsync(HybridEncapsulateRequest, CancellationToken)¶
Encapsulates a shared secret with the hybrid KEM (POST /v2/pq/hybrid/encapsulate).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqGenerateKeyPairAsync(CancellationToken)¶
Generates a server-held hybrid X25519 and ML-KEM-768 key pair (POST /v2/pq/hybrid/keygen). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqHashSignAsync(SignRequest, CancellationToken)¶
Signs with a server-held SLH-DSA key; the variant comes from the key (POST /v2/pq/slh-dsa/sign).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqHashSignKeygenAsync(SlhDsaKeygenRequest, CancellationToken)¶
Generates a server-held SLH-DSA key pair, FIPS 205 (POST /v2/pq/slh-dsa/keygen). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqHashVerifyAsync(SlhDsaVerifyRequest, CancellationToken)¶
Verifies an SLH-DSA signature (POST /v2/pq/slh-dsa/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqSignAsync(SignRequest, CancellationToken)¶
Signs with a server-held ML-DSA key; the level comes from the key (POST /v2/pq/dsa/sign).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqSignKeygenAsync(MlDsaKeygenRequest, CancellationToken)¶
Generates a server-held ML-DSA key pair, FIPS 204 (POST /v2/pq/dsa/keygen). Stateful: retried only after 429 or 503.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
PqVerifyAsync(MlDsaVerifyRequest, CancellationToken)¶
Verifies an ML-DSA signature (POST /v2/pq/dsa/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
ReadyAsync(CancellationToken)¶
The readiness probe (GET /ready, a public route: no credentials are sent). A server that is not ready answers 503, raised as CryptoApiException.
| Parameter | Description |
|---|---|
cancellationToken |
Cancels the call. |
Returns: The answer.
| Exception | When |
|---|---|
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
RequestAsync(String, String, Nullable<ReadOnlyMemory<Byte>>, String, CancellationToken)¶
Sends one request, once, and returns the answer whatever its status: for a route this client has no method for. Never retried.
| Parameter | Description |
|---|---|
method |
The HTTP method, for example POST. |
path |
The path from the base URL, starting with /. |
body |
The body's bytes, or null for none. |
mediaType |
The body's Content-Type; defaults to application/json. |
cancellationToken |
Cancels the call. |
Returns: The status, media type and body.
| Exception | When |
|---|---|
ArgumentException |
The method is empty, the path does not start with /, or the media type holds a line break. |
CryptoTransportException |
No answer arrived. |
SealedboxOpenAsync(SealedboxOpenRequest, CancellationToken)¶
Opens a sealed box with a server-held X25519 key (POST /v2/sealedbox/open); the server answers the plaintext as a bare string.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SealedboxOpenPqAsync(SealedboxOpenRequest, CancellationToken)¶
Opens a hybrid sealed box with a server-held hybrid key (POST /v2/sealedbox/open-pq); the server answers the plaintext as a bare string.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SealedboxSealAsync(SealedboxSealRequest, CancellationToken)¶
Seals to an X25519 public key, anonymous sender (POST /v2/sealedbox/seal).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SealedboxSealPqAsync(SealedboxSealPqRequest, CancellationToken)¶
Seals to a hybrid X25519 and ML-KEM-768 recipient (POST /v2/sealedbox/seal-pq).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SecretboxOpenAsync(SecretboxOpenRequest, CancellationToken)¶
Opens a secretbox (POST /v2/secretbox/open); the server answers the plaintext as a bare string.
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SecretboxSealAsync(SecretboxSealRequest, CancellationToken)¶
Seals with XChaCha20-Poly1305 (POST /v2/secretbox/seal).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
SignAsync(SignRequest, CancellationToken)¶
Signs with a server-held Ed25519 key (POST /v2/sign).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamIso20022Async(Iso20022VerifyRequest, CancellationToken)¶
Verifies an ISO 20022 dual-signature envelope against the caller's trusted keys (POST /v2/stream/iso20022).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamMultiPqDecryptAsync(StreamMultiPqDecryptRequest, CancellationToken)¶
Decrypts multi-recipient STREAM ciphertext with a server-held hybrid key (POST /v2/stream/multi-pq-decrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamMultiPqEncryptAsync(StreamMultiPqEncryptRequest, CancellationToken)¶
Encrypts for several recipients with hybrid post-quantum STREAM (POST /v2/stream/multi-pq-encrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamPqDecryptAsync(StreamPqDecryptRequest, CancellationToken)¶
Decrypts hybrid post-quantum STREAM ciphertext with a server-held hybrid key (POST /v2/stream/pq-decrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamPqEncryptAsync(StreamPqEncryptRequest, CancellationToken)¶
Encrypts with hybrid post-quantum STREAM: X25519, ML-KEM-768 and XChaCha20-Poly1305 (POST /v2/stream/pq-encrypt).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamSignAsync(StreamSignRequest, CancellationToken)¶
Signs a batch of messages with server-held Ed25519 keys (POST /v2/stream/sign).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
StreamVerifyAsync(StreamVerifyRequest, CancellationToken)¶
Verifies a batch of Ed25519 signatures (POST /v2/stream/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
ToString()¶
Describes the client by its server; never its credentials.
Returns: A description safe to log.
VerifyAsync(VerifyRequest, CancellationToken)¶
Verifies an Ed25519 signature (POST /v2/verify).
| Parameter | Description |
|---|---|
request |
The request. |
cancellationToken |
Cancels the call. |
Returns: The result.
| Exception | When |
|---|---|
ArgumentNullException |
request is null. |
CryptoApiException |
The server answered outside 2xx. |
CryptoTransportException |
No usable answer arrived. |
Properties¶
UserAgent¶
The User-Agent the client sends: crypto-service-sdk-dotnet/<version>.