Scroll to navigation

PKI-PYTHON-CLIENT(1) Dogtag Certificate System PKI-PYTHON-CLIENT(1)

NAME

pki-python-client - Dogtag Python Client API

Dogtag is an enterprise software system designed to manage enterprise Public Key Infrastructure (PKI) deployments. These pages document the Python client API that can be used to interact with Dogtag's REST API to request and issue certificates, store secrets in the KRA etc.

PKI PACKAGE

pki Package

This module contains top-level classes and functions used by the Dogtag project.

Bases: object

Class representing a key/value pair.

This object is the basis of the representation of a ResourceMessage.


Bases: object

Class representing a list of attributes.

This class is needed because of a JavaMapper used in the REST API.


Bases: PKIException

Bad Request Exception: return code = 400


Bases: ResourceNotFoundException

Cert Not Found Exception: return code = 404


Bases: PKIException

Conflicting Operation Exception: return code = 409



Bases: PKIException

Forbidden Exception: return code = 403


Bases: ResourceNotFoundException

Group Not Found Exception: return code = 404


Bases: PKIException

Gone Exception: return code = 410


Bases: ResourceNotFoundException

Key Not Found Exception: return code 404


Bases: Exception, ResourceMessage

Base exception class for REST Interface

Construct PKIException from JSON. :param json_value: JSON representation of the exception. :type json_value: str :return: pki.PKIException


Bases: ResourceNotFoundException

Profile Not Found Exception: return code = 404


Bases: object

Class to manage property files The contents of the property file are maintained internally as a list of properties.

Properties are strings of the format <name> <delimiter> <value> where '=' is the default delimiter.

Get the value of the specified property.
name (str) -- name of property to be fetched.
str -- value of property


Find the index (position) of a property in a property file.
name (str) -- name of property
int -- index of property.


Insert property into the list of properties maintained by this object at the specified location (index).
  • index (int) -- point at which to insert value.
  • line (str) -- value to be inserted.

None


Read from property file into the list of properties maintained by this object.
None


Remove property from list of properties maintained by this object.
name (str) -- name of property to be removed.
None


Remove property at specified index from the properties list.
index (int) -- location of property to be removed.
None


Set value of specified property.
  • name (str) -- name of property to set.
  • value (str) -- value to set
  • index (int) -- (optional) position of property

None


Print the contents of the list of properties maintained by this object to STDOUT.
None


Write the list of properties maintained by this object to the property file.
None



Bases: ResourceNotFoundException

Request Not Found Exception: return code = 404


Bases: object

This class is the basis for the various types of key requests. It is essentially a list of attributes.

Add an attribute to the list.
  • name (str) -- name of attribute to add
  • value (str) -- value to add

None


Get the value of a given attribute.
name (str) -- name of attribute to retrieve
str -- value of parameter




Bases: PKIException

Unauthorized Exception: return code = 401


Bases: ResourceNotFoundException

User Not Found Exception: return code = 404



This function generates FIPS-compliant password.

See sftk_newPinCheck() in the following file: https://dxr.mozilla.org/nss/source/nss/lib/softoken/fipstokn.c

The minimum password length is FIPS_MIN_PIN Unicode characters.

  • digits (string.digits)
  • ASCII lowercase letters (string.ascii_lowercase)
  • ASCII uppercase letters (string.ascii_uppercase)
  • ASCII non-alphanumeric characters (PUNCTUATIONS)
  • non-ASCII characters


If an ASCII uppercase letter is the first character of the password, the uppercase letter is not counted toward its character class.

If a digit is the last character of the password, the digit is not counted toward its character class.

The FIPS_MIN_PIN is defined in the following file: https://dxr.mozilla.org/nss/source/nss/lib/softoken/pkcs11i.h

#define FIPS_MIN_PIN 7



Decorator handling exceptions from REST methods.

Return implementation version.
str -- implementation version


Return specification version.
str -- specification version


account Module

Bases: object

