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.
- 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
- Android: API 21+ (Android 5.0+)
- iOS: 12.0+
- Kotlin: 2.2.20+
- Gradle: 8.0+
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
Note: This project is currently in development and not yet published to any repository. Installation instructions will be available once the project is published.
Once published, you'll be able to install the SDK using:
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")
}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'
}<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>- 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
-
Clone the repository:
git clone https://github.com/SDKForge/Crypto.git SDKForgeCrypto cd SDKForgeCrypto -
Build the project:
./gradlew build
-
Run tests:
./gradlew lint ktlintCheck dependencyGuard apiCheck
-
Generate documentation:
./gradlew dokkaHtml
This library provides cryptographic functionality for Kotlin Multiplatform applications:
- Add dependencies to your project
- Import the crypto modules you need
- Use the unified API for cryptographic operations
- Leverage platform-specific security features automatically
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,
}// 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 an EC key pair (typically 256-bit)
val ecKeyPair = KeyGenerator.generate(
algorithm = KeyAlgorithm.EC,
identifier = "my-ec-key",
keySize = 256
)The library automatically uses platform-specific security features:
- Uses Android Keystore for secure key storage
- Leverages hardware security modules when available
- Integrates with Android's security architecture
- Uses iOS Keychain for secure key storage
- Leverages Secure Enclave when available
- Integrates with iOS security framework
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./gradlew test# Android tests
./gradlew app-android:test
# iOS tests
./gradlew app-ios:test./gradlew internal-benchmark:connectedAndroidTest- API Documentation: Generated with Dokka
- Contributing Guide: CONTRIBUTING.md
- Code of Conduct: CODE_OF_CONDUCT.md
- Security Policy: SECURITY.md
- Create a new module in the
shared-*directory - Apply the appropriate plugins in
build.gradle.kts - Update the main
sharedmodule to export the new module - Add tests and documentation
This project uses KtLint for code formatting. Run the following to check and fix code style:
./gradlew ktlintCheck
./gradlew ktlintFormatThe project uses dependency guard to prevent dependency drift:
./gradlew dependencyGuardWe welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Ensure all checks pass
- Submit a pull request
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
We take security seriously. Please report security vulnerabilities to volodymyr.nevmerzhytskyi@sdkforge.dev.
Do NOT create public GitHub issues for security vulnerabilities.
This project is licensed under the MIT License - see the LICENSE file for details.
- Documentation: Check our documentation
- Issues: GitHub Issues
- Discussions: GitHub Discussions
- Email: volodymyr.nevmerzhytskyi@sdkforge.dev
- 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
- Kotlin Multiplatform team
- Android Security team
- iOS Security team
- JetBrains for excellent tooling
- All contributors and community members
Made with β€οΈ by the SDKForge Team