Type-safe Multiplatform cryptography library for Kotlin
CryptographyProvider.Default
.get(SHA512)
.hasher()
.hash("Kotlin is Awesome".encodeToByteArray())
Detailed documentation can be found on project website as well as in API reference
cryptography-kotlin provides multiplatform API which consists of multiple components:
- Secure random with kotlin.Random like API which can be used independently of other modules
- common API to use different cryptography operations, like ciphers, digests and signatures
- multiple algorithms definitions, like AES, RSA, ECDSA and SHA
- multiple cryptography providers, like OpenSSL, WebCrypto and JDK
The library doesn't implement any cryptography algorithm on its own, but wraps well-known future-proof solutions like OpenSSL 3.x, WebCrypto or JCA with type-safe multiplatform API providing uniform experience with aligned default behavior, and same expected results using identical parameters while allowing to use platform-specific capabilities. For supported algorithms, primitives and targets, please consult Providers documentation
Make sure that you use Kotlin 1.9.10+.
Using an earlier Kotlin version could still work, but not tested.
Additionally, it's possible to use BOM or Gradle version catalog to add dependencies easier
repositories {
mavenCentral()
}
dependencies {
implementation("dev.whyoleg.cryptography:cryptography-core:0.3.1")
// some provider
implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:0.3.1")
}
Snapshots of the development version are available in Sonatype's snapshot repository.
repositories {
maven("https://s01.oss.sonatype.org/content/repositories/snapshots/")
}
dependencies {
implementation("dev.whyoleg.cryptography:cryptography-core:0.4.0-SNAPSHOT")
// some provider
implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:0.4.0-SNAPSHOT")
}
For bugs, questions and discussions, please use the GitHub Issues
Copyright 2023 Oleg Yukhnevich.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.