Skip to content

SDKForge/Crypto

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

61 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

SDKForge Crypto

Kotlin Android iOS License Platform

A modern Kotlin Multiplatform cryptographic library for secure key generation, encryption, and digital signatures across Android and iOS platforms. This library provides a unified API for cryptographic operations while leveraging platform-specific security features like Android Keystore and iOS Keychain.

πŸš€ Features

  • Kotlin Multiplatform: Write once, run on Android and iOS
  • Cryptographic Key Generation: RSA and Elliptic Curve (EC) key pair generation
  • Platform-Specific Security: Android Keystore and iOS Keychain integration
  • Unified Crypto API: Consistent interface across platforms for cryptographic operations
  • Modern Architecture: Clean, modular structure with separate modules for different concerns
  • Type-Safe Design: Strongly typed cryptographic primitives and operations
  • Comprehensive Testing: Unit tests, integration tests, and performance benchmarks
  • Code Quality: KtLint, dependency guard, and binary compatibility validation
  • Documentation: Automated API documentation with Dokka
  • CI/CD Ready: GitHub Actions workflows for automated builds and publishing
  • Performance Monitoring: Built-in benchmarking tools

πŸ“± Supported Platforms

  • Android: API 21+ (Android 5.0+)
  • iOS: 12.0+
  • Kotlin: 2.2.20+
  • Gradle: 8.0+

πŸ—οΈ Project Structure

SDKForge-Crypto/
β”œβ”€β”€ app-android/         # Android sample application
β”œβ”€β”€ app-ios/             # iOS sample application
β”œβ”€β”€ app-shared/          # Shared sample UI components (Compose Multiplatform)
β”œβ”€β”€ shared/              # Main crypto library with all components
β”œβ”€β”€ shared-core/         # Core shared functionality
β”œβ”€β”€ shared-domain/       # Cryptographic domain models and operations
β”œβ”€β”€ shared-template/     # Template for shared modules
β”œβ”€β”€ build-logic/         # Gradle build logic and conventions
β”œβ”€β”€ internal-benchmark/  # Performance benchmarks
└── internal-ktlint/     # Custom ktlint rules

πŸ› οΈ Installation

Note: This project is currently in development and not yet published to any repository. Installation instructions will be available once the project is published.

Future Installation (Coming Soon)

Once published, you'll be able to install the SDK using:

Gradle (Kotlin DSL)

dependencies {
    implementation("dev.sdkforge.crypto:crypto:0.0.1")
    implementation("dev.sdkforge.crypto:crypto-domain:0.0.1")
    implementation("dev.sdkforge.crypto:crypto-core:0.0.1")
}

Gradle (Groovy)

dependencies {
    implementation 'dev.sdkforge.crypto:crypto:0.0.1'
    implementation 'dev.sdkforge.crypto:crypto-domain:0.0.1'
    implementation 'dev.sdkforge.crypto:crypto-core:0.0.1'
}

Maven

<dependency>
    <groupId>dev.sdkforge.crypto</groupId>
    <artifactId>crypto</artifactId>
    <version>0.0.1</version>
</dependency>
<dependency>
    <groupId>dev.sdkforge.crypto</groupId>
    <artifactId>crypto-domain</artifactId>
    <version>0.0.1</version>
</dependency>

πŸš€ Quick Start

Prerequisites

  • Java Development Kit (JDK): Version 21 or higher
  • Android Studio: Latest stable version (for Android development)
  • Xcode: Latest stable version (for iOS development, macOS only)
  • Kotlin: Version 2.2.20 or higher
  • Gradle: Version 8.0 or higher

Development Setup

  1. Clone the repository:

    git clone https://github.com/SDKForge/Crypto.git SDKForgeCrypto
    cd SDKForgeCrypto
  2. Build the project:

    ./gradlew build
  3. Run tests:

    ./gradlew lint ktlintCheck dependencyGuard apiCheck
  4. Generate documentation:

    ./gradlew dokkaHtml

Using the Crypto Library

