utils.certificate package¶
utils.certificate.tools module¶
-
utils.certificate.tools.certificate_hashing(cert_der, algorithm='sha256')¶ Performs the hash of a provided X509 certificate.
Parameters: - cert_der (binary DER) – x509 certificate.
- algorithm (str) – hashing algorithm. Sha256 will be used as default.
Returns: The hash of the certificate performed using the provided hashing function.
Return type: binary
-
utils.certificate.tools.check_blind_hash(cert_der, blinded_hash, r, ca_cert)¶ Compute the blind hash of the provided certificate and check if it match with the provided blinded hash
Parameters: - cert_der (binary DER) – input certificate.
- blinded_hash (binary) – input blinded hash to be checked.
- r (long) – blinding factor used to perform the blind hash.
- ca_cert (M2Crypto.X509()) – CA cert. It will be used to extract the public key and perform the hash blinding.
Returns: True if the hashes match, False otherwise.
Return type: bool
-
utils.certificate.tools.check_certificate(bitcoin_address, certs_path)¶ Checks if a certificate exists in the certificate directory.
Parameters: - bitcoin_address (str) – name of the certificate to look for.
- certs_path (str) – system path where the certificate are stored.
Returns: True if the certificate exists, False otherwise.
Return type: bool
-
utils.certificate.tools.store_certificate(certificate, filename='paysense', extension='.crt')¶ Stores a certificate in a human readable format.
Parameters: - certificate (binary DER) – certificate to be stored.
- filename (str) – name or system path (including name) where the certificate will be stored (without extension).
- extension (str) – file extension.
Returns: None