Skip to content

Commit

Permalink
update conventions, serialization, jdk17
Browse files Browse the repository at this point in the history
  • Loading branch information
JesusMcCloud committed Jan 15, 2024
1 parent 970d169 commit aa4047f
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Build klibs
run: ./gradlew iosArm64MainKlibrary iosX64MainKlibrary
- name: Build XCFrameworks
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Build jar
run: ./gradlew assemble
- name: Upload jar datatypes
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-dry-run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Publish to Maven Local
run: ./gradlew clean datatypes:publishToMavenLocal datatypes-jws:publishToMavenLocal datatypes-cose:publishToMavenLocal
env:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/publish-pages-only.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ jobs:
uses: actions/checkout@v3
with:
submodules: recursive
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '17'
- name: Build Dokka HTML
run: ./gradlew dokkaHtmlMultiModule
- name: Setup Pages
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Publish to Sonatype
run: ./gradlew clean datatypes:publishToSonatype datatypes-jws:publishToSonatype datatypes-cose:publishToSonatype closeSonatypeStagingRepository
env:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Build klibs
run: ./gradlew iosArm64MainKlibrary iosX64MainKlibrary
- name: Run tests
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
- uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '11'
java-version: '17'
- name: Run tests
run: ./gradlew allTests
- name: Test Report
Expand Down
8 changes: 6 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
* Throw new type `Asn1Exception` for ASN.1-related errors
* Throw `IllegalArgumentException` for input-related errors
* Add `xxxOrNull()` functions for all encoding/decoding/parsing functions
* Add `xxxSafe()` functions to encapsulate endocing/decoding in `KmmResult`
* Add `xxxSafe()` functions to encapsulate encoding/decoding in `KmmResult`
* Return `KmmResult` for conversions between different key representations ( i.e. `CryptoPublicKey`, `CoseKey` and `JsonWebKey`)

### 2.2.0
Expand All @@ -45,4 +45,8 @@
* New `CryptoAlgorithm` class
* New `CryptoSignature` class for easy Asn1 - RawByteArray conversion
* Rename function in file `JcaExtensions.kt` from `.toPublicKey` to `.toJcaPublicKey` to reflect connection to JVMname function in file `JcaExtensions.kt` from `.toPublicKey` to `.toJcaPublicKey` to reflect connection to JVM
* Remove VcLib-specific constants
* Remove VcLib-specific constants

#### 2.2.1
* Update conventions
* Rename CBOR annotations
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import org.jetbrains.dokka.gradle.DokkaMultiModuleTask

plugins {
id("at.asitplus.gradle.conventions") version "1.9.20+20231114" //version can be omitted for composite build
id("at.asitplus.gradle.conventions") version "1.9.22+20240115" //version can be omitted for composite build
}
group = "at.asitplus.crypto"

Expand Down
2 changes: 1 addition & 1 deletion datatypes-cose/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("at.asitplus.gradle.conventions")
}

version = "2.2.0"
version = "2.2.1"

