🔍 Code Extractor

class CertificateAuthority

Maturity: 46

A data class representing a certificate authority with its associated properties such as certificate, revocation list URL, and issuer information.

File:
/tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/certificates/authority.py
Lines:
4 - 28
Complexity:
simple

Purpose

This class serves as a data container for certificate authority information in the Office365 API context. It encapsulates all relevant details about a certificate authority including the certificate itself, whether it's a root or intermediate authority, issuer details, and certificate revocation list URL. It inherits from ClientValue, suggesting it's used for serialization/deserialization in API communications with Office365 services.

Source Code

class CertificateAuthority(ClientValue):
    """Represents a certificate authority."""

    def __init__(
        self,
        certificate=None,
        certificate_revocation_list_url=None,
        is_root_authority=None,
        issuer=None,
        issuer_ski=None,
    ):
        """
        :param str certificate: The base64 encoded string representing the public certificate.
        :param str certificate_revocation_list_url: The URL of the certificate revocation list.
        :param str is_root_authority: Required. true if the trusted certificate is a root authority, false if the
            trusted certificate is an intermediate authority.
        :param str issuer: The issuer of the certificate, calculated from the certificate value
        :param str issuer_ski: The subject key identifier of the certificate, calculated from the certificate value.
        """
        super(CertificateAuthority, self).__init__()
        self.certificate = certificate
        self.certificateRevocationListUrl = certificate_revocation_list_url
        self.isRootAuthority = is_root_authority
        self.issuer = issuer
        self.issuerSki = issuer_ski

Parameters

Name Type Default Kind
bases ClientValue -

Parameter Details

certificate: The base64 encoded string representing the public certificate. This is the actual certificate data in encoded format. Optional parameter, defaults to None.

certificate_revocation_list_url: The URL where the certificate revocation list (CRL) can be accessed. This URL points to a list of certificates that have been revoked before their expiration date. Optional parameter, defaults to None.

is_root_authority: A boolean-like value (stored as string) indicating whether this is a root certificate authority (true) or an intermediate certificate authority (false). This is a required field that determines the certificate's position in the trust chain.

issuer: The issuer of the certificate, typically calculated from the certificate value itself. Contains information about the entity that issued this certificate. Optional parameter, defaults to None.

issuer_ski: The Subject Key Identifier (SKI) of the certificate issuer, calculated from the certificate value. This is a unique identifier for the certificate's public key. Optional parameter, defaults to None.

Return Value

Instantiation returns a CertificateAuthority object with all provided attributes set. The object has instance attributes that can be accessed directly: certificate, certificateRevocationListUrl, isRootAuthority, issuer, and issuerSki. Note that parameter names use snake_case but are stored as camelCase attributes.

Class Interface

Methods

__init__(self, certificate=None, certificate_revocation_list_url=None, is_root_authority=None, issuer=None, issuer_ski=None)

Purpose: Initializes a new CertificateAuthority instance with the provided certificate authority details

Parameters:

  • certificate: The base64 encoded string representing the public certificate
  • certificate_revocation_list_url: The URL of the certificate revocation list
  • is_root_authority: Boolean string indicating if this is a root authority (true) or intermediate authority (false)
  • issuer: The issuer of the certificate, calculated from the certificate value
  • issuer_ski: The subject key identifier of the certificate, calculated from the certificate value

Returns: None (constructor)

Attributes

Name Type Description Scope
certificate str The base64 encoded string representing the public certificate instance
certificateRevocationListUrl str The URL of the certificate revocation list (camelCase version of constructor parameter) instance
isRootAuthority str Boolean string indicating whether this is a root authority or intermediate authority (camelCase version of constructor parameter) instance
issuer str The issuer of the certificate, calculated from the certificate value instance
issuerSki str The subject key identifier of the certificate, calculated from the certificate value (camelCase version of constructor parameter) instance

Dependencies

  • office365

Required Imports

from office365.runtime.client_value import ClientValue

Usage Example

from office365.runtime.client_value import ClientValue

# Create a root certificate authority
root_ca = CertificateAuthority(
    certificate='MIIDXTCCAkWgAwIBAgIJAKZ...',
    certificate_revocation_list_url='https://example.com/crl',
    is_root_authority='true',
    issuer='CN=Example Root CA, O=Example Corp',
    issuer_ski='A1:B2:C3:D4:E5:F6'
)

# Access attributes
print(root_ca.certificate)
print(root_ca.isRootAuthority)
print(root_ca.issuer)

# Create an intermediate certificate authority
intermediate_ca = CertificateAuthority(
    certificate='MIIDYTCCAkmgAwIBAgIJALM...',
    is_root_authority='false',
    issuer='CN=Example Intermediate CA, O=Example Corp'
)

Best Practices

  • Always provide the is_root_authority parameter as it's marked as required in the documentation
  • Note the parameter name conversion: snake_case constructor parameters are stored as camelCase attributes (e.g., certificate_revocation_list_url becomes certificateRevocationListUrl)
  • The certificate should be base64 encoded before passing to this class
  • This class is primarily a data container and doesn't perform validation or certificate operations
  • Typically used as part of Office365 API requests/responses rather than standalone
  • The issuer and issuer_ski are usually calculated from the certificate value, so they may be auto-populated by the API
  • This class inherits from ClientValue, which likely provides serialization capabilities for API communication

Similar Components

AI-powered semantic similarity - components with related functionality:

  • class SelfSignedCertificate 75.2% similar

    A data class representing the public part of a self-signed certificate, inheriting from ClientValue for use in Office 365 API operations.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/certificates/self_signed.py
  • class Pkcs12CertificateInformation 72.6% similar

    A data class that represents the public information of a PKCS#12 certificate, including thumbprint, active status, and validity period.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/certificates/pkcs12_information.py
  • class Certification 71.1% similar

    A data class representing certification details of an application, inheriting from ClientValue to provide serialization capabilities for Office 365 API interactions.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/certificates/certification.py
  • class ClientCertificateAuthentication 63.3% similar

    A class representing Pkcs12-based client certificate authentication configuration, derived from ApiAuthenticationConfigurationBase, used to manage and retrieve public properties of uploaded certificates.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/authentication/client_certificate.py
  • class CertificateBasedAuthConfiguration 58.4% similar

    Represents Azure Active Directory certificate-based authentication configuration for Exchange Online accounts, managing trusted certificate authorities for client certificate authentication.

    From: /tf/active/vicechatdev/SPFCsync/venv/lib64/python3.11/site-packages/office365/directory/certificates/auth_configuration.py
← Back to Browse