Starting from version 2.0.4 of
latvia-eid-middleware
digest functions have been fixed and now return correct values using both digest methods.
- Python 3
- PyKCS11
- eParakstītājs 3.0 (eID-LV Middleware)
- SoftHSM2
Using SoftHSM2:
python digest.py -lib softhsm -pin 0000
Using eID LV Middleware:
python digest.py -lib otlv -pin 0000
This program uses SHA1 (default) hash function to get digest of three strings.
Digests can be checked individually against sha1sum
tool:
echo -n "hello world!" | sha1sum
The wrong digests that eID LV Middleware gives are calculated from twice repeated string:
echo -n "hello world!hello world!" | sha1sum
PKCS#11 defines two similar approaches to using message digest functions: using C_Digest
or C_DigestUpdate
+ C_DigestFinal
:
C_Digest is equivalent to a sequence of C_DigestUpdate operations followed by C_DigestFinal.
It appears only C_Digest
function in eID LV Middleware gives wrong digests.