![]() |
Ubirch Protocol Python
|
Handles your signing and verifying keys.
Meaning it generates, stores, loads and finds your keys.
None __init__ | ( | self, | |
str | keystore_file, | ||
str | password | ||
) |
Initialize the KeyStore.
keystore_file | The name of the keystore file |
password | The password of the keystore file. A strong password should be used. |
|
private |
Find the stored cert for uuid.
uuid | The UUID of the device |
None
|
private |
Load or create new crypto-keys.
The keys are stored in a local key store.
(ecdsa.VerifyingKey, ecdsa.SigningKey) create_ecdsa_keypair | ( | self, | |
UUID | uuid, | ||
ecdsa.curves.Curve | curve = ecdsa.NIST256p , |
||
hashfunc = hashlib.sha256 |
|||
) |
Create new ECDSA key pair and store in key store.
uuid | The UUID of the device |
curve | The used curve as well as the used hash function have to be explicitly set here to ensure determinism when creating the key |
hashfunc |
(ed25519.VerifyingKey, ed25519.SigningKey) create_ed25519_keypair | ( | self, | |
UUID | uuid | ||
) |
Create a new ED25519 key pair and store it in key store.
uuid | The UUID of the device |
def exists_signing_key | ( | self, | |
UUID | uuid | ||
) |
Check whether this UUID has a signing key in the key store.
uuid | The UUID of the device |
def exists_verifying_key | ( | self, | |
UUID | uuid | ||
) |
Check whether this UUID has a verifying key in the key store.
uuid | The UUID of the device |
ed25519.SigningKey or ecdsa.SigningKey find_signing_key | ( | self, | |
UUID | uuid | ||
) |
Find the signing key from the keystore for this UUID.
uuid | The UUID of the device |
None
ed25519.VerifyingKey or ecdsa.VerifyingKey find_verifying_key | ( | self, | |
UUID | uuid | ||
) |
Find the verifying key for this UUID.
uuid | The UUID of the device |
None
dict or None get_certificate | ( | self, | |
UUID | uuid, | ||
int | validityInDays = 3650 |
||
) |
Get the public key info for key registration.
Contained information: created, hwDeviceId, pubKey, pubKeyId, validNotAfter, validNotBefore
uuid | The UUID of the device |
validityInDays | The validity in days for the certificate |
None
(ecdsa.VerifyingKey, ecdsa.SigningKey) insert_ecdsa_keypair | ( | self, | |
UUID | uuid, | ||
ecdsa.VerifyingKey | vk, | ||
ecdsa.SigningKey | sk | ||
) |
Insert an existing ECDSA key pair into the key store.
uuid | The UUID of the device |
vk | A ecdsa.VerifyingKey like generated from ecdsa.create_keypair() |
sk | A ecdsa.SigningKey like generated from ecdsa.create_keypair() |
def insert_ecdsa_signing_key | ( | self, | |
uuid, | |||
ecdsa.SigningKey | sk | ||
) |
Insert an existing ECDSA signing key.
uuid | The UUID of the device |
sk | A ecdsa.SigningKey like generated from ecdsa.create_keypair() |
def insert_ecdsa_verifying_key | ( | self, | |
uuid, | |||
ecdsa.VerifyingKey | vk | ||
) |
Insert an existing ECDSA verifying key.
uuid | The UUID of the device |
vk | A ecdsa.VerifyingKey like generated from ecdsa.create_keypair() |
( ed25519.VerifyingKey, ed25519.SigningKey) insert_ed25519_keypair | ( | self, | |
UUID | uuid, | ||
ed25519.VerifyingKey | vk, | ||
ed25519.SigningKey | sk | ||
) |
Store an existing ED25519 key pair in the key store.
uuid | The UUID of the device |
vk | A ed25519.VerifyingKey like generated from ed25519.create_keypair() |
sk | A ed25519.SigningKey like generated from ed25519.create_keypair() |
def insert_ed25519_signing_key | ( | self, | |
UUID | uuid, | ||
ed25519.SigningKey | sk | ||
) |
Store an existing ED25519 signing key in the key store.
uuid | The UUID of the device |
sk | A ed25519.SigningKey like generated from ed25519.create_keypair() |
def insert_ed25519_verifying_key | ( | self, | |
UUID | uuid, | ||
ed25519.VerifyingKey | vk | ||
) |
Store an existing ED25519 verifying key in the key store.
uuid | The UUID of the device |
vk | A ed25519.VerifyingKey like generated from ed25519.create_keypair() |