CURL.SetOptionPinnedPublicKey
-----------------------------

Set the public key in DER form used to validate the peer public key.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [8.2](newinversion82.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionPinnedPublicKey"; curl; Value; TextView ) 

**MBS**( **"CURL.SetOptionPinnedPublicKey"** /\* Set the public key in DER form used to validate the peer public key. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**; /\* The option value. \*/   
**$TextView**) /\* The reference number to the text view. \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | The option value. |  |
| TextView | The reference number to the text view. | $textview |

### Result

Returns OK or error.

### Description

Set the public key in DER form used to validate the peer public key.  
Native path to key file.  
This option is used only if SSLVerifyPeer is true.  
  
The string can be the file name of your pinned public key. The file format expected is "PEM" or "DER". The string can also be any number of base64 encoded sha256 hashes preceded by "sha256//" and separated by ";"  
When negotiating a TLS or SSL connection, the server sends a certificate indicating its identity. A public key is extracted from this certificate and if it does not exactly match the public key provided to this option, curl will abort the connection before sending or receiving any data.  
See also [PINNEDPUBLICKEY](https://curl.haxx.se/libcurl/c/CURLOPT_PINNEDPUBLICKEY.html) option in CURL manual.

### See also

- [CURL.SetOptionProxyPinnedPublicKey](CURLSetOptionProxyPinnedPublicKey.md)

### Example Databases

- [CURL/CURL Certificate Pinning](https://www.mbsplugins.eu/MBS-FileMaker-Plugin-Examples/CURL/CURL%20Certificate%20Pinning.shtml#1ScriptAnchor_)

Created 15th April 2018 , last changed 21st July 2020

  
[CURL.SetOptionPathAsIs](CURLSetOptionPathAsIs.md) - [CURL.SetOptionPipeWait](CURLSetOptionPipeWait.md)

[HTML Version](CURLSetOptionPinnedPublicKey.shtml)