CryptoParser ¶
Bases: BaseModel
, abc.ABC
CryptoParser is an abstract class used by all the types parsing cryptography objects into pki_tools pydantic classes.
from_cryptography
abstractmethod
classmethod
¶
from_cryptography(crypto_obj: CryptoObject) -> CryptoParser
Parses a cryptography x509 object into a CryptoParser
Parameters: |
|
---|
Returns: |
|
---|
Encoding ¶
Bases: Enum
Describes the encoding used for writing/reading InitCryptoParser objects.
Attributes: |
|
---|
InitCryptoParser ¶
Bases: CryptoParser
, abc.ABC
Extends the CryptoParser into an object that requires initialization before it can be used (while created as a pki_tools object and not loaded from cryptography). This can, for example, be a Certificate that needs to be signed with a KeyPair containing the private key.
Attempt to e.g. dumping a certificate to a PEM string without using the sign (init) function first will result in a MissingInit exception.
Classes implementing the InitCryptoParser
will also automatically get
functions to load and write the objects with the supported
Encoding as well as
writing/reading the encoded content to/from files.
der_bytes
property
¶
der_bytes: bytes
Returns the DER bytes of the object
Returns: |
|
---|
pem_bytes
property
¶
pem_bytes: bytes
Returns the PEM bytes of the object
Returns: |
|
---|
from_der_bytes
classmethod
¶
from_der_bytes(der: bytes) -> InitCryptoParser
Loads the object from DER bytes
Parameters: |
|
---|
Returns: |
|
---|
from_file
classmethod
¶
from_file(file_path: str, encoding: Encoding = Encoding.PEM) -> InitCryptoParser
from_pem_string
classmethod
¶
from_pem_string(pem: str) -> InitCryptoParser
Loads the object from a PEM string
Parameters: |
|
---|
Returns: |
|
---|