Class used to associate an authentication session variable with a connection.

  • set the authentication credentials with the connection,
  • create an AccountClient and then call login().
  • further operations in this session will use the same authentication credentials without re-authentication.
  • call logout() to invalidate the session.


Login to account REST interface. If login is successful, an authentication session variable is associated with the connection.
None


Logs out of the session. Authentication session variables are invalidated for the connection
None



cert Module

Bases: object

Class encapsulating and mirroring the functionality in the CertResource Java interface class defining the REST API for Certificate resources.

Approves a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Assigns a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Cancels a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Fetches the enrollment request object for the given profile and sets values to its attributes using the values provided in the inputs dictionary. Returns the CertEnrollmentRequest object, which can be submitted to enroll a certificate.

A convenience method for enrolling a certificate for a given profile id. The inputs parameter should be a dictionary with values for the profile attributes for an enrollment request.

Calling this method with valid arguments, creates an enrollment request, submits it to the server, approves the certificate requests generated for the enrollment and returns a list of CertData objects for all the certificates generated as part of this enrollment.

Note: This method supports only certificate enrollment where only one agent approval is sufficient.

Requires an agent level authentication. Returns a list of CertEnrollmentResult objects.


Return a CertData object for a particular certificate.

Fetch the enrollment template for the given profile id. For the first time, the request is sent to the server. The retrieved CertEnrollmentRequest object is then cached locally for future requests. Returns a CerEnrollmentRequest object.

Get information of a certificate request with the given request ID. Returns a CertRequestInfo object.

Places a certificate on-hold. Calls the revoke_cert method with reason - CertRevokeRequest.REASON_CERTIFICATE_HOLD. Returns a CertRequestInfo object. This method requires an agent's authentication cert in the connection object.

Return a CertDataInfoCollection object with a information about all the certificates that satisfy the search criteria. If cert_search_request=None, returns all the certificates.

Gets the list of profile templates supported by the CA. The values for start and size arguments determine the starting point and the length of the list. Returns a ProfileDataInfoCollection object.

Query for a list of certificates using the arguments passed. Returns a CertRequestInfoCollection object.

Rejects a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Reviews a certificate. Returns a CertData object with a nonce. This method requires an agent's authentication cert in the connection object.

Reviews a certificate enrollment request. Returns a CertReviewResponse object which contains the nonce from the server needed to perform an action on the request.

Revokes a CA certificate. Returns a CertRequestInfo object with information about the request. This method requires an agent's authentication cert in the connection object.

Revokes a certificate. Returns a CertRequestInfo object with information about the request. This method requires an agent's authentication cert in the connection object.

Submits the CertEnrollmentRequest object to the server. Returns a CertRequestInfoCollection object with information about the certificate requests enrolled at the CA.

Un-assigns a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Un-revokes a revoked certificate. Returns a CertRequestInfo object. This method requires an agent's authentication cert in the connection object.

Updates a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.

Validates a certificate enrollment request. If cert_review_response is None, a review request operation is performed to fetch the CertReviewResponse object. Requires as agent level authentication.




Bases: object

Class containing list of CertDataInfo objects and their respective link objects. This data is returned when searching/listing certificate records in the CA.

Populate object from JSON input



Bases: object

Class containing results of an enrollment request.

This structure contains information about the cert request generated and any certificates issued.



Bases: object

Class containing list of CertRequestInfo objects. This data is returned when listing certificate request records in the CA.

Populate object from JSON input



Bases: CertEnrollmentRequest

An object of this class represent the response from the server when reviewing a certificate enrollment request. It contains a nonce required to perform action on the request.




Bases: object

An object of this class encapsulates all the parameters required for revoking a certificate.

'Unspecified', 'Key_Compromise', 'CA_Compromise', 'Affiliation_Changed', 'Superseded', 'Cessation_of_Operation', 'Certificate_Hold', 'Remove_from_CRL', 'Privilege_Withdrawn', 'AA_Compromise'





