Class ExampleScenario4

java.lang.Object
co.ankatech.ankasecure.sdk.examples.ExampleScenario4

public final class ExampleScenario4 extends Object
Scenario 4 — Streaming Re-encrypt (RSA-3072 → ML-KEM-768).

This scenario demonstrates how to migrate classical RSA-encrypted data to a post-quantum ML-KEM-encrypted format without exposing plaintext. All cryptographic operations use the streaming API, meaning the service exchanges a two-part detached JWE (General-JSON header + raw ciphertext stream).

The SDK is data-plane-only: it does not create keys. This scenario operates on the pre-provisioned granted cross-kid pair of the demo-cli playground — source cli-reencrypt2-source (RSA-3072) and target cli-reencrypt2-target (ML-KEM-768). The cli-reference actor holds the cross-kid REENCRYPT grant on this pair plus the atomic encrypt/decrypt grants on each endpoint.

  1. Resolve the granted RSA-3072 source and ML-KEM-768 target kids.
  2. Stream-encrypt a file under the source (detached JWE).
  3. Re-encrypt the ciphertext on the server (RSA → KEM).
  4. Stream-decrypt with the KEM target key.
  5. Validate round-trip integrity.

Temporary artefacts are placed under temp_files/.

Implementation notes (Java 21+):

Thread-safety: this class is stateless and immutable.

Since:
3.0.0
Author:
ANKATech Solutions Inc.
See Also:
  • Method Details

    • main

      public static void main(String[] args)
      Runs the RSA-3072 to ML-KEM-768 streaming re-encryption 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)