• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

LudovicRousseau / PyKCS11 / 16367380199

18 Jul 2025 09:31AM UTC coverage: 93.474% (+5.9%) from 87.592%
16367380199

push

github

LudovicRousseau
IsNum(): CKA_HW_FEATURE_TYPE is also a numeric value

Thanks to Ivan Wallis for the bug report
"Venafi PKCS#11 Library fails with Unkown PKCS#11 type () during findObjects #140"
Closes: https://github.com/LudovicRousseau/PyKCS11/issues/140

5529 of 5915 relevant lines covered (93.47%)

0.93 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

95.45
/test/test_digest.py
1
#! /usr/bin/env python
2

3
# pylint: disable=missing-module-docstring
4
# pylint: disable=missing-class-docstring
5
# pylint: disable=missing-function-docstring
6

7
import unittest
1✔
8

9
from PyKCS11 import PyKCS11
1✔
10

11
# SHA1 of "abc"
12
SHA1_abc = [
1✔
13
    0xA9,
14
    0x99,
15
    0x3E,
16
    0x36,
17
    0x47,
18
    0x6,
19
    0x81,
20
    0x6A,
21
    0xBA,
22
    0x3E,
23
    0x25,
24
    0x71,
25
    0x78,
26
    0x50,
27
    0xC2,
28
    0x6C,
29
    0x9C,
30
    0xD0,
31
    0xD8,
32
    0x9D,
33
]
34

35

36
class TestUtil(unittest.TestCase):
1✔
37
    def setUp(self):
1✔
38
        self.pkcs11 = PyKCS11.PyKCS11Lib()
1✔
39
        self.pkcs11.load()
1✔
40
        self.slot = self.pkcs11.getSlotList(tokenPresent=True)[0]
1✔
41
        self.session = self.pkcs11.openSession(self.slot, PyKCS11.CKF_SERIAL_SESSION)
1✔
42

43
    def tearDown(self):
1✔
44
        self.pkcs11.closeAllSessions(self.slot)
1✔
45
        del self.pkcs11
1✔
46

47
    def test_digest(self):
1✔
48
        digest = self.session.digest("abc")
1✔
49
        self.assertSequenceEqual(digest, SHA1_abc)
1✔
50

51
    def test_digestSession(self):
1✔
52
        digestSession = self.session.digestSession()
1✔
53
        digestSession.update("abc")
1✔
54
        digest = digestSession.final()
1✔
55
        self.assertSequenceEqual(digest, SHA1_abc)
1✔
56

57

58
if __name__ == "__main__":
1✔
59
    unittest.main()
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc