@@ -2229,23 +2229,24 @@ impl<H> Easy2<H> {
2229
2229
self . setopt_long ( curl_sys:: CURLOPT_CERTINFO , enable as c_long )
2230
2230
}
2231
2231
2232
- // /// Set pinned public key.
2233
- // ///
2234
- // /// Pass a pointer to a zero terminated string as parameter. The string can
2235
- // /// be the file name of your pinned public key. The file format expected is
2236
- // /// "PEM" or "DER". The string can also be any number of base64 encoded
2237
- // /// sha256 hashes preceded by "sha256//" and separated by ";"
2238
- // ///
2239
- // /// When negotiating a TLS or SSL connection, the server sends a certificate
2240
- // /// indicating its identity. A public key is extracted from this certificate
2241
- // /// and if it does not exactly match the public key provided to this option,
2242
- // /// curl will abort the connection before sending or receiving any data.
2243
- // ///
2244
- // /// By default this option is not set and corresponds to
2245
- // /// `CURLOPT_PINNEDPUBLICKEY`.
2246
- // pub fn pinned_public_key(&mut self, enable: bool) -> Result<(), Error> {
2247
- // self.setopt_long(curl_sys::CURLOPT_CERTINFO, enable as c_long)
2248
- // }
2232
+ /// Set pinned public key.
2233
+ ///
2234
+ /// Pass a pointer to a zero terminated string as parameter. The string can
2235
+ /// be the file name of your pinned public key. The file format expected is
2236
+ /// "PEM" or "DER". The string can also be any number of base64 encoded
2237
+ /// sha256 hashes preceded by "sha256//" and separated by ";"
2238
+ ///
2239
+ /// When negotiating a TLS or SSL connection, the server sends a certificate
2240
+ /// indicating its identity. A public key is extracted from this certificate
2241
+ /// and if it does not exactly match the public key provided to this option,
2242
+ /// curl will abort the connection before sending or receiving any data.
2243
+ ///
2244
+ /// By default this option is not set and corresponds to
2245
+ /// `CURLOPT_PINNEDPUBLICKEY`.
2246
+ pub fn pinned_public_key ( & mut self , pubkey : & str ) -> Result < ( ) , Error > {
2247
+ let key = CString :: new ( pubkey) ?;
2248
+ self . setopt_str ( curl_sys:: CURLOPT_PINNEDPUBLICKEY , & key)
2249
+ }
2249
2250
2250
2251
/// Specify a source for random data
2251
2252
///
0 commit comments