Skip to content

Module cryptography-provider-openssl3

Provides implementation of CryptographyProvider via OpenSSL 3.x

There are three modules that provide openssl3 provider:

  • cryptography-provider-openssl3-api - provides mapping from cinterop declarations of openssl to cryptography-kotlin API. Module doesn’t provide any configuration of how it should be linked to libcrypto library, and so building final binary will fail unless correct linking arguments will be provided
  • cryptography-provider-openssl3-shared - additionally provides embedded dynamic linking arguments (via cinterop) to libcrypto, so when building final binary openssl3 should be installed on PC where it builds, as well as on PC where this binary will be running. Embedded linking arguments use default paths, where openssl3 is installed, though if it’s installed in a custom directory, additional configuration will be required
  • cryptography-provider-openssl3-prebuilt - unlike shared module, this module embed libcrypto inside module, so no additional setup is needed not to build final binary, not to run it. Embedded OpenSSL version is 3.2.0

For supported targets and algorithms, please consult Supported primitives section

Limitations

  • KeyFormat: doesn’t support JWK key format yet

Example

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

// get some algorithm
provider.get(SHA512)

Using in your projects

dependencies {
    implementation("dev.whyoleg.cryptography:cryptography-provider-openssl3-api:0.4.0")
    // or
    implementation("dev.whyoleg.cryptography:cryptography-provider-openssl3-shared:0.4.0")
    // or
    implementation("dev.whyoleg.cryptography:cryptography-provider-openssl3-prebuilt:0.4.0")
}

Package dev.whyoleg.cryptography.providers.openssl3

Provides implementation of CryptographyProvider via OpenSSL 3.x.