ykman.util
Attributes
Exceptions
Raised when parsing key/certificate and the password might be wrong/missing. |
Classes
Structure base class |
Functions
|
Identify, decrypt and return a cryptography private key object. |
|
Identify, decrypt and return a list of cryptography x509 certificates. |
|
Extract the leaf certificates from a list of certificates. |
|
|
|
Tries to identify a PKCS12 container. |
|
Displays an x509 certificate serial number in a readable format. |
Get the true Windows version, since sys.getwindowsversion lies. |
|
|
Check if the given SmartCardConnection over NFC is in restricted NFC mode. |
Module Contents
- ykman.util.PEM_IDENTIFIER = b'-----BEGIN'
- exception ykman.util.InvalidPasswordError[source]
Bases:
Exception
Raised when parsing key/certificate and the password might be wrong/missing.
- ykman.util.parse_private_key(data, password)[source]
Identify, decrypt and return a cryptography private key object.
- Parameters:
data – The private key in bytes.
password – The password to decrypt the private key (if it is encrypted).
- ykman.util.parse_certificates(data, password)[source]
Identify, decrypt and return a list of cryptography x509 certificates.
- Parameters:
data – The certificate(s) in bytes.
password – The password to decrypt the certificate(s).
- ykman.util.get_leaf_certificates(certs)[source]
Extract the leaf certificates from a list of certificates.
Leaf certificates are ones whose subject does not appear as issuer among the others.
- Parameters:
certs – The list of cryptography x509 certificate objects.
- ykman.util.is_pkcs12(data)[source]
Tries to identify a PKCS12 container. The PFX PDU version is assumed to be v3. See: https://tools.ietf.org/html/rfc7292.
- ykman.util.display_serial(serial)[source]
Displays an x509 certificate serial number in a readable format.
- class ykman.util.OSVERSIONINFOW[source]
Bases:
ctypes.Structure
Structure base class
- ykman.util.get_windows_version()[source]
Get the true Windows version, since sys.getwindowsversion lies.
- ykman.util.is_nfc_restricted(connection)[source]
Check if the given SmartCardConnection over NFC is in restricted NFC mode.
- Parameters:
connection (yubikit.core.smartcard.SmartCardConnection)
- Return type: