Class ExampleScenario1

Object
ExampleScenario1

public class ExampleScenario1 extends Object
Scenario 1 Example:

Demonstrates generating a post-quantum key (e.g., ML-KEM-512), exporting the resulting key data (in JSON), and using streaming encrypt/decrypt with the newly generated key. Finally, it verifies that the decrypted content matches the original input.

  • Build a GenerateKeySpec specifying kty="ML-KEM" and alg="ML-KEM-512" (or other PQC variants).
  • Set optional usage constraints, including a final expiration date/time and a soft-limit expiration date/time.
  • Call sdk.generateKey(...) to generate the key material.
  • Export the key data (including public portion) via sdk.exportKey(...) to a JSON file.
  • Use sdk.encryptFileStream(...) and sdk.decryptFileStream(...) to protect/unprotect the content.
  • Compare the decrypted data with the original.

The entire flow helps illustrate how to integrate the SDK in your own applications. Authentication details come from cli.properties.

  • Constructor Details

    • ExampleScenario1

      public ExampleScenario1()
  • Method Details

    • main

      public static void main(String[] args)
      Entry point for executing Scenario 1.
      Parameters:
      args - Not used.