Add license header to tests and fix formating
This commit is contained in:
@@ -1,3 +1,22 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2014 Dominik Oepen
|
||||||
|
#
|
||||||
|
# This file is part of virtualsmartcard.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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
|
||||||
|
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from virtualsmartcard.CryptoUtils import *
|
from virtualsmartcard.CryptoUtils import *
|
||||||
|
|
||||||
@@ -19,5 +38,5 @@ class TestCryptoUtils(unittest.TestCase):
|
|||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
unittest.main()
|
unittest.main()
|
||||||
#test_pbkdf2()
|
#test_pbkdf2()
|
||||||
|
|||||||
@@ -1,7 +1,26 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2014 Dominik Oepen
|
||||||
|
#
|
||||||
|
# This file is part of virtualsmartcard.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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
|
||||||
|
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from virtualsmartcard.SmartcardSAM import *
|
from virtualsmartcard.SmartcardSAM import *
|
||||||
|
|
||||||
#Unit Tests
|
#Unit Tests
|
||||||
class TestSmartcardSAM(unittest.TestCase):
|
class TestSmartcardSAM(unittest.TestCase):
|
||||||
|
|
||||||
def setUp(self):
|
def setUp(self):
|
||||||
|
|||||||
@@ -1,14 +1,34 @@
|
|||||||
|
#
|
||||||
|
# Copyright (C) 2014 Dominik Oepen
|
||||||
|
#
|
||||||
|
# This file is part of virtualsmartcard.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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.
|
||||||
|
#
|
||||||
|
# virtualsmartcard 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
|
||||||
|
# virtualsmartcard. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
#
|
||||||
|
|
||||||
|
|
||||||
import unittest
|
import unittest
|
||||||
from virtualsmartcard.utils import C_APDU, R_APDU, hexdump
|
from virtualsmartcard.utils import C_APDU, R_APDU, hexdump
|
||||||
|
|
||||||
class TestUtils(unittest.TestCase):
|
class TestUtils(unittest.TestCase):
|
||||||
|
|
||||||
def test_CAPDU(self):
|
def test_CAPDU(self):
|
||||||
a = C_APDU(1, 2, 3, 4) # case 1
|
a = C_APDU(1, 2, 3, 4) # case 1
|
||||||
b = C_APDU(1, 2, 3, 4, 5) # case 2
|
b = C_APDU(1, 2, 3, 4, 5) # case 2
|
||||||
c = C_APDU((1, 2, 3), cla = 0x23, data = "hallo") # case 3
|
c = C_APDU((1, 2, 3), cla = 0x23, data = "hallo") # case 3
|
||||||
d = C_APDU(1, 2, 3, 4, 2, 4, 6, 0) # case 4
|
d = C_APDU(1, 2, 3, 4, 2, 4, 6, 0) # case 4
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(a)
|
print(a)
|
||||||
print(b)
|
print(b)
|
||||||
@@ -19,14 +39,14 @@ class TestUtils(unittest.TestCase):
|
|||||||
print(repr(b))
|
print(repr(b))
|
||||||
print(repr(c))
|
print(repr(c))
|
||||||
print(repr(d))
|
print(repr(d))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
for i in a, b, c, d:
|
for i in a, b, c, d:
|
||||||
print(hexdump(i.render()))
|
print(hexdump(i.render()))
|
||||||
|
|
||||||
print()
|
print()
|
||||||
g = C_APDU(0x00, 0xb0, 0x9c, 0x00, 0x00, 0x00, 0x00) #case 2 extended length
|
g = C_APDU(0x00, 0xb0, 0x9c, 0x00, 0x00, 0x00, 0x00) #case 2 extended length
|
||||||
|
|
||||||
print()
|
print()
|
||||||
print(g)
|
print(g)
|
||||||
print(repr(g))
|
print(repr(g))
|
||||||
|
|||||||
Reference in New Issue
Block a user