client Module

Bases: object

Class to encapsulate the connection between the client and a Dogtag subsystem.

Set the parameters used for authentication if username/password is to be used. Both username and password must not be None. Note that this method only sets the parameters. Actual authentication occurs when the connection is attempted,
  • username -- username to authenticate connection
  • password -- password to authenticate connection

None


Uses python-requests to issue a DEL request to the server.
  • path (str) -- path URI for the DEL request
  • headers (dict) -- headers for the DEL request
  • use_root_uri (boolean) -- use root URI instead of subsystem URI as base

request.response -- response from the server
Exception from python-requests in case the DEL was not successful, or returns an error code.


Uses python-requests to issue a GET request to the server.
  • path (str) -- path URI for the GET request
  • headers (dict) -- headers for the GET request
  • params (dict or bytes) -- Query parameters for the GET request
  • payload (dict, bytes, file-like object) -- data to be sent in the body of the request
  • use_root_uri (boolean) -- use root URI instead of subsystem URI as base

request.response -- response from the server
Exception from python-requests in case the GET was not successful, or returns an error code.


Uses python-requests to issue a POST request to the server.
  • path (str) -- path URI for the POST request
  • payload (dict, bytes, file-like object) -- data to be sent in the body of the request
  • headers (dict) -- headers for the POST request
  • params (dict or bytes) -- Query parameters for the POST request
  • use_root_uri (boolean) -- use root URI instead of subsystem URI as base

request.response -- response from the server
Exception from python-requests in case the POST was not successful, or returns an error code.


Uses python-requests to issue a PUT request to the server.
  • path (str) -- path URI for the PUT request
  • payload (dict, bytes, file-like object) -- data to be sent in the body of the request
  • headers (dict) -- headers for the PUT request
  • use_root_uri (boolean) -- use root URI instead of subsystem URI as base

request.response -- response from the server
Exception from python-requests in case the PUT was not successful, or returns an error code.


Set the path to the PEM file containing the certificate and private key for the client certificate to be used for authentication to the server, when client certificate authentication is required. The private key may optionally be stored in a different path.
  • pem_cert_path (str) -- path to the PEM file
  • pem_key_path (str) -- path to the PEM-formatted private key file

None
Exception if path is empty or None.



Bases: HTTPAdapter

Custom SSLContext Adapter for requests

Initializes a urllib3 PoolManager.

This method should not be called from user code, and is only exposed for use when subclassing the HTTPAdapter.

  • connections -- The number of urllib3 connection pools to cache.
  • maxsize -- The maximum number of connections to save in the pool.
  • block -- Block when no free connections are available.
  • pool_kwargs -- Extra keyword arguments used to initialize the Pool Manager.




Temporary silence InsecureRequestWarning

PKIConnection is not able to verify HTTPS connections yet. This decorator catches the warning.



Test code for the PKIConnection class. :return: None

crypto Module

Module containing crypto classes.

Bases: object

Abstract class containing methods to do cryptographic operations.

encrypt a symmetric key with the public key of a transport cert.

The mechanism is the type of symmetric key, which defaults to a 56 bit DES3 key.


Create a random initialization vector

Generate a session key to be used for wrapping data to the DRM This must return a 3DES 168 bit key

Generate and return a symmetric key

Get the certificate for the specified cert_nick.

returns highest supported algorithm keyset

Initialization code

Unwrap data that has been key wrapped using AES KeyWrap


decrypt data originally encrypted with symmetric key (wrapping key)

We expect the data and nonce_iv values to be base64 encoded. The mechanism is the type of key used to do the wrapping. It defaults to a 56 bit DES3 key.


encrypt data using a symmetric key (wrapping key)


Bases: CryptoProvider

Class that defines python-cryptography implementation of CryptoProvider. Requires a PEM file containing the agent cert to be initialized.

Note that all inputs and outputs are unencoded.

:param data Data to be wrapped :param wrapping_cert Public key to wrap data :param mechanism algorithm of symmetric key to be wrapped

