PKCS12.CA
---------

Queries certificate with given index.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [Certificates](component_Certificates.md) | [7.0](newinversion70.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "PKCS12.CA"; PKCS12 Reference { ; Index } ) 

**MBS**( **"PKCS12.CA";** /\* Queries certificate with given index. \*/  
**$PKCS12 Reference**; /\* The reference to the PKCS12.e.g. $pkcs12 \*/   
**$Index**) /\* Optional; The index of the certificate to get.  
From 0 to PKCS12.CACount-1.  
Default 0.e.g. 0 \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| PKCS12 Reference | The reference to the PKCS12. | $pkcs12 |  |
| Index | The index of the certificate to get.   From 0 to PKCS12.CACount-1.   Default 0. | 0 | Optional |

### Result

Returns X509 reference number or error.

### Description

Queries certificate with given index.  
A PKCS12 file may contain more than one certificate.  
### Examples

Query certificates:

 Set Variable \[$p12 ; Value:MBS ( "PKCS12.ReadFromContainer"; test::Container ; "Geslo123#" )\]  
If \[MBS ("IsError")\]  
 Show Custom Dialog \["Error"; $p12 \]  
Else  
 Set Variable \[$count ; Value:MBS ( "PKCS12.CACount"; $p12 )\]  
 Set Variable \[$index ; Value:0\]  
 Loop  
 Set Variable \[$cert ; Value:MBS ( "PKCS12.CA"; $p12 ; $index )\]  
 Show Custom Dialog \["Certificate"; MBS ( "X509.Description"; $cert )\]  
 Set Variable \[$r ; Value:MBS ( "X509.Release"; $cert )\]  
 # next  
 Set Variable \[$index ; Value:$index + 1\]  
 Exit Loop If \[$index &gt;= $count \]  
 End Loop  
 Set Variable \[$r ; Value:MBS ( "PKCS12.Release"; $p12 )\]  
End If  
### See also

- [IsError](IsError.md)
- [PKCS12.CACount](PKCS12CACount.md)
- [PKCS12.ReadFromContainer](PKCS12ReadFromContainer.md)
- [PKCS12.ReadFromFile](PKCS12ReadFromFile.md)
- [PKCS12.Release](PKCS12Release.md)
- [X509.Description](X509Description.md)
- [X509.Release](X509Release.md)

This function checks for a license.

Created 23th December 2016 , last changed 14th July 2022

  
[PDFKit.isLocked](PDFKitisLocked.md) - [PKCS12.CACount](PKCS12CACount.md)

[HTML Version](PKCS12CA.shtml)