File tree Expand file tree Collapse file tree 3 files changed +26
-1
lines changed
cryptography-providers-tests/src/commonMain/kotlin
cryptography-providers/apple/src/commonMain/kotlin Expand file tree Collapse file tree 3 files changed +26
-1
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,6 @@ abstract class SupportedAlgorithmsTest(provider: CryptographyProvider) : Provide
5353 assertSupports(RSA .RAW , ! context.provider.isWebCrypto)
5454
5555 assertSupports(PBKDF2 )
56- assertSupports(HKDF , context.provider.isWebCrypto || context.provider.isOpenssl3 )
56+ assertSupports(HKDF )
5757 }
5858}
Original file line number Diff line number Diff line change @@ -33,6 +33,7 @@ internal object AppleCryptographyProvider : CryptographyProvider() {
3333 RSA .RAW -> SecRsaRaw
3434 ECDSA -> SecEcdsa
3535 PBKDF2 -> CCPbkdf2
36+ HKDF -> CCHkdf
3637 else -> null
3738 } as A ?
3839}
Original file line number Diff line number Diff line change 1+ /*
2+ * Copyright (c) 2024 Oleg Yukhnevich. Use of this source code is governed by the Apache 2.0 license.
3+ */
4+
5+ package dev.whyoleg.cryptography.providers.apple.algorithms
6+
7+ import dev.whyoleg.cryptography.*
8+ import dev.whyoleg.cryptography.algorithms.*
9+ import dev.whyoleg.cryptography.providers.apple.*
10+ import dev.whyoleg.cryptography.providers.base.algorithms.*
11+ import platform.CoreCrypto.*
12+
13+ internal object CCHkdf : BaseHkdf(AppleCryptographyProvider ) {
14+ override fun digestSize (digest : CryptographyAlgorithmId <Digest >): Int {
15+ return when (digest) {
16+ SHA1 -> CC_SHA1_DIGEST_LENGTH
17+ SHA224 -> CC_SHA224_DIGEST_LENGTH
18+ SHA256 -> CC_SHA256_DIGEST_LENGTH
19+ SHA384 -> CC_SHA384_DIGEST_LENGTH
20+ SHA512 -> CC_SHA512_DIGEST_LENGTH
21+ else -> throw IllegalStateException (" Unsupported hash algorithm: $digest " )
22+ }
23+ }
24+ }
You can’t perform that action at this time.
0 commit comments