Crypto

expect object Crypto

Cryptographic support routines.

This object contains various cryptographic primitives and is a wrapper to a platform- specific crypto library.

actual object Crypto
actual object Crypto

Cryptographic support routines.

This object contains various cryptographic primitives and is a wrapper to a platform- specific crypto library.

Properties

Link copied to clipboard
expect val provider: String

A human-readable description of the underlying library used.

actual val provider: String
actual val provider: String
Link copied to clipboard

The Elliptic Curve Cryptography curves supported by the platform.

CryptoKit supports the following curves from EcCurve.

Functions

Link copied to clipboard
expect fun checkSignature(publicKey: EcPublicKey, message: ByteArray, algorithm: Algorithm, signature: EcSignature)

Checks signature validity.

actual fun checkSignature(publicKey: <Error class: unknown class>, message: ByteArray, algorithm: <Error class: unknown class>, signature: <Error class: unknown class>)
actual fun checkSignature(publicKey: EcPublicKey, message: ByteArray, algorithm: Algorithm, signature: EcSignature)

Checks signature validity.

Link copied to clipboard

Creates an EC private key.

actual fun createEcPrivateKey(curve: <Error class: unknown class>): <Error class: unknown class>

Creates an EC private key.

Link copied to clipboard
expect fun decrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messageCiphertext: ByteArray, aad: ByteArray? = null): ByteArray

Message decryption.

actual fun decrypt(algorithm: <Error class: unknown class>, key: ByteArray, nonce: ByteArray, messageCiphertext: ByteArray, aad: ByteArray?): ByteArray
actual fun decrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messageCiphertext: ByteArray, aad: ByteArray?): ByteArray

Message decryption.

Link copied to clipboard
expect fun digest(algorithm: Algorithm, message: ByteArray): ByteArray

Message digest function.

actual fun digest(algorithm: <Error class: unknown class>, message: ByteArray): ByteArray
actual fun digest(algorithm: Algorithm, message: ByteArray): ByteArray

Message digest function.

Link copied to clipboard
expect fun encrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray? = null): ByteArray

Message encryption.

actual fun encrypt(algorithm: <Error class: unknown class>, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray?): ByteArray
actual fun encrypt(algorithm: Algorithm, key: ByteArray, nonce: ByteArray, messagePlaintext: ByteArray, aad: ByteArray?): ByteArray

Message encryption.

Link copied to clipboard
expect fun hkdf(algorithm: Algorithm, ikm: ByteArray, salt: ByteArray?, info: ByteArray?, size: Int): ByteArray

Computes an HKDF.

actual fun hkdf(algorithm: <Error class: unknown class>, ikm: ByteArray, salt: ByteArray?, info: ByteArray?, size: Int): ByteArray
actual fun hkdf(algorithm: Algorithm, ikm: ByteArray, salt: ByteArray?, info: ByteArray?, size: Int): ByteArray

Computes an HKDF.

Link copied to clipboard
expect fun hpkeDecrypt(cipherSuite: Algorithm, receiverPrivateKey: EcPrivateKey, cipherText: ByteArray, aad: ByteArray, encapsulatedPublicKey: EcPublicKey): ByteArray

Decrypts data using HPKE according to RFC 9180.

actual fun hpkeDecrypt(cipherSuite: <Error class: unknown class>, receiverPrivateKey: <Error class: unknown class>, cipherText: ByteArray, aad: ByteArray, encapsulatedPublicKey: <Error class: unknown class>): ByteArray
actual fun hpkeDecrypt(cipherSuite: Algorithm, receiverPrivateKey: EcPrivateKey, cipherText: ByteArray, aad: ByteArray, encapsulatedPublicKey: EcPublicKey): ByteArray

Decrypts data using HPKE according to RFC 9180.

Link copied to clipboard
expect fun hpkeEncrypt(cipherSuite: Algorithm, receiverPublicKey: EcPublicKey, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, EcPublicKey>

Encrypts data using HPKE according to RFC 9180.

actual fun hpkeEncrypt(cipherSuite: <Error class: unknown class>, receiverPublicKey: <Error class: unknown class>, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, <Error class: unknown class>>
actual fun hpkeEncrypt(cipherSuite: Algorithm, receiverPublicKey: EcPublicKey, plainText: ByteArray, aad: ByteArray): Pair<ByteArray, EcPublicKey>

Encrypts data using HPKE according to RFC 9180.

Link copied to clipboard
expect fun keyAgreement(key: EcPrivateKey, otherKey: EcPublicKey): ByteArray

Performs Key Agreement.

actual fun keyAgreement(key: <Error class: unknown class>, otherKey: <Error class: unknown class>): ByteArray
actual fun keyAgreement(key: EcPrivateKey, otherKey: EcPublicKey): ByteArray

Performs Key Agreement.

Link copied to clipboard
expect fun mac(algorithm: Algorithm, key: ByteArray, message: ByteArray): ByteArray

Message authentication code function.

actual fun mac(algorithm: <Error class: unknown class>, key: ByteArray, message: ByteArray): ByteArray
actual fun mac(algorithm: Algorithm, key: ByteArray, message: ByteArray): ByteArray

Message authentication code function.

Link copied to clipboard
expect fun sign(key: EcPrivateKey, signatureAlgorithm: Algorithm, message: ByteArray): EcSignature

Signs data with a key.

actual fun sign(key: <Error class: unknown class>, signatureAlgorithm: <Error class: unknown class>, message: ByteArray): <Error class: unknown class>
actual fun sign(key: EcPrivateKey, signatureAlgorithm: Algorithm, message: ByteArray): EcSignature

Signs data with a key.