Skip to content

Using the AnkaSecure SDK in Java

This guide explains how to integrate the AnkaSecure SDK into your Java applications. From configuring Maven/Gradle dependencies to instantiating the SDK and invoking high‑level cryptographic methods, you’ll learn the essential steps to get started.

For a detailed API reference, see our Javadocs.


1. Adding the SDK to Your Project

1.1 Maven Configuration

Add the SDK, its runtime dependencies and build properties to your pom.xml.

<!-- pom.xml -->
<properties>
    <!-- Java toolchain & compilation -->
    <java.version>21</java.version>
    <maven.compiler.release>${java.version}</maven.compiler.release>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

    <!-- Third‑party libraries -->
    <bouncycastle.version>1.80</bouncycastle.version>
    <okhttp.version>4.12.0</okhttp.version>
    <gson.version>2.12.1</gson.version>
    <openapi.generator.version>7.12.0</openapi.generator.version>
</properties>

<dependencies>
    <!-- AnkaSecure SDK -->
    <dependency>
        <groupId>co.ankatech</groupId>
        <artifactId>ankasecure-sdk</artifactId>
        <version>1.0.0</version>
    </dependency>

    <!-- OkHttp (HTTP client) -->
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>okhttp</artifactId>
        <version>${okhttp.version}</version>
    </dependency>
    <!-- Logging interceptor for request / response tracing -->
    <dependency>
        <groupId>com.squareup.okhttp3</groupId>
        <artifactId>logging-interceptor</artifactId>
        <version>${okhttp.version}</version>
    </dependency>

    <!-- Jackson (optional: used by some generated models) -->
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.15.4</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-jsr310</artifactId>
        <version>2.15.4</version>
    </dependency>

    <!-- Gson (default JSON serializer for the generated OpenAPI client) -->
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>${gson.version}</version>
    </dependency>
    <dependency>
        <groupId>io.gsonfire</groupId>
        <artifactId>gson-fire</artifactId>
        <version>1.9.0</version>
    </dependency>

    <!-- SLF4J + Logback (logging façade & implementation) -->
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>2.0.17</version>
    </dependency>
    <dependency>
        <groupId>ch.qos.logback</groupId>
        <artifactId>logback-classic</artifactId>
        <version>1.5.18</version>
    </dependency>

    <!-- Bouncy Castle (cryptographic provider) -->
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcprov-jdk18on</artifactId>
        <version>${bouncycastle.version}</version>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcpkix-jdk18on</artifactId>
        <version>${bouncycastle.version}</version>
    </dependency>
    <dependency>
        <groupId>org.bouncycastle</groupId>
        <artifactId>bcutil-jdk18on</artifactId>
        <version>${bouncycastle.version}</version>
    </dependency>

    <!-- Jakarta Annotations (used by generated models) -->
    <dependency>
        <groupId>jakarta.annotation</groupId>
        <artifactId>jakarta.annotation-api</artifactId>
        <version>3.0.0</version>
    </dependency>

    <!-- Test Suite -->
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.11.4</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.mockito</groupId>
        <artifactId>mockito-junit-jupiter</artifactId>
        <version>5.15.2</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<repositories>
    <repository>
        <id>anka-maven-repo</id>
        <name>Anka Maven Repository</name>
        <url>https://repo.ankatech.co/maven</url>
    </repository>
    <!-- Add additional repositories here if your organisation mandates them -->
</repositories>