Wrap (encrypt) data using the supplied asymmetric key


Create a random initialization vector

Returns a session key to be used when wrapping secrets for the DRM.


:param cert_nick Nickname for the certificate to be returned.

returns highest supported algorithm keyset

Any operations here that need to be performed before crypto operations.

:param mechanism key wrapping mechanism :param data: data to unwrap :param wrapping_key: AES key used to wrap data :param nonce_iv Nonce data :return: unwrapped data

Unwrap the encrypted data which has been wrapped using a KeyWrap mechanism.


sets required keyset

:param data Data to be unwrapped :param wrapping_key Symmetric key to unwrap data :param mechanism Mechanism to use when unwrapping :param nonce_iv iv data

Unwrap (decrypt) data using the supplied symmetric key


:param data Data to be wrapped :param wrapping_key Symmetric key to wrap data :param mechanism Mechanism to use for wrapping key :param nonce_iv Nonce for initialization vector

Wrap (encrypt) data using the supplied symmetric key



encoder Module


Bases: JSONEncoder

A custom JSONEncoder class that knows how to encode core custom objects.

Custom objects are encoded as JSON object literals (ie, dicts) with one key, 'TypeName' where 'TypeName' is the actual name of the type to which the object belongs. That single key maps to another object literal which is just the __dict__ of the object encoded.

Reason for ignoring the error: E0202 - An attribute affected in json.encoder line 157 hide this method reported by pylint:

The error is in json.encoder.JSONEncoder class. There is a default method (which is overridden here) and also a class attribute self.default initialized in the init method of the class. The intention of such usage being that a custom default method object can be passed to init when creating an instance of JSONEncoder, which is then assigned to class's default method. (which is valid) But pylint raises an issue due to the usage of same name for a method and an attribute in which case the attribute definition hides the method. The reason and example for the issue: (top rated comment)

http://stackoverflow.com/questions/12949064/python-what-happens- when-instance-variable-name-is-same-as-method-name



Implement this method in a subclass such that it returns a serializable object for o, or calls the base implementation (to raise a TypeError).

For example, to support arbitrary iterators, you could implement default like this:

def default(self, o):

try:
iterable = iter(o)
except TypeError:
pass
else:
return list(iterable)
# Let the base class default method raise the TypeError
return JSONEncoder.default(self, o)




base64 decode X.509 certificate
data (str, bytes) -- data as bytes or ASCII text
bytes


base64 encode X.509 certificate

Python 3's base64.b64encode() doesn't support ASCII text.

data (str, bytes) -- data as bytes or ASCII text
bytes


key Module

Module containing the Python client classes for the KeyClient and KeyRequestClient REST API on a DRM


Bases: object

An instance of this class stores the decoded encrypted secret present in the KeyData object passed in the constructor. All the key retrieval requests return this object.



Bases: object

Class that encapsulates and mirrors the functions in the KeyResource and KeyRequestResource Java classes in the DRM REST API.














Approve a secret recovery request

Archive a secret (symmetric key or passphrase) on the DRM.

Refer to archive_key() comments for a description of client_key_id, data_type, key_algorithm and key_size.

  • encrypted_data - which is the data encrypted by a session key (168 bit 3DES symmetric key)
  • wrapped_session_key - the above session key wrapped by the DRM transport certificate public key.
  • the algorithm_oid string for the symmetric key wrap
  • the nonce_iv for the symmetric key wrap


This function is useful if the caller wants to do their own wrapping of the secret, or if the secret was generated on a separate client machine and the wrapping was done there.

The function returns a KeyRequestResponse object containing a KeyRequestInfo object with details about the archival request and key archived.


Archive a secret (symmetric key or passphrase) on the DRM.

Requires a user-supplied client ID. There can be only one active key with a specified client ID. If a record for a duplicate active key exists, a BadRequestException is thrown.

