PKey.Read
---------

Reads a private/public key from PEM certificate from text.

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

MBS( "PKey.Read"; Text { ; Password } ) 

**MBS**( **"PKey.Read";** /\* Reads a private/public key from PEM certificate from text. \*/  
**$Text**; /\* The key in PEM format as text.  
PEM file may contain multiple things like certificate and private or public key. \*/   
**$Password**) /\* Optional; For encrypted private keys, the password to use.e.g. "test" \*/ 

### Parameters

| Parameter | Description | Example | Flags |
|---|---|---|---|
| Text | The key in PEM format as text.   PEM file may contain multiple things like certificate and private or public key. |  |  |
| Password | For encrypted private keys, the password to use. | "test" | Optional |

### Result

Returns PKey reference number or error.

### Description

Reads a private/public key from PEM certificate from text.  
See also [PKey.ReadFromContainer](PKeyReadFromContainer.md) for reading from container and [PKey.ReadFromFile](PKeyReadFromFile.md) to read from file on disk.  
### See also

- [Encryption.PubKeyEncrypt](EncryptionPubKeyEncrypt.md)
- [PKey.ReadFromContainer](PKeyReadFromContainer.md)
- [PKey.ReadFromFile](PKeyReadFromFile.md)
- [SendMail.Sign](SendMailSign.md)

### Release notes

- **Version 11.4**
    - Added password parameter for [PKey.Read](https://www.mbsplugins.eu/PKeyRead.shtml) function to read encrypted private keys.
    - Added [PKey.Read](https://www.mbsplugins.eu/PKeyRead.shtml), [PKey.ReadFromContainer](https://www.mbsplugins.eu/PKeyReadFromContainer.shtml) and [PKey.ReadFromFile](https://www.mbsplugins.eu/PKeyReadFromFile.shtml) functions.

### Blog Entries

- [New in MBS FileMaker Plugin 11.4](https://www.mbsplugins.de/archive/2021-09-15/New_in_MBS_FileMaker_Plugin_11/monkeybreadsoftware_blog_filemaker)
- [MBS FileMaker Plugin, version 11.4pr3](https://www.mbsplugins.de/archive/2021-08-25/MBS_FileMaker_Plugin_version_1/monkeybreadsoftware_blog_filemaker)

This function checks for a license.

Created 22nd August 2021 , last changed 24th August 2021

  
[PKey.List](PKeyList.md) - [PKey.ReadFromContainer](PKeyReadFromContainer.md)

[HTML Version](PKeyRead.shtml)