cryptography-kotlin¶
A cryptography library for Kotlin Multiplatform, which wraps well-known future-proof platform-native solutions like OpenSSL, CryptoKit, WebCrypto or JCA with a type-safe uniform API, aligned defaults as well as tested for cross-compatibility between platforms.
// get a hasher
val sha = CryptographyProvider.Default.get(SHA512).hasher()
// hash a message
sha.hash("Kotlin is Awesome".encodeToByteArray())
- New here? Check out the Getting Started guide
- How are operations and keys organized? See Primitives
- Which algorithms are supported? Check Operations
- Need the API docs? See the API Reference
Standalone modules¶
The following modules can be used independently of the main cryptography API, without pulling in any providers or algorithm definitions.
| Module | Description |
|---|---|
| cryptography-random | Platform-dependent CSPRNG via kotlin Random API |
| cryptography-bigint | Arbitrary-precision integer for multiplatform |
| cryptography-serialization-pem | PEM encoding/decoding (RFC 7468) |
| cryptography-serialization-asn1 | ASN.1/DER binary serialization via kotlinx.serialization |