Skip to content
SDKs · ServerIn developmentView source

.NET

Managed C# over HttpClient, .NET 8 LTS and 9. Auth is attached per request, so an injected HttpClient is never mutated. Wire 8.0 from 0.1.0-preview.5.

In development

This SDK is implemented but not yet published to its package registry. Until it ships, collect an opaque evidence blob on the device and appraise it server-side with @rootherald/node (or any available server SDK). The API shown below is the planned surface and may change before release.

terminalbash
dotnet add package RootHerald.AspNetCore

The calls

  • new RootHeraldClient(secretKey, baseUrl?, httpClient?)
  • RelayEnrollAsync(blob) → the 201 body for the device's EnrollComplete / RelayActivateAsync(activation) → DeviceId. A flat TPM body is the 7.0 shape and is refused locally with ArgumentException.
  • IssueChallengeAsync(new ChallengeOptions { Ask = [Ask.Identity, Ask.Posture], ExpectedKey, ExpectedDevices }) → RootHeraldChallenge(Nonce, Challenge, ExpiresAt).
  • VerifyAsync(evidence, new AttestOptions { Nonce, ExpectedKey, ExpectedDevices }) → AttestResult: Verdict, IsPass, DeviceId, VerdictData, Expected, EnrollmentRequired, AssuranceClaimsMet; a verdict that does not echo the binding is ExpectedNotEnforcedException.
  • IssueKeyChallengeAsync(new KeyChallengeOptions { Purpose, ExpectedDevices }) → RootHeraldKeyChallenge(Nonce, KeyChallenge, ExpiresAt); CertifyKeyAsync(nonce, certification) → CertifiedKey(DeviceId, KeyId, Purpose, Alg, Format, Jwk, HardwareBound, CertifiedAt). Purpose is KeyPurpose.Sign or KeyPurpose.Decrypt; Format is set on a decrypt key.
  • RootHeraldClient.VerifyKeySignature(jwk, message, signature) — ES256 or RS256 by the JWK, System.Security.Cryptography, raw or DER, never throws.
  • RootHeraldClient.EncryptToDevice(key, plaintext) → the JWE compact serialization as a string. ECDH-ES for an EC key, RSA-OAEP-256 for an RSA key, A256GCM for both, with System.Security.Cryptography and no Root Herald call. A sign key is ArgumentException; a macOS apple-ecies key is EnvelopeFormatNotSupportedException.
  • Exceptions: InvalidSecretKeyException, ChallengeException, InvalidEvidenceException, InvalidAskException, UnknownPolicyException, AdmissionRefusedException, QuotaExceededException, ActivationRefusedException, RateLimitedException; base RootHeraldApiException carries the other codes. Each is an error code in the API reference.