Package co.ankatech.ankasecure.sdk.examples
package co.ankatech.ankasecure.sdk.examples
-
ClassesClassDescriptionExampleMenu is the CLI entry point that provides an interactive menu of example scenarios.Scenario 1 Example:Scenario 10 Example (non-streaming): Generates a post-quantum key (ML-KEM-1024) via
generateKey(GenerateKeySpec)
Exports the resulting key data (JSON) to a file Encrypts a file (non-streaming) with the newly created key Decrypts the file (non-streaming) Validates that the decrypted data matches the originalScenario 11 Example (non-streaming signatures): Generates a Dilithium5 key (post-quantum signature algorithm) viagenerateKey(GenerateKeySpec)
Signs a file in non-streaming mode Exports the public key portion (as part of the entire key data) Verifies the signature in non-streaming modeScenario 12 Example: Generate an RSA-2048 key (oldKid) Sign a file (streaming) with RSA-2048 Generate a FALCON-1024 key (newKid) Re-sign the file in streaming mode (oldSignature => newSignature) Verify the new signature in streaming modeScenario 13 Example: Create a temporary PKCS#12 file containing an RSA keypair + self-signed cert. Import that .p12 into the encryption service as a new kid. Sign a file (streaming) using that kid. Export the key data from that kid (the entire JSON, which includes public key information). Encrypt using that kid (non-streaming). Decrypt using that same kid (private key) in the encryption service.Scenario 14 Example: List existing keys. Create (generate) a post-quantum key usingkty="ML-KEM"
andalg="ML-KEM-768"
. Export the entire key (including public key info) to a JSON file. Remove the newly generated key from the service. Import the key back in (public part only) by reading the JSON file and callingimportKey
. Obtain license info and print it.Scenario 15 Example: Create (generate) a post-quantum signature key (Dilithium5) viaGenerateKeySpec
. Export the entire key (JSON), which includes the public key. Sign a file in streaming mode with the private key on the server. Verify the signature usingverifySignatureUtilityStream
, reading the exported JSON to extract the public key.Scenario 16 Example: Create (generate) a post-quantum asymmetric key (ML-KEM-1024). Export the entire key (JSON), which includes the public key. Encrypt a file using the public key (utility-stream) without storing that key on the server. Decrypt the file using the private key (kid) in streaming mode. Validate that the decrypted content matches the original data.Scenario 2 Example: Authenticates withclientId
andclientSecret
. Generates an asymmetric RSA key (e.g.Scenario 3 Example: Authenticates usingclientId
andclientSecret
Generates a symmetric AES-256 key (usinggenerateKey(GenerateKeySpec)
) Encrypts a file in streaming mode with that key Decrypts the file in streaming mode Compares original and decrypted contentScenario 4 Example: Generate an RSA-2048 key Encrypt a file (streaming) with RSA Generate an ML-KEM-1024 key (post-quantum KEM) Re-encrypt the file (streaming) from RSA to ML-KEM-1024 Decrypt using ML-KEM-1024 (streaming)Scenario 5 Example (non-streaming): Generates a post-quantum asymmetric key (ML-KEM-512) Exports the entire key data (JSON) to a file Encrypts a file (non-streaming) with the newly created key Decrypts the file (non-streaming) Verifies final decrypted content matches the originalScenario 6 Example (non-streaming signatures): Authenticates withclientId
andclientSecret
Generates a post-quantum Dilithium5 key (usinggenerateKey(GenerateKeySpec)
) Signs a file in non-streaming mode Exports the entire key data (JSON), which includes the public portion Verifies the signature in non-streaming modeScenario 7 Example (non-streaming): Authenticates usingclientId
andclientSecret
Generates a symmetric AES-256 key (usinggenerateKey(GenerateKeySpec)
) Encrypts a file (non-streaming) Decrypts the file (non-streaming) Verifies that the decrypted content matches the originalScenario 8 Example (non-streaming): Generates an EC-521 key (classical) Encrypts a file with EC-521 (non-streaming) Generates an ML-KEM-768 key (post-quantum KEM) Re-encrypts the file from EC-521 to ML-KEM-768 (non-streaming) Decrypts the file using ML-KEM-768 (non-streaming)Scenario 9 Example (non-streaming): Generates an RSA-2048 key (oldKid) Signs a file (non-streaming) with RSA-2048 Generates a Dilithium3 key (newKid) Re-signs the data from RSA to Dilithium3 (non-streaming) Verifies the newly created signature using Dilithium3