KeyClient.SYMMETRIC_KEY_TYPE, KeyClient.ASYMMETRIC_KEY_TYPE, KeyClient.PASS_PHRASE_TYPE

key_algorithm and key_size are applicable to symmetric keys only. If a symmetric key is being archived, these parameters are required.

private_data is the raw secret to be archived. It will be wrapped and sent to the DRM.

The function returns a KeyRequestResponse object containing a KeyRequestInfo object with details about the archival request and key archived.


Archive a secret (symmetric key or passphrase) on the DRM.

Refer to archive_key() comments for a description of client_key_id, data_type, key_algorithm and key_size.

pki_archive_options is the data to be archived wrapped in a PKIArchiveOptions structure,

The function returns a KeyRequestResponse object containing a KeyRequestInfo object with details about the archival request and key archived.


Cancel a secret recovery request

Generate and archive asymmetric keys in the DRM. Supports algorithms RSA and DSA. Valid key size for RSA = 256 + (16 * n), where n: 0-496 Valid key size for DSA = 512, 768, 1024. p,q,g params are not supported.

Return a KeyRequestResponse which contains a KeyRequestInfo object that describes the URL for the request and generated keys.


Generate and archive a symmetric key on the DRM.

Return a KeyRequestResponse which contains a KeyRequestInfo object that describes the URL for the request and generated key.


Get the info in the KeyRecord for the active secret in the DRM.


Get the info in the KeyRecord for a specific secret in the DRM.

Return a KeyRequestInfo object for a specific request.


List/Search archived secrets in the DRM.

See KRAClient.list_keys for the valid values of status. Returns a KeyInfoCollection object.


List/Search key requests in the DRM.

See KRAClient.list_requests for the valid values of request_state and request_type. Returns a KeyRequestInfoCollection object.


Modify the status of a key

Decrypt the returned key and place in key.data

The data will either by encrypted using an encryption algorithm - in which case, the key data will contain an encryption algorithm OID, or it will be key wrapped - in which case, the key data will contain a key wrap mechanism name.

Only one of these should be present. If we are talking to an older server, and none is present, we will assume encryption.


Create a request to recover a secret.

To retrieve a symmetric key or passphrase, the only parameter that is required is the keyId. It is possible (but not required) to pass in the session keys/passphrase and nonceData for the retrieval at this time. Those parameters are documented in the docstring for retrieve_key below.

To retrieve an asymmetric key, the keyId and the the base-64 encoded certificate is required.


Reject a secret recovery request.

Retrieve a secret (passphrase or symmetric key) from the DRM.

This method will retrieve a key from the KRA given the key_id or request_id (one of which must be specified). The data is returned as a KeyData object (which is recast to a Key object).

If request_id is specified, then the value of key_id is ignored. Exceptions will be thrown if the caller is not the originator of the request, or the request is not approved.

If key_id is specified instead, the following behavior applies:

  • If the key can be retrieved synchronously - ie. only one agent's approval is required, then the KeyData will include the secret.
  • If the key cannot be retrieved synchronously - ie. if more than one approval is needed, then the KeyData object will include the request ID for a recovery request that was created on the server. When that request is approved, callers can retrieve the key using retrieve_key() and setting the request_id.

To ensure data security in transit, the data will be returned encrypted by a session key (168 bit 3DES symmetric key) - which is first wrapped (encrypted) by the public key of the DRM transport certificate before being sent to the DRM. The parameter trans_wrapped_session_key refers to this wrapped session key.

If the trans_wrapped_session_key is not provided by caller, the method will call CryptoProvider methods to generate and wrap the session key. The function will return the KeyData object with a private_data attribute which stores the unwrapped key information.

If the trans_wrapped_session_key is provided by the caller, the method will simply pass the data to the KRA, and will return the secret wrapped in the session key. The secret will still need to be unwrapped by the caller. The function will return the KeyData object, where the KeyData structure includes the wrapped secret and some nonce data to be used as a salt when unwrapping.


