Skip to main content

SDK in Python for Command 11.x Web APIs.

Project description

ALPHA build/internal testing only:

SDK in Python for Command 11.2 Web APIs. Compatible with both AD auth and OAuth, though this is NOT supported in any capacity and NOT rigorously tested.

Setup:

  1. Clone this repo.
  2. Set environment variables as per one of the examples below.
  3. Change directory to the repo root and run python.
  4. Import keyfactor.

Authentication options:

export KEYFACTOR_HOSTNAME=keyfactor.example.com
export KEYFACTOR_USERNAME=User
export KEYFACTOR_PASSWORD=MyPassword
export KEYFACTOR_DOMAIN=EXAMPLEDOMAIN

OR

export KEYFACTOR_HOSTNAME=kftrain.keyfactor.lab
export COMMAND_IDP_TOKENURL=https://<idp host>/realms/Keyfactor/protocol/openid-connect/token
export COMMAND_IDP_CLIENTID=MyIdpCilent
export COMMAND_IDP_CLIENTSECRET=MyClientSecret

Usage:

>>> keyfactor.get_metadata_fields_()

[CSSCMSDataModelModelsMetadataFieldTypeModel(id=1, name='Email-Contact', description='Email contact for the certificate.',
>>> keyfactor.enrollment_pfx({"subject":"CN=foo","template":"WebServer","timestamp":"2024-04-02T18:00:00Z","certificate_authority":"mycahost\\MyCALogicalName"})

{'certificateInformation': {'keyfactorRequestId': 0, 'requestDisposition': 'ISSUED', 'dispositionMessage': 'The template was not set up for private key retention, so no private key was saved.', 'enrollmentContext': None, 'keyfactorId': 64478, 'pkcs12Blob': 'MIIL7...

Quickstart

Installation

git clone https://github.com/Keyfactor/command-11-python-client-sdk.git
pip install .

Environment Variables

export KEYFACTOR_HOSTNAME=keyfactor.example.com
export KEYFACTOR_USERNAME=User
export KEYFACTOR_PASSWORD=MyPassword
export KEYFACTOR_DOMAIN=EXAMPLEDOMAIN

Usage

from command_v11_client import keyfactor

certs = []
index = 1  # Start at page 1 as any page <1 will return the results of page 1
while (c := keyfactor.get_certificates_(
        include_locations=True,
        include_metadata=True,
        include_has_private_key=True,
        page_returned=index
)):
    certs.extend(c)
    index += 1

for cert in certs:
    print(cert)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

keyfactor_command_sdk-11.0.0a1.tar.gz (300.1 kB view details)

Uploaded Source

Built Distribution

keyfactor_command_sdk-11.0.0a1-py3-none-any.whl (1.1 MB view details)

Uploaded Python 3

File details

Details for the file keyfactor_command_sdk-11.0.0a1.tar.gz.

File metadata

File hashes

Hashes for keyfactor_command_sdk-11.0.0a1.tar.gz
Algorithm Hash digest
SHA256 ee5143db12e863cdb05a639380f70a252ae658db9b014d3dfbffc6f662fde411
MD5 29ab12428ea71e565e64b96b8f3f4877
BLAKE2b-256 800388cf4873f50190740033c46b0ea3f7278b07031efd899899f5cd5aa5ac15

See more details on using hashes here.

File details

Details for the file keyfactor_command_sdk-11.0.0a1-py3-none-any.whl.

File metadata

File hashes

Hashes for keyfactor_command_sdk-11.0.0a1-py3-none-any.whl
Algorithm Hash digest
SHA256 00a8b225f8d029433400067f6fedb65a96d70c98da31724650e11e41113c0034
MD5 2ae1a111ac59bfe092079609d9bf9237
BLAKE2b-256 1c3ca888d293069e922587ddeb0c8c697beeafe04522ae3fff412eb263004b11

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page