DefaultCryptoService

Default implementation of a crypto service for iOS.

The primary goal is to provide a minimal implementation so that unit tests in the commonTest module run successfully.

Beware: It does not implement encryption, decryption, key agreement and message digest correctly.

Constructors

Link copied to clipboard
expect constructor()
actual constructor()
constructor(keyPair: KeyPair, algorithm: CryptoAlgorithm, certificate: Certificate? = null)

Constructor which allows all public keys implemented in KMP-Crypto Because RSA needs the algorithm parameter to be useful (as it cannot be inferred from the key) it's mandatory Also used for custom certificates

actual constructor()

Default constructor without arguments is ES256

Properties

Link copied to clipboard
abstract val algorithm: CryptoAlgorithm
open override val algorithm: CryptoAlgorithm
override val algorithm: CryptoAlgorithm
Link copied to clipboard
abstract val certificate: X509Certificate

May be used in at.asitplus.wallet.lib.cbor.CoseService to transport the signing key for a COSE structure. a null value signifies that raw public keys are used and no certificate is present

open override val certificate: X509Certificate

May be used in at.asitplus.wallet.lib.cbor.CoseService to transport the signing key for a COSE structure. a null value signifies that raw public keys are used and no certificate is present

override val certificate: X509Certificate

May be used in at.asitplus.wallet.lib.cbor.CoseService to transport the signing key for a COSE structure. a null value signifies that raw public keys are used and no certificate is present

Link copied to clipboard
abstract val coseKey: CoseKey
open override val coseKey: CoseKey
override val coseKey: CoseKey
Link copied to clipboard
abstract val jsonWebKey: JsonWebKey
open override val jsonWebKey: JsonWebKey
override val jsonWebKey: JsonWebKey
Link copied to clipboard
abstract val publicKey: CryptoPublicKey
open override val publicKey: CryptoPublicKey
override val publicKey: CryptoPublicKey

Functions

Link copied to clipboard
abstract suspend fun decrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, authTag: ByteArray, algorithm: JweEncryption): KmmResult<ByteArray>
open suspend override fun decrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, authTag: ByteArray, algorithm: JweEncryption): KmmResult<ByteArray>
open suspend override fun decrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, authTag: ByteArray, algorithm: JweEncryption): KmmResult<ByteArray>
Link copied to clipboard
abstract fun encrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, algorithm: JweEncryption): KmmResult<AuthenticatedCiphertext>
open override fun encrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, algorithm: JweEncryption): KmmResult<AuthenticatedCiphertext>
open override fun encrypt(key: ByteArray, iv: ByteArray, aad: ByteArray, input: ByteArray, algorithm: JweEncryption): KmmResult<AuthenticatedCiphertext>
Link copied to clipboard
abstract fun generateEphemeralKeyPair(ecCurve: EcCurve): KmmResult<EphemeralKeyHolder>
open override fun generateEphemeralKeyPair(ecCurve: EcCurve): KmmResult<EphemeralKeyHolder>
open override fun generateEphemeralKeyPair(ecCurve: EcCurve): KmmResult<EphemeralKeyHolder>
Link copied to clipboard
abstract fun messageDigest(input: ByteArray, digest: Digest): KmmResult<ByteArray>
open override fun messageDigest(input: ByteArray, digest: Digest): KmmResult<ByteArray>
open override fun messageDigest(input: ByteArray, digest: Digest): KmmResult<ByteArray>
Link copied to clipboard
abstract fun performKeyAgreement(ephemeralKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
abstract fun performKeyAgreement(ephemeralKey: EphemeralKeyHolder, recipientKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
open override fun performKeyAgreement(ephemeralKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
open override fun performKeyAgreement(ephemeralKey: EphemeralKeyHolder, recipientKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
open override fun performKeyAgreement(ephemeralKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
open override fun performKeyAgreement(ephemeralKey: EphemeralKeyHolder, recipientKey: JsonWebKey, algorithm: JweAlgorithm): KmmResult<ByteArray>
Link copied to clipboard
abstract suspend fun sign(input: ByteArray): KmmResult<CryptoSignature>
open suspend override fun sign(input: ByteArray): KmmResult<CryptoSignature>
open suspend override fun sign(input: ByteArray): KmmResult<CryptoSignature>