Retrieve a secret (passphrase or symmetric key) from the DRM using a passphrase.

This function generates a key recovery request, approves it, and retrieves the secret referred to by key_id. This assumes that only one approval is required to authorize the recovery.

The secret is secured in transit by wrapping the secret with a passphrase using PBE encryption.

There are two ways of using this function:

1.
A passphrase is provided by the caller.

In this case, CryptoProvider methods will be called to create the data to securely send the passphrase to the DRM. Basically, three pieces of data will be sent:

  • the passphrase wrapped by a 168 bit 3DES symmetric key (the session key). This is referred to as the parameter session_wrapped_passphrase.
  • the session key wrapped with the public key in the DRM transport certificate. This is referred to as the trans_wrapped_session_key.
  • ivps nonce data, referred to as nonce_data

The function will return the tuple (KeyData, unwrapped_secret)

2.
The caller provides the trans_wrapped_session_key, session_wrapped_passphrase and nonce_data.

In this case, the data will simply be passed to the DRM. The function will return the secret encrypted by the passphrase using PBE Encryption. The secret will still need to be decrypted by the caller.

The function will return the tuple (KeyData, None)



Retrieve an asymmetric private key and return it as PKCS12 data.

This function generates a key recovery request, approves it, and retrieves the secret referred to by key_id in a PKCS12 file. This assumes that only one approval is required to authorize the recovery.

This function requires the following parameters: - key_id : the ID of the key - certificate: the certificate associated with the private key - passphrase: A passphrase for the pkcs12 file.

The function returns a KeyData object.


Retrieve a secret from the DRM.

@param: data - a KeyRecoveryRequest containing the keyId of the secret being retrieved, the request_id of the approved recovery request and a wrapping mechanism. More details at KRAClient.retrieve_key.

Returns a KeyData object containing the wrapped secret.



Set the transport certificate for crypto operations

Submit an archival, recovery or key generation request to the DRM.

@param request - is either a KeyArchivalRequest, KeyRecoverRequest, SymKeyGenerationRequest or AsymKeyGenerationRequest.

returns a KeyRequestResponse object.



Bases: object

This is the object that contains the encoded wrapped secret when that secret is retrieved. It is used by the DRM to send information of the key in the key retrieval requests.

Return a KeyData object from a JSON dict



Bases: object

This is the object that contains information stored in the database record for an archived secret. It does not contain the secret itself.

Return KeyInfo from JSON dict

Return the key ID as parsed from key URL



Bases: object

This class represents data returned when searching the DRM archived secrets. Essentially, its a list of KeyInfo objects.

Return a KeyInfoCollection object from its JSON representation


Bases: ResourceMessage

Class representing the data sent to the DRM when either creating a request for the recovery of a secret, or, once the request is approved, retrieving the secret.


Bases: object

This class represents data about key requests (archival, recovery, key generation etc.) in the DRM.

Return a KeyRequestInfo object from a JSON dict.

Return the ID of the secret referred to by this request.

Return the request ID by parsing the request URL.



Bases: object

This class represents the data returned when searching the key requests in the DRM. Essentially, its a list of KeyRequestInfo objects.

Return a KeyRequestInfoCollection object from its JSON representation.


Bases: object

This class is returned when an archival, recovery or key generation request is created. It includes a KeyRequestInfo object with information about the created request, and a KeyData structure which contains the wrapped secret (if that operation is supported).

Return a KeyRequestResponse object from its JSON representation.

Return the id for the key archived, recovered or generated

Return the id for the created request


Bases: object

Class representing a Request ID



Some unit tests - basically printing different types of requests

kra Module

Module containing KRAClient class. This class should be used by Python clients to interact with the DRM to expose the functionality of the KeyClient and KeyRequestResource REST APIs.

Bases: object

Client class that models interactions with a KRA using the Key and KeyRequest REST APIs.


profile Module


Bases: object

An object of this class contains the policy constraints applied to a ProfileInput used by a certificate enrollment request.

