Skip to content

Commit

Permalink
Feature/more targets (#186)
Browse files Browse the repository at this point in the history
* More targets for `indispensable`,  `indispensable-josef`, `indispensable-cosef`
    * JVM
    * Android
    * iOS
    * watchOS
    * tvOS
    * JS
    * wasm/JS
    * Linux X64
    * Linux AARCH64
    * MinGw X64
* Multibase 1.2.1
* `JwsSigned.prepareSignatureInput` now returns a raw ByteArray
* Tests that do not depend on BouncyCastle/JCA are now performed for all targets
* Remove Napier dependency
  • Loading branch information
JesusMcCloud authored Nov 7, 2024
1 parent aa7c896 commit 3d3ab77
Show file tree
Hide file tree
Showing 30 changed files with 373 additions and 287 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ jobs:
name: Indispensable-debug.xcframework
path: |
indispensable/build/XCFrameworks/debug/
- name: Upload debug XCFramework Indispensable-ASN.1
uses: actions/upload-artifact@v3
with:
name: IndispensableAsn1-debug.xcframework
path: |
indispensable-asn1/build/XCFrameworks/debug/
- name: Upload debug XCFramework IndispensableJosef
uses: actions/upload-artifact@v3
with:
Expand All @@ -34,6 +40,12 @@ jobs:
name: IndispensableCosef-debug.xcframework
path: |
indispensable-cosef/build/XCFrameworks/debug/
- name: Upload release XCFramework Indispensable-ASN.1
uses: actions/upload-artifact@v3
with:
name: IndispensableAsn1-release.xcframework
path: |
indispensable-asn1/build/XCFrameworks/release/
- name: Upload release XCFramework Indispensable
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 7 additions & 1 deletion .github/workflows/build-jvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@ jobs:
java-version: '17'
- name: Build jar
run: ./gradlew assemble
- name: Upload jar datatypes
- name: Upload jar indispensable-asn1
uses: actions/upload-artifact@v3
with:
name: indispensable-asn1
path: |
indispensable-asn1/build/libs/*jar
- name: Upload jar indispensable
uses: actions/upload-artifact@v3
with:
name: indispensable
Expand Down
18 changes: 15 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
The public API remains almost unchanged, except for some methods migrating from a ByteIterator to kotlinx-io Source,
some newly added kotlinx-io helpers and OID changes. The internals have changed substantially, however.
Be sure to match Signum versions if multiple libraries pull it in as transitive dependency.
Be sure to match Signum versions if multiple libraries pull it in as transitive dependency.
Better safe than sorry!

* Discrete ASN.1 module `indispensable-asn1` supporting the following platforms:
Expand All @@ -21,7 +20,19 @@ Better safe than sorry!
* Linux X64
* Linux AARCH64
* MinGw X64
* More targets for `indispensable`, `indispensable-josef`, `indispensable-cosef`
* JVM
* Android
* iOS
* watchOS
* tvOS
* JS
* wasm/JS
* Linux X64
* Linux AARCH64
* MinGw X64
* KmmResult 1.9.0
* Multibase 1.2.1
* Introduce generic tag assertion to `Asn1Element`
* Change CSR to take an actual `CryptoSignature` instead of a ByteArray
* Introduce shorthand to create CSR from TbsCSR
Expand All @@ -33,8 +44,6 @@ Better safe than sorry!
* Implement hash-to-curve and hash-to-scalar as per RFC9380
* Rename `decodeFromDerHexString` to `parseFromDerHexString`
* Move `ensureSize` from package `asn1` to `misc`
* `JwsSigned.plainSignatureInput` is now a raw ByteArray
* `JwsSigned.prepareSignatureInput` now returns a raw ByteArray
* Use kotlinx-io as primary source for parsing
* Base number encoding/decoding on kotlinx-io
* Remove parsing from iterator
Expand All @@ -44,6 +53,9 @@ Better safe than sorry!
* Remove Legacy iOS Attestation
* Add type parameter to `JwsSigned` for its payload
* Add type parameter to `JweDecrypted` for its payload
* `JwsSigned.prepareSignatureInput` now returns a raw ByteArray
* Tests that do not depend on BouncyCastle/JCA are now performed for all targets
* Remove Napier dependency

### 3.9.0 (Supreme 0.4.0)

Expand Down
5 changes: 3 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[versions]
core = "1.5.0"
kotlinxIoCore = "0.5.4"
multibase = "1.2.0"
multibase = "1.2.1"
kotestExtensionsAndroid = "0.1.3"
kotestRunnerAndroid = "1.1.1"
okio = "3.9.0"
Expand All @@ -10,7 +10,7 @@ jose = "9.31"
kotlinpoet = "1.16.0"
runner = "1.5.2"
kotest = "5.9.1"
kmmresult = "1.9.0"
secureRandom = "0.3.2"

[libraries]
bignum = { group = "com.ionspin.kotlin", name = "bignum", version.ref = "bignum" }
Expand All @@ -24,3 +24,4 @@ kotlinpoet = { group = "com.squareup", name = "kotlinpoet", version.ref = "kotli
rules = { module = "androidx.test:rules", version.ref = "core" }
runner = { module = "androidx.test:runner", version.ref = "runner" }
multibase = { module = "at.asitplus:multibase", version.ref = "multibase" }
securerandom = { module = "org.kotlincrypto:secure-random", version.ref = "secureRandom" }
6 changes: 0 additions & 6 deletions indispensable-asn1/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,9 @@ kotlin {
commonTest {
dependencies {
implementation(kotest("property"))
}
}

jvmTest {
dependencies {
implementation(project(":indispensable"))
}
}

}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package at.asitplus.signum.indispensable
package at.asitplus.signum.indispensable.asn1

import at.asitplus.signum.indispensable.asn1.encoding.Asn1
import at.asitplus.signum.indispensable.asn1.Asn1PrimitiveOctetString
import at.asitplus.signum.indispensable.asn1.Asn1StructuralException
import io.kotest.assertions.throwables.shouldThrow
import io.kotest.core.spec.style.FreeSpec
import io.kotest.matchers.shouldBe
Expand Down Expand Up @@ -55,7 +53,9 @@ class CastingTest : FreeSpec({
shouldThrow<Asn1StructuralException> { Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.asSequence() }
shouldThrow<Asn1StructuralException> { Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.asSet() }
shouldThrow<Asn1StructuralException> { Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.asPrimitiveOctetString() }
shouldThrow<Asn1StructuralException> { Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.asEncapsulatingOctetString() }
shouldThrow<Asn1StructuralException> {
Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.asEncapsulatingOctetString()
}

Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.let { it.asStructure() shouldBe it }
Asn1.ExplicitlyTagged(19u) { +Asn1.Null() }.let { it.asExplicitlyTagged() shouldBe it }
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:OptIn(ExperimentalStdlibApi::class)

package at.asitplus.signum.indispensable.asn1

import io.kotest.core.spec.style.FreeSpec
Expand Down Expand Up @@ -63,15 +61,15 @@ class TagSortingTest : FreeSpec({

a.compareTo(b) shouldBe tagA.compareTo(tagB)

if(tagA.encodedTagLength < tagB.encodedTagLength) {
if (tagA.encodedTagLength < tagB.encodedTagLength) {
aTags.forEach { it shouldBeLessThan tagB }
}
if(tagA.encodedTagLength>tagB.encodedTagLength) {
aTags.forEach { it shouldBeGreaterThan tagB }
if (tagA.encodedTagLength > tagB.encodedTagLength) {
aTags.forEach { it shouldBeGreaterThan tagB }
}

if(tagA.encodedTagLength==tagB.encodedTagLength) {
aTags.filterNot { it.tagClass==TagClass.UNIVERSAL }.forEach { it shouldBeGreaterThan tagB }
if (tagA.encodedTagLength == tagB.encodedTagLength) {
aTags.filterNot { it.tagClass == TagClass.UNIVERSAL }.forEach { it shouldBeGreaterThan tagB }
}

}
Expand Down
Loading

0 comments on commit 3d3ab77

Please sign in to comment.