Class ExampleScenario2
java.lang.Object
co.ankatech.ankasecure.sdk.examples.ExampleScenario2
Scenario 2 — RSA-2048 Streaming Sign / Verify.
This walkthrough illustrates a detached-JWS workflow on a pre-provisioned key (the SDK is data-plane-only — it does not create keys):
- Key resolution — resolve a pre-provisioned RSA-2048 key from the demo playground.
- Streaming sign — the SDK uploads the file in chunks
and receives a detached JWS: flattened JWS JSON
{"protected", "signature"}with RFC 7797"b64": false, carrying nopayloadmember. - Streaming verify — the same detached signature is verified against the binary payload with constant memory.
Rule of thumb:
- Non-streaming → compact JWS / compact JWE
- Streaming → detached JWS / detached JWE
All artefacts are written under temp_files/.
Implementation notes (Java 21+):
- File handling relies on the
PathAPI. - UTF-8 is enforced explicitly for deterministic encoding.
- Directory creation delegates to
ExampleUtil.ensureTempDir(java.nio.file.Path).
Thread-safety: the class is stateless and immutable; all variables are confined to the current thread.
- See Also:
-
Method Summary
-
Method Details
-
main
Runs the RSA-2048 streaming sign/verify scenario.Loads CLI properties, authenticates against ANKASecure©, and delegates to the scenario logic. On any unrecoverable error the JVM terminates via
ExampleUtil.fatal(String, Throwable).- Parameters:
args- command-line arguments (ignored)
-