Add a PolicyConstraintValue to the policy_constraint_values list.


Returns a PolicyConstraintValue object with the given name. None, if there is no match.


Removes a PolicyConstraintValue with the given name form the policy_constraint_values list.



Bases: object

An object of this class contains information of the default usage of a specific ProfileInput.

Add a policy attribute to the attribute list. @param policy_attribute - A ProfileAttribute object

Add a profile parameter to the parameters list. @param policy_parameter - A ProfileParameter object.


Fetch the policy attribute with the given name from the attributes list.

Fetch a profile parameter with the given name from the parameters list.


Remove a policy attribute with the given name from the attributes list.

Remove a profile parameter with the given name from the parameters list.


Bases: object

An object of this class contains a name value pair of the policy name and the ProfilePolicy object.

Add a ProfilePolicy object to the policy_list


Returns a ProfilePolicy object with the given profile id.


Removes a ProfilePolicy with the given ID from the PolicySet.


Bases: object

An object of this class stores a list of ProfileSet objects.

Add a PolicySet object to the policy_sets list.


Fetch the PolicySet object for the given name. Returns None, if not found.


Remove a PolicySet object with the given name from the policy_sets list.


Bases: object

This class represents an enrollment profile.

Add a ProfileInput object to the inputs list of the Profile.

Add a ProfileOutput object to the outputs list of the Profile.

Add a PolicySet object to the policy_sets list of the Profile.


Fetches a ProfileInput with the given ProfileInput id. Returns None, if there is no matching input.

Fetches a ProfileOutput with the given ProfileOutput id. Returns None, if there is no matching output.

Fetches a ProfileInput with the given ProfileInput id. Returns None, if there is no matching input.

Reads the file for the serialized Profile object. Currently supports only data format in json.


Remove a ProfileInput from the inputs list of the Profile.

Remove a ProfileOutput from the outputs list of the Profile.

Remove a PolicySet from the policy_sets list of the Profile.



Bases: object

This class consists of methods for accessing the ProfileResource.

Create a new profile for the given Profile object.

Reads the file for the serialized Profile object. Performs the profile create operation. Currently supports only data format in json.

Delete a profile with the given Profile Id.

Disables a profile.

Enables a profile.

Fetches information for the profile for the given profile id. Returns a ProfileData object.

Fetches the list of profiles. The start and size arguments provide pagination support. Returns a ProfileDataInfoCollection object.

Modify an existing profile with the given Profile object.

Reads the file for the serialized Profile object. Performs the profile modify operation. Currently supports only data format in json.



Bases: object

Represents a collection of ProfileDataInfo objects. Also encapsulates the links for the list of the objects stored.



Bases: object

This class encapsulates all the attributes of a profile to generate a specific property of a certificate. Ex. Subject name, Requestor Information etc.

Add a ProfileAttribute object to the attributes list.

Add a ProfileAttribute object to the config_attributes list.


Returns a ProfileAttribute object for the given name. None, if no match.

Returns a ProfileAttribute object with the given name. None, if there is no match in the config_attributes list.


Remove a ProfileAttribute object with the given name from the attributes list.

Remove a ProfileAttribute object with the given name from the config_attributes list.


Bases: object

This class defines the output of a certificate enrollment request using a profile.

Add a ProfileAttribute object to the attributes list.


Returns a ProfileAttribute object for the given name. None, if no match.


Remove a ProfileAttribute object with the given name from the attributes list.



Bases: object

This class represents the policy a profile adheres to. An object of this class stores the default values for profile and the constraints present on the values of the attributes of the profile submitted for an enrollment request.




Bases: object

Stores a list of ProfilePolicy objects.




system Module





Bases: object

Class representing the entire security domain. This is essentially a list of SecurityDomainSubsystem components.

Create a DomainInfo object from JSON.
json_value (str) -- JSON representation of a security domain.
DomainInfo





Bases: object

