Skip to content

Commit

Permalink
test: fixed key generation
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalDR committed Jan 31, 2024
1 parent 6935298 commit f1f2889
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 49 deletions.
11 changes: 2 additions & 9 deletions pymdoccbor/tests/test_02_mdoc_issuer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,14 @@
import os

from pycose.messages import Sign1Message

from pycose.keys import EC2Key
from pymdoccbor.mdoc.issuer import MdocCborIssuer
from pymdoccbor.mdoc.verifier import MdocCbor
from pymdoccbor.mso.issuer import MsoIssuer
from . pid_data import PID_DATA


PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}

PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

def test_mso_writer():
msoi = MsoIssuer(
Expand Down
10 changes: 2 additions & 8 deletions pymdoccbor/tests/test_03_mdoc_issuer.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import os
from pycose.keys import EC2Key
from pymdoccbor.mdoc.issuer import MdocCborIssuer
from pymdoccbor.tests.micov_data import MICOV_DATA
from pymdoccbor.tests.pid_data import PID_DATA


PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}
PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

mdoc = MdocCborIssuer(PKEY)

Expand Down
10 changes: 2 additions & 8 deletions pymdoccbor/tests/test_04_issuer_signed.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,10 @@
import os
from pycose.keys import EC2Key
from pymdoccbor.mdoc.issuersigned import IssuerSigned
from pymdoccbor.mdoc.issuer import MdocCborIssuer
from pymdoccbor.tests.micov_data import MICOV_DATA
from pymdoccbor.tests.test_03_mdoc_issuer import mdoc

PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}
PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

mdoc = MdocCborIssuer(PKEY)
mdoc.new(
Expand Down
12 changes: 3 additions & 9 deletions pymdoccbor/tests/test_05_mdoc_verifier.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import os
from pycose.keys import EC2Key
from pymdoccbor.mdoc.verifier import MobileDocument
from pymdoccbor.mdoc.issuer import MdocCborIssuer
from pymdoccbor.tests.micov_data import MICOV_DATA

PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}
PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

mdoc = MdocCborIssuer(PKEY)
mdoc.new(
Expand Down Expand Up @@ -59,4 +53,4 @@ def test_mobile_document_verify():
document = mdoc.signed["documents"][0]
doc = MobileDocument(**document)

#assert mdoc.verify() == True
assert doc.verify() == True
10 changes: 2 additions & 8 deletions pymdoccbor/tests/test_06_mso_issuer.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
import os
from pycose.keys import EC2Key
from pycose.messages import CoseMessage
from pymdoccbor.mso.issuer import MsoIssuer
from pymdoccbor.tests.micov_data import MICOV_DATA

PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}
PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

def test_mso_issuer_fail():
try:
Expand Down
9 changes: 2 additions & 7 deletions pymdoccbor/tests/test_07_mso_verifier.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import os
from pycose.keys import CoseKey, EC2Key
from pymdoccbor.mso.verifier import MsoVerifier
from pymdoccbor.mdoc.issuer import MdocCborIssuer
from pymdoccbor.tests.micov_data import MICOV_DATA
from pycose.messages import CoseMessage

PKEY = {
'KTY': 'EC2',
'CURVE': 'P_256',
'ALG': 'ES256',
'D': os.urandom(32),
'KID': b"demo-kid"
}
PKEY = EC2Key.generate_key(crv="P_256", optional_params={"ALG": "ES256"})

mdoc = MdocCborIssuer(PKEY)
mdoc.new(
Expand Down

0 comments on commit f1f2889

Please sign in to comment.