From 21395464becbc54c07bb0a39293d5fa129f43902 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bernd=20Pr=C3=BCnster?= Date: Fri, 20 Sep 2024 14:32:36 +0200 Subject: [PATCH] Release 3.8.0 (Supreme 0.3.0) --- CHANGELOG.md | 8 ++++---- gradle.properties | 4 ++-- .../indispensable/asn1/encoding/Asn1Decoding.kt | 14 +++++++------- .../signum/supreme/os/AndroidKeyStoreProvider.kt | 2 +- .../at/asitplus/signum/supreme/SignatureResult.kt | 2 +- 5 files changed, 15 insertions(+), 15 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4ecc3338..cc49e6c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,8 +1,9 @@ # Changelog -## 4.0 -### 4.0.0 (Supreme 0.3.0) Breaking Changes Ahead! +## 3.0 + +### 3.8.0 (Supreme 0.3.0) Breaking Changes Ahead! * Completely revamped ASN.1 Tag Handling * Properly handle multi-byte tags * Introduce a new data structure `TLV.Tag` with an accompanying `TagClass` enum and a `constructed` flag to accurately represent arbitrary tags up to `ULong.MAX_VALUE` @@ -43,8 +44,7 @@ * `decodeToXXX` to be invoked on an `Asn1Primitive` to decode a DER-encoded primitive into the target type * `decodeFromAsn1ContentBytes` to be invoked on the companion of the target type to decode the content bytes of a TLV primitive (the _V_ in TLV) * Update conventions -> Coroutines 1.0.9 - -## 3.0 +* replace `runCatching` with `catching` to be extra-safe ### 3.7.0 (Supreme 0.2.0) * Remove Swift verifier logic to obtain a general speed-up diff --git a/gradle.properties b/gradle.properties index 6e760a07..2f8e9092 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,8 +2,8 @@ kotlin.code.style=official kotlin.js.compiler=ir org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8 -artifactVersion=4.0.0-SNAPSHOT -supremeVersion=0.3.0-SNAPSHOT +artifactVersion=3.8.0 +supremeVersion=0.3.0 # This is not a well-defined property, the ASP convention plugin respects it, though jdk.version=17 diff --git a/indispensable/src/commonMain/kotlin/at/asitplus/signum/indispensable/asn1/encoding/Asn1Decoding.kt b/indispensable/src/commonMain/kotlin/at/asitplus/signum/indispensable/asn1/encoding/Asn1Decoding.kt index 01a59b75..1a995fe5 100644 --- a/indispensable/src/commonMain/kotlin/at/asitplus/signum/indispensable/asn1/encoding/Asn1Decoding.kt +++ b/indispensable/src/commonMain/kotlin/at/asitplus/signum/indispensable/asn1/encoding/Asn1Decoding.kt @@ -105,7 +105,7 @@ private fun ByteIterator.doParseSingle(): Asn1Element = runRethrowing { fun Asn1Primitive.decodeToBoolean() = runRethrowing { decode(Asn1Element.Tag.BOOL) { Boolean.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToBoolean] */ -fun Asn1Primitive.decodeToBooleanOrNull() = runCatching { decodeToBoolean() }.getOrNull() +fun Asn1Primitive.decodeToBooleanOrNull() = catching { decodeToBoolean() }.getOrNull() /** * decodes this [Asn1Primitive]'s content into an [Int] @@ -115,7 +115,7 @@ fun Asn1Primitive.decodeToBooleanOrNull() = runCatching { decodeToBoolean() }.ge fun Asn1Primitive.decodeToInt() = runRethrowing { decode(Asn1Element.Tag.INT) { Int.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToInt] */ -fun Asn1Primitive.decodeToIntOrNull() = runCatching { decodeToInt() }.getOrNull() +fun Asn1Primitive.decodeToIntOrNull() = catching { decodeToInt() }.getOrNull() /** * decodes this [Asn1Primitive]'s content into a [Long] @@ -125,7 +125,7 @@ fun Asn1Primitive.decodeToIntOrNull() = runCatching { decodeToInt() }.getOrNull( fun Asn1Primitive.decodeToLong() = runRethrowing { decode(Asn1Element.Tag.INT) { Long.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToLong] */ -inline fun Asn1Primitive.decodeToLongOrNull() = runCatching { decodeToLong() }.getOrNull() +inline fun Asn1Primitive.decodeToLongOrNull() = catching { decodeToLong() }.getOrNull() /** * decodes this [Asn1Primitive]'s content into an [UInt] @@ -135,7 +135,7 @@ inline fun Asn1Primitive.decodeToLongOrNull() = runCatching { decodeToLong() }.g fun Asn1Primitive.decodeToUInt() = runRethrowing { decode(Asn1Element.Tag.INT) { UInt.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToUInt] */ -inline fun Asn1Primitive.decodeToUIntOrNull() = runCatching { decodeToUInt() }.getOrNull() +inline fun Asn1Primitive.decodeToUIntOrNull() = catching { decodeToUInt() }.getOrNull() /** * decodes this [Asn1Primitive]'s content into an [ULong] @@ -145,7 +145,7 @@ inline fun Asn1Primitive.decodeToUIntOrNull() = runCatching { decodeToUInt() }.g fun Asn1Primitive.decodeToULong() = runRethrowing { decode(Asn1Element.Tag.INT) { ULong.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToULong] */ -inline fun Asn1Primitive.decodeToULongOrNull() = runCatching { decodeToULong() }.getOrNull() +inline fun Asn1Primitive.decodeToULongOrNull() = catching { decodeToULong() }.getOrNull() /** Decode the [Asn1Primitive] as a [BigInteger] * @throws [Asn1Exception] on invalid input */ @@ -154,7 +154,7 @@ fun Asn1Primitive.decodeToBigInteger() = runRethrowing { decode(Asn1Element.Tag.INT) { BigInteger.decodeFromAsn1ContentBytes(it) } } /** Exception-free version of [decodeToBigInteger] */ -inline fun Asn1Primitive.decodeToBigIntegerOrNull() = runCatching { decodeToBigInteger() }.getOrNull() +inline fun Asn1Primitive.decodeToBigIntegerOrNull() = catching { decodeToBigInteger() }.getOrNull() /** * transforms this [Asn1Primitive] into an [Asn1String] subtype based on its tag @@ -183,7 +183,7 @@ fun Asn1Primitive.asAsn1String(): Asn1String = runRethrowing { fun Asn1Primitive.decodeToString() = runRethrowing {asAsn1String().value} /** Exception-free version of [decodeToString] */ -fun Asn1Primitive.decodeToStringOrNull() = runCatching { decodeToString() }.getOrNull() +fun Asn1Primitive.decodeToStringOrNull() = catching { decodeToString() }.getOrNull() diff --git a/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt b/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt index a48e144b..dcf3b220 100644 --- a/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt +++ b/supreme/src/androidMain/kotlin/at/asitplus/signum/supreme/os/AndroidKeyStoreProvider.kt @@ -236,7 +236,7 @@ object AndroidKeyStoreProvider: val publicKey: CryptoPublicKey val attestation: AndroidKeystoreAttestation? ks.getCertificateChain(alias).let { chain -> - runCatching { chain.map { X509Certificate.decodeFromDer(it.encoded) } }.let { r -> + catching { chain.map { X509Certificate.decodeFromDer(it.encoded) } }.let { r -> if (r.isSuccess) r.getOrThrow().let { publicKey = it.leaf.publicKey attestation = if (it.size > 1) AndroidKeystoreAttestation(it) else null diff --git a/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/SignatureResult.kt b/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/SignatureResult.kt index 9fca72ed..ca3c29d5 100644 --- a/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/SignatureResult.kt +++ b/supreme/src/commonMain/kotlin/at/asitplus/signum/supreme/SignatureResult.kt @@ -58,6 +58,6 @@ inline fun CryptoSignature.RawByteEncodable): SignatureResult<*> = - runCatching { fn() }.fold( + catching { fn() }.fold( onSuccess = { SignatureResult.Success(it) }, onFailure = { SignatureResult.FromException(it) })