Skip to content

Commit

Permalink
Update signum
Browse files Browse the repository at this point in the history
  • Loading branch information
nodh committed Dec 4, 2024
1 parent a0306c1 commit e34d005
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package at.asitplus.wallet.lib.cbor

import at.asitplus.signum.indispensable.CryptoSignature
import at.asitplus.signum.indispensable.cosef.CoseHeader
import at.asitplus.signum.indispensable.cosef.CoseSigned
import at.asitplus.signum.indispensable.cosef.io.ByteStringWrapper
import at.asitplus.wallet.lib.iso.*
import com.benasher44.uuid.uuid4
import io.kotest.core.spec.style.FreeSpec
Expand Down Expand Up @@ -47,9 +47,9 @@ class DeviceSignedItemSerializationTest : FreeSpec({
key = elementId,
value = Random.nextBytes(32),
)
val protectedHeader = ByteStringWrapper(CoseHeader(), CoseHeader().serialize())
val issuerAuth = CoseSigned<MobileSecurityObject>(protectedHeader, null, null, byteArrayOf())
val deviceAuth = CoseSigned<ByteArray>(protectedHeader, null, null, byteArrayOf())
val protectedHeader = CoseHeader()
val issuerAuth = CoseSigned<MobileSecurityObject>(protectedHeader, null, null, CryptoSignature.RSAorHMAC(byteArrayOf()))
val deviceAuth = CoseSigned<ByteArray>(protectedHeader, null, null, CryptoSignature.RSAorHMAC(byteArrayOf()))

val doc = Document(
docType = uuid4().toString(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package at.asitplus.wallet.lib.cbor

import at.asitplus.signum.indispensable.CryptoSignature
import at.asitplus.signum.indispensable.cosef.CoseHeader
import at.asitplus.signum.indispensable.cosef.CoseSigned
import at.asitplus.signum.indispensable.cosef.io.ByteStringWrapper
Expand Down Expand Up @@ -45,8 +46,8 @@ class IssuerSignedItemSerializationTest : FreeSpec({
elementIdentifier = elementId,
elementValue = Random.nextBytes(32),
)
val protectedHeader = ByteStringWrapper(CoseHeader(), CoseHeader().serialize())
val issuerAuth = CoseSigned<MobileSecurityObject>(protectedHeader, null, null, byteArrayOf())
val protectedHeader = CoseHeader()
val issuerAuth = CoseSigned<MobileSecurityObject>(protectedHeader, null, null, CryptoSignature.RSAorHMAC(byteArrayOf()))
val doc = Document(
docType = uuid4().toString(),
issuerSigned = IssuerSigned.fromIssuerSignedItems(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package at.asitplus.wallet.lib.iso

import at.asitplus.catching
import at.asitplus.signum.indispensable.CryptoSignature
import at.asitplus.signum.indispensable.cosef.*
import at.asitplus.signum.indispensable.cosef.io.Base16Strict
import at.asitplus.signum.indispensable.cosef.io.ByteStringWrapper
import at.asitplus.signum.indispensable.cosef.io.ByteStringWrapperSerializer
import at.asitplus.wallet.lib.agent.DummyCredentialDataProvider
Expand Down Expand Up @@ -49,10 +49,10 @@ class Tag24SerializationTest : FreeSpec({
),
deviceAuth = DeviceAuth(
deviceSignature = CoseSigned<ByteArray>(
protectedHeader = ByteStringWrapper(CoseHeader()),
protectedHeader = CoseHeader(),
unprotectedHeader = null,
payload = byteArrayOf(),
rawSignature = byteArrayOf()
signature = CryptoSignature.RSAorHMAC(byteArrayOf())
)

)
Expand Down Expand Up @@ -121,10 +121,10 @@ class Tag24SerializationTest : FreeSpec({
)
val serializedMso = mso.serializeForIssuerAuth()
val input = CoseSigned<MobileSecurityObject>(
protectedHeader = ByteStringWrapper(CoseHeader()),
protectedHeader = CoseHeader(),
unprotectedHeader = null,
payload = mso,
rawSignature = byteArrayOf()
signature = CryptoSignature.RSAorHMAC(byteArrayOf())
)

val serialized = vckCborSerializer.encodeToByteArray(input)
Expand Down Expand Up @@ -171,10 +171,10 @@ private fun deviceKeyInfo() =
DeviceKeyInfo(CoseKey(CoseKeyType.EC2, keyParams = CoseKeyParams.EcYBoolParams(CoseEllipticCurve.P256)))

private fun issuerAuth() = CoseSigned<MobileSecurityObject>(
protectedHeader = ByteStringWrapper(CoseHeader()),
protectedHeader = CoseHeader(),
unprotectedHeader = null,
payload = null,
rawSignature = byteArrayOf()
signature = CryptoSignature.RSAorHMAC(byteArrayOf())
)

private fun issuerSignedItem() = IssuerSignedItem(0u, Random.nextBytes(16), "identifier", "value")

0 comments on commit e34d005

Please sign in to comment.