Skip to content

Commit 88e1269

Browse files
committed
WebCrypto doesn't support streaming
1 parent 8b42a67 commit 88e1269

File tree

4 files changed

+40
-0
lines changed

4 files changed

+40
-0
lines changed

cryptography-providers/webcrypto/src/commonMain/kotlin/algorithms/WebCryptoAesCbc.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dev.whyoleg.cryptography.algorithms.*
88
import dev.whyoleg.cryptography.providers.webcrypto.internal.*
99
import dev.whyoleg.cryptography.providers.webcrypto.materials.*
1010
import dev.whyoleg.cryptography.random.*
11+
import kotlinx.io.*
1112

1213
internal object WebCryptoAesCbc : WebCryptoAes<AES.CBC.Key>(
1314
algorithmName = "AES-CBC",
@@ -62,4 +63,14 @@ private class AesCbcCipher(private val key: CryptoKey) : AES.IvCipher {
6263
override fun encryptBlocking(plaintext: ByteArray): ByteArray = nonBlocking()
6364
override fun decryptWithIvBlocking(iv: ByteArray, ciphertext: ByteArray): ByteArray = nonBlocking()
6465
override fun encryptWithIvBlocking(iv: ByteArray, plaintext: ByteArray): ByteArray = nonBlocking()
66+
67+
override fun decryptingSource(ciphertext: RawSource): RawSource = nonBlocking()
68+
override fun decryptingSink(plaintext: RawSink): RawSink = nonBlocking()
69+
override fun encryptingSource(plaintext: RawSource): RawSource = nonBlocking()
70+
override fun encryptingSink(ciphertext: RawSink): RawSink = nonBlocking()
71+
72+
override fun encryptingSourceWithIv(iv: ByteArray, plaintext: RawSource): RawSource = nonBlocking()
73+
override fun encryptingSinkWithIv(iv: ByteArray, ciphertext: RawSink): RawSink = nonBlocking()
74+
override fun decryptingSourceWithIv(iv: ByteArray, ciphertext: RawSource): RawSource = nonBlocking()
75+
override fun decryptingSinkWithIv(iv: ByteArray, plaintext: RawSink): RawSink = nonBlocking()
6576
}

cryptography-providers/webcrypto/src/commonMain/kotlin/algorithms/WebCryptoAesCtr.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dev.whyoleg.cryptography.algorithms.*
88
import dev.whyoleg.cryptography.providers.webcrypto.internal.*
99
import dev.whyoleg.cryptography.providers.webcrypto.materials.*
1010
import dev.whyoleg.cryptography.random.*
11+
import kotlinx.io.*
1112

1213
internal object WebCryptoAesCtr : WebCryptoAes<AES.CTR.Key>(
1314
algorithmName = "AES-CTR",
@@ -62,4 +63,14 @@ private class AesCtrCipher(private val key: CryptoKey) : AES.IvCipher {
6263
override fun encryptBlocking(plaintext: ByteArray): ByteArray = nonBlocking()
6364
override fun decryptWithIvBlocking(iv: ByteArray, ciphertext: ByteArray): ByteArray = nonBlocking()
6465
override fun encryptWithIvBlocking(iv: ByteArray, plaintext: ByteArray): ByteArray = nonBlocking()
66+
67+
override fun decryptingSource(ciphertext: RawSource): RawSource = nonBlocking()
68+
override fun decryptingSink(plaintext: RawSink): RawSink = nonBlocking()
69+
override fun encryptingSource(plaintext: RawSource): RawSource = nonBlocking()
70+
override fun encryptingSink(ciphertext: RawSink): RawSink = nonBlocking()
71+
72+
override fun encryptingSourceWithIv(iv: ByteArray, plaintext: RawSource): RawSource = nonBlocking()
73+
override fun encryptingSinkWithIv(iv: ByteArray, ciphertext: RawSink): RawSink = nonBlocking()
74+
override fun decryptingSourceWithIv(iv: ByteArray, ciphertext: RawSource): RawSource = nonBlocking()
75+
override fun decryptingSinkWithIv(iv: ByteArray, plaintext: RawSink): RawSink = nonBlocking()
6576
}

cryptography-providers/webcrypto/src/commonMain/kotlin/algorithms/WebCryptoAesGcm.kt

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import dev.whyoleg.cryptography.algorithms.*
99
import dev.whyoleg.cryptography.providers.webcrypto.internal.*
1010
import dev.whyoleg.cryptography.providers.webcrypto.materials.*
1111
import dev.whyoleg.cryptography.random.*
12+
import kotlinx.io.*
1213

1314
internal object WebCryptoAesGcm : WebCryptoAes<AES.GCM.Key>(
1415
algorithmName = "AES-GCM",
@@ -69,4 +70,14 @@ private class AesGcmCipher(
6970

7071
override fun decryptBlocking(ciphertext: ByteArray, associatedData: ByteArray?): ByteArray = nonBlocking()
7172
override fun encryptBlocking(plaintext: ByteArray, associatedData: ByteArray?): ByteArray = nonBlocking()
73+
74+
override fun decryptingSource(ciphertext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
75+
override fun decryptingSink(plaintext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
76+
override fun encryptingSource(plaintext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
77+
override fun encryptingSink(ciphertext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
78+
79+
override fun encryptingSourceWithIv(iv: ByteArray, plaintext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
80+
override fun encryptingSinkWithIv(iv: ByteArray, ciphertext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
81+
override fun decryptingSourceWithIv(iv: ByteArray, plaintext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
82+
override fun decryptingSinkWithIv(iv: ByteArray, ciphertext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
7283
}

cryptography-providers/webcrypto/src/commonMain/kotlin/algorithms/WebCryptoRsaOaep.kt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import dev.whyoleg.cryptography.algorithms.*
88
import dev.whyoleg.cryptography.operations.*
99
import dev.whyoleg.cryptography.providers.webcrypto.internal.*
1010
import dev.whyoleg.cryptography.providers.webcrypto.materials.*
11+
import kotlinx.io.*
1112

1213
internal object WebCryptoRsaOaep : WebCryptoRsa<RSA.OAEP.PublicKey, RSA.OAEP.PrivateKey, RSA.OAEP.KeyPair>(
1314
algorithmName = "RSA-OAEP",
@@ -40,6 +41,9 @@ private class RsaOaepEncryptor(private val key: CryptoKey) : AuthenticatedEncryp
4041
}
4142

4243
override fun encryptBlocking(plaintext: ByteArray, associatedData: ByteArray?): ByteArray = nonBlocking()
44+
45+
override fun encryptingSource(plaintext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
46+
override fun encryptingSink(ciphertext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
4347
}
4448

4549
private class RsaOaepDecryptor(private val key: CryptoKey) : AuthenticatedDecryptor {
@@ -53,4 +57,7 @@ private class RsaOaepDecryptor(private val key: CryptoKey) : AuthenticatedDecryp
5357
}
5458

5559
override fun decryptBlocking(ciphertext: ByteArray, associatedData: ByteArray?): ByteArray = nonBlocking()
60+
61+
override fun decryptingSource(ciphertext: RawSource, associatedData: ByteArray?): RawSource = nonBlocking()
62+
override fun decryptingSink(plaintext: RawSink, associatedData: ByteArray?): RawSink = nonBlocking()
5663
}

0 commit comments

Comments
 (0)