cryptography-provider-jdk

Provides implementation of CryptographyProvider via JDK built-in JCA

For supported targets and algorithms, please consult Supported primitives section

Limitations

  • KeyFormat: doesn't support JWK key format yet

Custom Java providers

Some specific algorithms (SHA3 family of digests on JDK 8) or parameters (secp256k1 curve for ECDSA) could be not supported by default JDK provider, but it doesn't mean, that you can not use them with cryptography-kotlin. There is a possibility to create CryptographyProvider from java.util.Provider, f.e. using BouncyCastle:

val provider = CryptographyProvider.JDK(BouncyCastleProvider())

// get some algorithm which not supported on a JDK version or platform (in case of Android)
provider.get(SHA512)

Android support

JDK provider is also tested via Android emulator on API level 21, 27 and 33. Supported algorithms on Android highly depend on Android API level and used provider. Some limitations are:

  • default provider doesn't support RSA-SSA-PSS or SHA3 algorithms

For better compatibility, you can use BouncyCastle provider as shown in #custom-java-providers.

Example

val provider = CryptographyProvider.JDK // or CryptographyProvider.Default

// get some algorithm
provider.get(SHA512)

Using in your projects

dependencies {
implementation("dev.whyoleg.cryptography:cryptography-provider-jdk:0.4.0")
}

Packages

Link copied to clipboard

Provides implementation of CryptographyProvider via JDK built-in JCA