# Get informations of a certificate

The certificate must be in PEM format. The result is a stdClass object. Two méthods :

* *getCertInfo* : to get from a variable
* *getCertInfoFile* : to get from a file

Get informations from a variable :

```php
use Svgta\OidcLib\OidcUtils;

  $cert = <<<EOD
  -----BEGIN CERTIFICATE-----
// Certificate informations to PEM format
-----END CERTIFICATE-----
  EOD;
  $res = OidcUtils::getCertInfo($cert);
```

Get informations from a file :

```php
  $path = '../pathTotheCertDir/myCert.crt';
  $res = OidcUtils::getCertInfoFile($path);
```

Response example :

```shell
stdClass Object
(
    [kty] => RSA
    [n] => s7npv4N-zt7XkCy3uCYkH38RYM-...
    [e] => AQAB
    [x5c] => Array
        (
            [0] => MIIDhzCCAm+gAwIBAgIEW66...
        )

    [x5t] => slZpLDjRxb86V8SqKHPl8KrRDII
    [x5t#256] => _pWwqSqIPbsaYBkQXCZzzOBcSEuGXJBymHgocLQlixU
)
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://svgtas-organization.gitbook.io/php-oidc-client/utils/get-informations-of-a-certificate.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
