X509.ReadFromFile
-----------------

Reads a certificate from a PEM file.

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

MBS( "X509.ReadFromFile"; Path ) 

**MBS**( **"X509.ReadFromFile";** /\* Reads a certificate from a PEM file. \*/  
**$Path**) /\* The native file path to the PEM file.e.g. "/Users/cs/Desktop/test.pem" \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| Path | The native file path to the PEM file. | "/Users/cs/Desktop/test.pem" |

### Result

Returns X509 reference number or error.

### Description

Reads a certificate from a PEM file.  
  
This function requires a native path. Use [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md) to convert a FileMaker path to a native path if required. If you like to have the user choose the path, you can use [FileDialog](component_FileDialog.md) functions.  
For Server be aware that server has limited permissions and may not be able to access all files on a computer.  
### Examples

Reads a certificate and shows name:

 Set Variable \[$cert ; Value:MBS ( "X509.ReadFromFile"; "/Users/cs/Desktop/test.pem" )\]  
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  
### See also

- [Hash.Digest](HashDigest.md)
- [IsError](IsError.md)
- [Path.FileMakerPathToNativePath](PathFileMakerPathToNativePath.md)
- [PKCS7.ReadFromFile](PKCS7ReadFromFile.md)
- [PKey.ReadFromFile](PKeyReadFromFile.md)
- [X509.Name](X509Name.md)
- [X509.Read](X509Read.md)
- [X509.Release](X509Release.md)
- [X509.SerialNumber](X509SerialNumber.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 23th December 2016

  
[X509.ReadFromContainer](X509ReadFromContainer.md) - [X509.Release](X509Release.md)

[HTML Version](X509ReadFromFile.shtml)