Skip to content
SDKs · ServerIn developmentView source

Java

Java 17+, on the JDK HttpClient. No third-party HTTP dependency. Wire 8.0 from 0.2.0.

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.

pom.xmlxml
<dependency>
  <groupId>io.rootherald</groupId>
  <artifactId>rootherald-client</artifactId>
  <version>x.y.z</version> <!-- assigned at first release -->
</dependency>

The calls

  • RootHeraldClient.builder().secretKey(…).baseUrl(…).build()
  • relayEnroll(blob) → the 201 body for the device's EnrollComplete / relayActivate(activation) → deviceId. A flat TPM body is the 7.0 shape and is refused locally with IllegalArgumentException.
  • issueChallenge(ChallengeOptions.defaults().ask(ASK_IDENTITY, ASK_POSTURE).expectedDevices(…)) → Challenge(nonce, challenge, expiresAt).
  • verify(evidenceJson, AttestOptions.of(nonce).expectedDevices(…)) → AttestResult(verdict, verdictNode, assuranceClaimsMet, enrollmentRequired, expected); isPass(); a verdict that does not echo the binding is ExpectedNotEnforcedException.
  • issueKeyChallenge(KeyChallengeOptions.of(purpose).expectedDevices(…)), with PURPOSE_SIGN or PURPOSE_DECRYPT, → KeyChallenge(nonce, keyChallenge, expiresAt); certifyKey(nonce, certificationJson) → CertifiedKey(deviceId, keyId, purpose, alg, format, jwk, hardwareBound, certifiedAt).
  • KeySignatures.verifyKeySignature(jwk, message, signature) — ES256 or RS256 by the JWK, java.security, raw or DER.
  • DeviceEncryption.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 javax.crypto and no Root Herald call. A sign key is IllegalArgumentException; a macOS apple-ecies key is EnvelopeFormatNotSupportedException.
  • Exceptions in io.rootherald: InvalidSecretKeyException, ChallengeException, InvalidEvidenceException, InvalidAskException, UnknownPolicyException, AdmissionRefusedException, QuotaExceededException, ActivationRefusedException, RateLimitedException; base RootHeraldApiException carries the other codes. Each is an error code in the API reference.