UAPI Functions - SSL::find_certificates_for_key

Description

This function retrieves SSL certificates for a private key.

Examples


 cPanel or Webmail Session URL

https://hostname.example.com:2083/cpsess##########/execute/SSL/find_certificates_for_key?friendly_name=TestKey

 LiveAPI PHP Class

$cpanel new CPANEL(); // Connect to cPanel - only do this once.
  
// Retrieve certificates that are associated with the TestKey key.
$SSL_find_certificates_for_key $cpanel->uapi(
    'SSL''find_certificates_for_key',    array(
        'friendly_name'    => 'TestKey',
    )
);

 LiveAPI Perl Module

my $cpliveapi = Cpanel::LiveAPI->new(); # Connect to cPanel - only do this once.
  
#  Retrieve certificates that are associated with the TestKey key.
my $SSL_find_certificates_for_key $cpliveapi->uapi(
    'SSL''find_certificates_for_key',    {
        'friendly_name'    => 'TestKey',
    }
);

 cPanel Template Toolkit

<!--  Retrieve certificates that are associated with the TestKey key. -->
[% data = execute( 'SSL', 'find_certificates_for_key', { friendly_name => 'TestKey'} ); %]
[% FOREACH q = data %]
     <p>
         [% q %]
     </p>
[% END %]

 Command Line

uapi --user=username SSL find_certificates_for_key friendly_name=TestKey

 

Notes:

  • You must URI-encode values.
  • username represents your account-level username.

 Output (JSON)

{
  "messages": null,
  "errors": null,
  "status": 1,
  "metadata": {
    "transformed": 1
  },
  "data": [
    {
      "is_self_signed": "1",
      "validation_type":"dv",
      "signature_algorithm":"sha256WithRSAEncryption",
      "issuer.organizationName": "The Example Organization",
      "modulus": "a74f7636fa6ac93ee6836a83a995b55deb5019ea36d7ba3dafb00e38d693acdb0c81b2ff777d6b433a420fae523f127f352a68bcc8b8f2d6ee7b70395bafabd8237ada8164fdddf8376b30375c35d4d4cbcce7d33d08069c17b409176a3689f1ebc97c0b08fe6ae44c19a92ac6d68448e7f1d13f3b360affd4222a51b4f35342de99b5a1fb5548e438f2d824664562a448002eed7fce24dedc7dc3e1ed179973d1dae959b33716eeb410d172708954e00632cbf60a0e26419860c8c0bc285d6bfe4b479de0dd189772a5dae676bd2a92acccc1369821be8cffddd8a7e6ecc061f8a32a9ae0661e4e946ed8e3827b277138d3a76116567cbd129cbd869ef9dddf",
      "subject.commonName": "example.com",
      "not_before": "1415123822",
      "modulus_length": "2048",
      "not_after": "1446659822",
      "created": "1415123822",
      "domains": [
        "example.com"
      ],
      "issuer.commonName": "example.com",
      "friendly_name": "TestCert",
      "id": "example_com_a74f7_9dddf_1446659822_eae1ff43c4ec1991e195877c55755eff"
    }
  ]
}

 

Note:

Use cPanel's API Shell interface (Home >> Advanced >> API Shell) to directly test cPanel API calls.

 

Parameters

You must include one of the following parameters:

Parameter

Type

Description

 Possible values 

 Example 

id

string

The key's ID.

A valid string.

 

 friendly_name 

 string 

 The key's friendly name. 

A valid string.

TestKey

 

Returns

Return

Type

Description

Possible values

Example

is_self_signed

 Boolean 

Whether the certificate is self-signed.

  • 1 — Self-signed.
  • 0 — Not self-signed.

1

             

validation_type

string

The certificate's validation type.

Note:

We introduced this return in cPanel & WHM version 56.

  • ev — Extended Validation.
  • ov — Organization Validation.
  • dv — Domain Validation.
  • undef — The system could not parse and determine the certificate's validation type.

dv

signature_algorithm

 

 

string

The signature algorithm of the certificate.

Note:

 We introduced this return in cPanel & WHM version 56. 

A valid OID hash algorithm name.

 sha256WithRSAEncryption 

 issuer.organizationName 

string

The certificate's organization name.

A valid string.

The Example Organization

modulus

string

The certificate's modulus.

A valid string.

 

subject.commonName

string

The certificate's common name.

A valid domain.

example.com

not_before

string

When the certificate started.

A date in Unix time format.

1415123822

modulus_length

string

The length of the certificate's modulus.

A positive integer.

2048

not_after

string

When the certificate expired.

A date in Unix time format.

1446659822

created

string

When the certificate was created.

A date in Unix time format.

1415123822

domains

array

The domains that the certificate covers.

A valid domain or domains.

example.com

issuer.commonName

string

The name that issued the certificate.

Usually, a valid domain.

example.com

friendly_name

string

The certificate's friendly name.

A valid string.

TestCert

id

string

The certificate's ID.

A valid string.

 

 

  • 18 Users Found This Useful
Was this answer helpful?

Related Articles

The cPanel Interface

For  cPanel  &  WHM  version  58 Overview The cPanel interface is...

User Preferences

For cPanel & WHM version 58 Overview This document outlines how to access your cPanel...

Manage External Authentications

For cPanel & WHM version 58 Overview Manage credentials Additional documentation...

What is cPanelID?

In This Article:  Overview ServicesHow to get a cPanelID cPanelID External...

Guide to cPanel Interface Customization - cPanel Style Development

Introduction You can develop custom styles that modify the appearance of the cPanel interface....