Skip to content

🔹 Client SDK Overview

Introduction

AnkaSecure provides a Client SDK to simplify the integration of cryptographic operations into applications. The SDK abstracts REST API interactions, enabling seamless encryption, decryption, key management, and digital signing operations.

The SDK is available in multiple languages to ensure easy adoption across different platforms.

Supported SDKs

Language SDK Availability
Java ✅ Available

📌 Note: The SDKs are designed to work with AnkaSecure Cloud (SaaS) and On-Premise deployments.


Key Features

Seamless integration with AnkaSecure API
Automatic authentication via clientId & clientSecret
Support for Post-Quantum Cryptography (PQC)
File-based and streaming encryption
Hybrid cryptography support (PQC & classical)
Error handling and exception management


How the SDK Works

The SDK communicates with AnkaSecure API Endpoints to perform cryptographic operations. Below is the architecture of how applications interact with the SDK:

graph TD
    A[Customer Applications] -->|Calls SDK| B[Client SDK];
    B -->|Authenticates & Sends Requests| C[AnkaSecure API];
    C -->|Processes Crypto Operations| D[Crypto Engine];
    C -->|Manages Keys| E[Key Store];

Quick Example: Encrypt & Decrypt (Java)

This example demonstrates:

  1. Authentication with the SDK.

  2. Generating a post-quantum key (ML-KEM-512).

  3. Encrypting and decrypting a file in streaming mode.

  4. Verifying that the decrypted data matches the original input.

import co.ankatech.ankasecure.sdk.AnkaSecureSdk;
import co.ankatech.ankasecure.sdk.model.GenerateKeySpec;
import co.ankatech.ankasecure.sdk.exception.AnkaSecureSdkException;
import java.io.*;

public class AnkaSecureExample {
    public static void main(String[] args) {
        try {
            // Initialize SDK with authentication details
            AnkaSecureSdk sdk = new AnkaSecureSdk("yourClientId", "yourClientSecret");
            sdk.authenticateApplication();

            // Generate a post-quantum key
            String kid = "testKey_" + System.currentTimeMillis();
            GenerateKeySpec keySpec = new GenerateKeySpec();
            keySpec.setKid(kid);
            keySpec.setKty("ML-KEM");
            keySpec.setAlg("ML-KEM-512");
            sdk.generateKey(keySpec);
            System.out.println("Generated key: " + kid);

            // Encrypt a file
            File inputFile = new File("input.txt");
            File encryptedFile = new File("encrypted.dat");
            sdk.encryptFileStream(kid, inputFile.getAbsolutePath(), encryptedFile.getAbsolutePath());
            System.out.println("File encrypted successfully.");

            // Decrypt the file
            File decryptedFile = new File("decrypted.txt");
            sdk.decryptFileStream(kid, encryptedFile.getAbsolutePath(), decryptedFile.getAbsolutePath());
            System.out.println("File decrypted successfully.");

            // Validate original vs decrypted
            String originalText = new String(java.nio.file.Files.readAllBytes(inputFile.toPath()));
            String decryptedText = new String(java.nio.file.Files.readAllBytes(decryptedFile.toPath()));
            if (originalText.equals(decryptedText)) {
                System.out.println("✅ Success: Decrypted content matches the original.");
            } else {
                System.err.println("❌ Error: Decrypted content does not match.");
            }

        } catch (AnkaSecureSdkException | IOException e) {
            System.err.println("Error: " + e.getMessage());
        }
    }
}

SDK Operations

The SDK supports various cryptographic operations, including:

🔑 Key Management

  • Generate a key: sdk.generateKey(kty, alg, kid);

  • Export a key: sdk.exportKey(kid);

  • List keys: sdk.listKeys();

  • Revoke a key: sdk.revokeKey(kid);

🔒 Encryption & Decryption

  • Encrypt data: sdk.encrypt(data, kid);

  • Decrypt data: sdk.decrypt(encryptedData, kid);

  • Encrypt file (streaming): sdk.encryptFileStream(kid, inputPath, outputPath);

  • Decrypt file (streaming): sdk.decryptFileStream(kid, encryptedPath, decryptedPath);

Digital Signatures

  • Sign data: sdk.sign(data, kid);

  • Verify signature: sdk.verify(signedData, kid);


Installation & Setup

Java SDK

Maven Dependency

<dependency>
    <groupId>co.ankatech.ankasecure</groupId>
    <artifactId>ankasecure-sdk</artifactId>
    <version>1.0.0</version>
</dependency>

Gradle

implementation 'co.ankatech.ankasecure:ankasecure-sdk:1.0.0'

Why Use AnkaSecure SDK?

Reduces development effort -- No need to handle raw API calls.

Built-in security -- Automatic API authentication and request signing.

Supports post-quantum cryptography -- Ensures long-term security.

Enterprise-ready -- Works with HSMs, SIEMs, and secure vaults.

For more details, visit the SDK Integration Guide.