Adding tests for OpenPGP.

All tests are taken from gnuk. Reader is migrated from pyusb to pyscard.

Signed-off-by: Pol Henarejos <pol.henarejos@cttc.es>
This commit is contained in:
Pol Henarejos
2023-02-02 23:08:49 +01:00
parent 32868dfc31
commit 2c24c348b5
129 changed files with 6171 additions and 0 deletions

View File

@@ -0,0 +1,23 @@
"""
test_011_adminfull_kdffull.py - test KDF data object
Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation.
Gnuk is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gnuk is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from card_test_kdf_full import *

View File

@@ -0,0 +1,23 @@
"""
test_011_adminfull_kdffull.py - test KDF data object
Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation.
Gnuk is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gnuk is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from card_test_personalize_card_1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_rsa2k import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_nistp256r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_brainpoolp256r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_secp256k1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_nistp384r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_brainpoolp384r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_nistp521r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_brainpoolp512r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_curve25519 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_rsa2k import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_nistp256r1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_brainpoolp256r1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_secp256k1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_nistp384r1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_brainpoolp384r1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_nistp521r1 import *

View File

@@ -0,0 +1 @@
from card_test_kg_pko_dsc_brainpoolp512r1 import *

View File

@@ -0,0 +1 @@
from card_test_ki_pko_dsc_curve25519 import *

View File

@@ -0,0 +1,15 @@
import pytest
from card_const import *
from constants_for_test import *
def test_setup_pw1_4(card):
r = card.change_passwd(1, FACTORY_PASSPHRASE_PW1, PW1_TEST4)
assert r
def test_verify_pw1_4(card):
v = card.verify(1, PW1_TEST4)
assert v
def test_verify_pw1_4_2(card):
v = card.verify(2, PW1_TEST4)
assert v

View File

@@ -0,0 +1,23 @@
"""
test_011_adminfull_kdffull.py - test KDF data object
Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation.
Gnuk is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gnuk is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from card_test_personalize_reset import *

View File

@@ -0,0 +1,23 @@
"""
test_011_adminfull_kdffull.py - test KDF data object
Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation.
Gnuk is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gnuk is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from card_test_remove_keys import *

View File

@@ -0,0 +1,23 @@
"""
test_011_adminfull_kdffull.py - test KDF data object
Copyright (C) 2018, 2019 g10 Code GmbH
Author: NIIBE Yutaka <gniibe@fsij.org>
This file is a part of Gnuk, a GnuPG USB Token implementation.
Gnuk is free software: you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
Gnuk is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
from card_test_reset_pw3 import *

View File

@@ -0,0 +1 @@
from skip_if_no_kdf_support import *