X509.Read
---------

Reads a PEM certificate from text.

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

MBS( "X509.Read"; Text ) 

**MBS**( **"X509.Read";** /\* Reads a PEM certificate from text. \*/  
**$Text**) /\* The certificate in PEM format as text.  
PEM file may contain multiple things like certificate and private or public key. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Text | The certificate in PEM format as text.   PEM file may contain multiple things like certificate and private or public key. |  |

### Result

Returns X509 reference number or error.

### Description

Reads a PEM certificate from text.  
See also X509.ReadFromContainer for reading from container and X509.ReadFromFile to read from file on disk.  
### Examples

Reads a certificate and shows name:

 Set Variable \[$cert ; Value:MBS ( "X509.Read"; test::Cert )\]  
If \[MBS ("IsError")\]  
 Show Custom Dialog \["Error"; $cert \]  
Else  
 Show Custom Dialog \["Name"; MBS ( "X509.Name"; $cert )\]  
 Set Variable \[$r ; Value:MBS ( "X509.Release"; $cert )\]  
End If  
Load a certificate, that doesn't come with the header/footer:

 MBS ( "X509.Read"; "-----BEGIN CERTIFICATE-----" &amp; ¶ &amp; PDF JSON::Cert &amp; ¶ &amp; "-----END CERTIFICATE-----")  
### See also

- [DynaPDF.GetFieldAsJSON](DynaPDFGetFieldAsJSON.md)
- [DynaPDF.GetFieldsAsJSON](DynaPDFGetFieldsAsJSON.md)
- [SendMail.Sign](SendMailSign.md)
- [X509.Description](X509Description.md)
- [X509.IssuerName](X509IssuerName.md)
- [X509.Name](X509Name.md)
- [X509.ReadFromContainer](X509ReadFromContainer.md)
- [X509.Release](X509Release.md)
- [X509.SubjectName](X509SubjectName.md)
- [X509.Write](X509Write.md)

### Release notes

- **Version 9.1**
    - Added support for binary format to [X509.Read](http://www.mbsplugins.eu/X509Read.shtml), [X509.ReadFromContainer](http://www.mbsplugins.eu/X509ReadFromContainer.shtml) and [X509.ReadFromFile](http://www.mbsplugins.eu/X509ReadFromFile.shtml).

This function checks for a license.

Created 23th December 2016 , last changed 3th December 2024

  
[X509.Name](X509Name.md) - [X509.ReadFromContainer](X509ReadFromContainer.md)

[HTML Version](X509Read.shtml)