Client used to get the security domain from a security domain CA. The connection details for the security domain CA are specified in a PKIConnection object used to construct this client.

Contact the security domain CA specified in the connection object used to construct this client and get the security domain using the REST API.
pki.system.DomainInfo



Contact the security domain CA specified in the connection object used to construct this client and get the security domain using the old servlet-based interface. This method is useful when contacting old servers which do not provide the REST API.
pki.system.DomainInfo




Bases: object

Class representing a security domain host.

Constructs a SecurityDomainHost object from JSON.
json_value (str) -- JSON string representing a security domain host.
SecurityDomainHost



Bases: object

Class representing a security domain subsystem. This is essentially a list of SecurityDomainHost objects of a particular subsystem type (ca, kra, tps, tks, ocsp).

Constructs a SecurityDomainSubsystem from a JSON representation.
json_value (str) -- JSON representation of the Security Domain Subsystem
SecurityDomainSubsystem




Bases: object

Class used to represent the data for a system certificate, which is used in the data passed into and returned from the Java installation servlet during the execution of pkispawn.

This class is the python equivalent of the Java class: com.netscape.certsrv.system.SystemCertData


Bases: object

Client used to interact with the Java configuration servlet to configure a Dogtag subsystem during the execution of pkispawn.

The connection details for the system being configured are passed in the PKIConnection object used when constructing this object.

Create certificate.
request (CertificateSetupRequest) -- Certificate setup request
SystemCertData


Create certificate ID.
request (CertificateSetupRequest) -- Certificate setup request
SystemCertData


Create certificate request ID.
request (CertificateSetupRequest) -- Certificate setup request
SystemCertData


Initialize subsystem.
request (CertificateSetupRequest) -- Certificate setup request



Bases: object

Client used to check the status of a Dogtag subsystem.

Checks the status of the subsystem by calling the getStatus() servlet. This is used to determine if the server is up and ready to receive and process requests.
str - getStatus response



systemcert Module

Module containing the Python client classes for the SystemCert REST API

Bases: object

Class encapsulating and mirroring the functionality in the SystemCertResource Java interface class defining the REST API for system certificate resources.

Return transport certificate.
pki.cert.CertData -- transport certificate data



upgrade Module




util Module

Module containing utility functions and classes for the Dogtag python code


Change permissions of a file, link, or folder recursively.

Change ownership of a file, link, or folder recursively.


Copy a folder and its parents (without the contents) while preserving their attributes.


Recursively copy a directory tree using copy2().
allow 'The destination directory to already exist.'

If exception(s) occur, an Error is raised with a list of reasons.

If the optional symlinks flag is true, symbolic links in the source tree result in symbolic links in the destination tree; if it is false, the contents of the files pointed to by symbolic links are copied.

The optional ignore argument is a callable. If given, it is called with the src parameter, which is the directory being visited by copytree(), and names which is the list of src contents, as returned by os.listdir():

callable(src, names) -> ignored_names


Since copytree() is called recursively, the callable will be called once for each directory that is copied. It returns a list of names relative to the src directory that should not be copied.

Consider this example code rather than the ultimate tool.


Customize a file with specified parameters.




Get an input from the user. This is used, for example, in pkispawn and pkidestroy to obtain user input.
  • message (str) -- prompt to display to the user
  • options (list) -- list of possible inputs by the user.
  • default (str) -- default value of parameter being prompted.
  • delimiter (str) -- delimiter to be used at the end of the prompt.
  • case_sensitive (boolean -- True/False) -- Allow input to be case sensitive.
  • password (boolean -- True/False) -- Input is a password. Don't show the value.
  • required (boolean -- True/False) -- Input must be non-empty.

str -- value obtained from user input.



Replace all occurrences of [param] in the line with the value of the parameter.






  • Index
  • Module Index
  • Search Page

AUTHOR

Dogtag PKI Project Team

COPYRIGHT

2023, Dogtag PKI Team

February 7, 2023 @APPLICATION_VERSION@