Merge pull request #10 from rrottmann/small-fixes

Small fixes
This commit was merged in pull request #10.
This commit is contained in:
Pol Henarejos
2022-11-03 16:05:56 +01:00
committed by GitHub
2 changed files with 5 additions and 6 deletions

View File

@@ -30,7 +30,7 @@ PIN=648219
## Initialization ## Initialization
The first step is to initialize the HSM. To do so, use the `pico-hsm-tool.py` in `tools` folder: The first step is to initialize the HSM. To do so, use the `pico-hsm-tool.py` in `tools` folder:
``` ```
$ python3 pico-hsm-tool initialize --so-pin 3537363231383830 --pin 648219 $ python3 pico-hsm-tool.py initialize --so-pin 3537363231383830 --pin 648219
``` ```
The PIN number is used to manage all private keys in the device. It supports three attemps. After the third PIN failure, it gets blocked. The PIN number is used to manage all private keys in the device. It supports three attemps. After the third PIN failure, it gets blocked.
The PIN accepts from 6 to 16 characters. The PIN accepts from 6 to 16 characters.

9
tools/pico-hsm-tool.py Executable file → Normal file
View File

@@ -24,17 +24,16 @@ try:
from smartcard.CardType import AnyCardType from smartcard.CardType import AnyCardType
from smartcard.CardRequest import CardRequest from smartcard.CardRequest import CardRequest
from smartcard.Exceptions import CardRequestTimeoutException from smartcard.Exceptions import CardRequestTimeoutException
except: except ModuleNotFoundError:
print('ERROR: smarctard module not found! Install pyscard package.\nTry with `pip install pyscard`') print('ERROR: smarctard module not found! Install pyscard package.\nTry with `pip install pyscard`')
sys.exit(-1) sys.exit(-1)
try: try:
from cvc.certificates import CVC
from cvc.asn1 import ASN1 from cvc.asn1 import ASN1
from cvc.oid import oid2scheme from cvc.oid import oid2scheme
from cvc.utils import scheme_rsa from cvc.utils import scheme_rsa
from cvc.certificates import CVC except ModuleNotFoundError:
except:
print('ERROR: cvc module not found! Install pycvc package.\nTry with `pip install pycvc`') print('ERROR: cvc module not found! Install pycvc package.\nTry with `pip install pycvc`')
sys.exit(-1) sys.exit(-1)
@@ -44,7 +43,7 @@ try:
from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat from cryptography.hazmat.primitives.serialization import Encoding, PublicFormat
from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305 from cryptography.hazmat.primitives.ciphers.aead import ChaCha20Poly1305
from cryptography.hazmat.primitives import hashes from cryptography.hazmat.primitives import hashes
except: except ModuleNotFoundError:
print('ERROR: cryptography module not found! Install cryptography package.\nTry with `pip install cryptography`') print('ERROR: cryptography module not found! Install cryptography package.\nTry with `pip install cryptography`')
sys.exit(-1) sys.exit(-1)