This library provides cryptographic functionality for Kotlin Multiplatform applications:

  1. Add dependencies to your project
  2. Import the crypto modules you need
  3. Use the unified API for cryptographic operations
  4. Leverage platform-specific security features automatically

πŸ“– Usage

Basic Crypto Operations

The library provides a unified interface for cryptographic operations across platforms:

// Common interface (shared-domain/src/commonMain/kotlin/dev/sdkforge/crypto/domain/KeyGenerator.kt)
expect object KeyGenerator {
    suspend fun generate(
        algorithm: KeyAlgorithm,
        identifier: String,
        keySize: Int,
    ): KeyPair
}

// Supported algorithms
enum class KeyAlgorithm {
    RSA,
    EC,
}

Key Generation Examples

Generate RSA Key Pair

// Generate a 2048-bit RSA key pair
val keyPair = KeyGenerator.generate(
    algorithm = KeyAlgorithm.RSA,
    identifier = "my-rsa-key",
    keySize = 2048
)

println("Public Key: ${keyPair.publicKey.algorithm}")
println("Private Key: ${keyPair.privateKey.algorithm}")

Generate Elliptic Curve Key Pair

// Generate an EC key pair (typically 256-bit)
val ecKeyPair = KeyGenerator.generate(
    algorithm = KeyAlgorithm.EC,
    identifier = "my-ec-key",
    keySize = 256
)

Platform-Specific Implementations

The library automatically uses platform-specific security features:

Android Implementation

  • Uses Android Keystore for secure key storage
  • Leverages hardware security modules when available
  • Integrates with Android's security architecture

iOS Implementation

  • Uses iOS Keychain for secure key storage
  • Leverages Secure Enclave when available
  • Integrates with iOS security framework

Library Version Information

Access library version information through the Library object:

// shared/src/commonMain/kotlin/dev/sdkforge/crypto/Library.kt
data object Library {
    const val VERSION = "0.0.1"
}

// Usage
val sdkVersion = Library.VERSION

πŸ§ͺ Testing

Run All Tests

./gradlew test

Run Platform-Specific Tests

# Android tests
./gradlew app-android:test

# iOS tests
./gradlew app-ios:test

Performance Benchmarks

./gradlew internal-benchmark:connectedAndroidTest

πŸ“š Documentation

πŸ”§ Development

Adding New Modules

  1. Create a new module in the shared-* directory
  2. Apply the appropriate plugins in build.gradle.kts
  3. Update the main shared module to export the new module
  4. Add tests and documentation

Code Style

This project uses KtLint for code formatting. Run the following to check and fix code style:

./gradlew ktlintCheck
./gradlew ktlintFormat

Dependency Management

The project uses dependency guard to prevent dependency drift:

./gradlew dependencyGuard

🀝 Contributing

We welcome contributions! Please see our Contributing Guide for details.

Before Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Ensure all checks pass
  6. Submit a pull request

Code of Conduct

This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.

πŸ”’ Security

We take security seriously. Please report security vulnerabilities to volodymyr.nevmerzhytskyi@sdkforge.dev.

Do NOT create public GitHub issues for security vulnerabilities.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ†˜ Support

πŸ—ΊοΈ Roadmap

  • Encryption/Decryption - Add symmetric and asymmetric encryption capabilities
  • Digital Signatures - Implement signing and verification functionality
  • Hash Functions - Add cryptographic hash functions (SHA-256, SHA-512, etc.)
  • Key Exchange - Implement key exchange protocols (ECDH, etc.)
  • Publishing Setup - Configure Maven Central or other repository publishing
  • CI/CD Pipeline - Automated publishing workflows
  • Web platform support - Extend to web platforms
  • Desktop platform support - Add desktop (Windows, macOS, Linux) support
  • Enhanced performance monitoring - Advanced benchmarking and profiling
  • More cryptographic algorithms - Additional encryption and signature algorithms
  • Advanced configuration options - Flexible crypto library configuration
  • Documentation site - Dedicated documentation website

πŸ™ Acknowledgments


Made with ❀️ by the SDKForge Team

About

No description, website, or topics provided.

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Kotlin 98.5%
  • Other 1.5%