kotlin {
jvm()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,36 +6,36 @@ import io.matthewnelson.encoding.base16.Base16
import io.matthewnelson.encoding.core.Encoder.Companion.encodeToString
import kotlinx.serialization.*
import kotlinx.serialization.cbor.ByteString
import kotlinx.serialization.cbor.SerialLabel
import kotlinx.serialization.cbor.CborLabel

/**
* Protected header of a [CoseSigned].
*/
@OptIn(ExperimentalSerializationApi::class)
@Serializable
data class CoseHeader(
@SerialLabel(1)
@CborLabel(1)
@SerialName("alg")
val algorithm: CoseAlgorithm? = null,
@SerialLabel(2)
@CborLabel(2)
@SerialName("crit")
val criticalHeaders: String? = null,
@SerialLabel(3)
@CborLabel(3)
@SerialName("content type")
val contentType: String? = null,
@SerialLabel(4)
@CborLabel(4)
@SerialName("kid")
@ByteString
val kid: ByteArray? = null,
@SerialLabel(5)
@CborLabel(5)
@SerialName("IV")
@ByteString
val iv: ByteArray? = null,
@SerialLabel(6)
@CborLabel(6)
@SerialName("Partial IV")
@ByteString
val partialIv: ByteArray? = null,
@SerialLabel(33)
@CborLabel(33)
@SerialName("x5chain")
@ByteString
// TODO this is wrong in the ISO example of IssuerAuth!?
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import kotlinx.serialization.*
import kotlinx.serialization.builtins.ArraySerializer
import kotlinx.serialization.builtins.ByteArraySerializer
import kotlinx.serialization.cbor.ByteString
import kotlinx.serialization.cbor.SerialLabel
import kotlinx.serialization.cbor.CborLabel
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
Expand Down Expand Up @@ -180,46 +180,46 @@ object CoseKeySerializer : KSerializer<CoseKey> {

@Serializable
private class CoseKeySerialContainer(
@SerialLabel(1)
@CborLabel(1)
@SerialName("kty")
val type: CoseKeyType,
@SerialLabel(2)
@CborLabel(2)
@SerialName("kid")
@ByteString
val keyId: ByteArray? = null,
@SerialLabel(3)
@CborLabel(3)
@SerialName("alg")
val algorithm: CoseAlgorithm? = null,
@SerialLabel(4)
@CborLabel(4)
@SerialName("key_ops")
val operations: Array<CoseKeyOperation>? = null,
@SerialLabel(5)
@CborLabel(5)
@SerialName("Base IV")
@ByteString
val baseIv: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("crv")
val curve: CoseEllipticCurve? = null,
@SerialLabel(-2)
@CborLabel(-2)
@SerialName("x")
@ByteString
val x: ByteArray? = null,
@SerialLabel(-3)
@CborLabel(-3)
@SerialName("y")
@ByteString
val y: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("n")
val n: ByteArray? = null,
@SerialLabel(-2)
@CborLabel(-2)
@SerialName("e")
@ByteString
val e: ByteArray? = null,
@SerialLabel(-4)
@CborLabel(-4)
@SerialName("d")
@ByteString
val d: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("k")
@ByteString
val k: ByteArray? = null
Expand Down Expand Up @@ -261,35 +261,35 @@ object CoseKeySerializer : KSerializer<CoseKey> {

@Serializable
private class CoseEcKeySerialContainer(
@SerialLabel(1)
@CborLabel(1)
@SerialName("kty")
val type: CoseKeyType,
@SerialLabel(2)
@CborLabel(2)
@SerialName("kid")
@ByteString
val keyId: ByteArray? = null,
@SerialLabel(3)
@CborLabel(3)
@SerialName("alg")
val algorithm: CoseAlgorithm? = null,
@SerialLabel(4)
@CborLabel(4)
@SerialName("key_ops")
val operations: Array<CoseKeyOperation>? = null,
@SerialLabel(5)
@CborLabel(5)
@SerialName("Base IV")
@ByteString
val baseIv: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("crv")
val curve: CoseEllipticCurve? = null,
@SerialLabel(-2)
@CborLabel(-2)
@SerialName("x")
@ByteString
val x: ByteArray? = null,
@SerialLabel(-3)
@CborLabel(-3)
@SerialName("y")
@ByteString
val y: ByteArray? = null,
@SerialLabel(-4)
@CborLabel(-4)
@SerialName("d")
@ByteString
val d: ByteArray? = null
Expand All @@ -306,31 +306,31 @@ object CoseKeySerializer : KSerializer<CoseKey> {

@Serializable
private class CoseRsaKeySerialContainer(
@SerialLabel(1)
@CborLabel(1)
@SerialName("kty")
val type: CoseKeyType,
@SerialLabel(2)
@CborLabel(2)
@SerialName("kid")
@ByteString
val keyId: ByteArray? = null,
@SerialLabel(3)
@CborLabel(3)
@SerialName("alg")
val algorithm: CoseAlgorithm? = null,
@SerialLabel(4)
@CborLabel(4)
@SerialName("key_ops")
val operations: Array<CoseKeyOperation>? = null,
@SerialLabel(5)
@CborLabel(5)
@SerialName("Base IV")
@ByteString
val baseIv: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("n")
val n: ByteArray? = null,
@SerialLabel(-2)
@CborLabel(-2)
@SerialName("e")
@ByteString
val e: ByteArray? = null,
@SerialLabel(-4)
@CborLabel(-4)
@SerialName("d")
@ByteString
val d: ByteArray? = null
Expand All @@ -344,24 +344,24 @@ object CoseKeySerializer : KSerializer<CoseKey> {

@Serializable
private class CoseSymmKeySerialContainer(
@SerialLabel(1)
@CborLabel(1)
@SerialName("kty")
val type: CoseKeyType,
@SerialLabel(2)
@CborLabel(2)
@SerialName("kid")
@ByteString
val keyId: ByteArray? = null,
@SerialLabel(3)
@CborLabel(3)
@SerialName("alg")
val algorithm: CoseAlgorithm? = null,
@SerialLabel(4)
@CborLabel(4)
@SerialName("key_ops")
val operations: Array<CoseKeyOperation>? = null,
@SerialLabel(5)
@CborLabel(5)
@SerialName("Base IV")
@ByteString
val baseIv: ByteArray? = null,
@SerialLabel(-1)
@CborLabel(-1)
@SerialName("k")
val k: ByteArray? = null,
) : SerialContainer {
Expand Down Expand Up @@ -407,7 +407,7 @@ object CoseKeySerializer : KSerializer<CoseKey> {
while (true) {
val index = decodeElementIndex(descriptor)
if (index == -1) break
val label = descriptor.getElementAnnotations(index).filterIsInstance<SerialLabel>().first().label
val label = descriptor.getElementAnnotations(index).filterIsInstance<CborLabel>().first().label
when (label) {
labels["kty"] -> type =
decodeSerializableElement(CoseKeyTypeSerializer.descriptor, index, CoseKeyTypeSerializer)
Expand Down
2 changes: 1 addition & 1 deletion datatypes-jws/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ plugins {
id("at.asitplus.gradle.conventions")
}

version = "2.2.0"
version = "2.2.1"

kotlin {
jvm()
Expand Down
2 changes: 1 addition & 1 deletion datatypes/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
id("at.asitplus.gradle.conventions")
}

version = "2.2.0"
version = "2.2.1"

kotlin {
jvm()
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ kotlin.js.compiler=ir
org.gradle.jvmargs=-Xmx4g -Dfile.encoding=UTF-8

# This is not a well-defined property, the ASP convention plugin respects it, though
jvm.version=11
jdk.version=17

0 comments on commit aa4047f

Please sign in to comment.