HTTPS/Client-authenticated: Difference between revisions
m
syntax highlighting fixup automation
Thundergnat (talk | contribs) m (→{{header|Perl}}: Fix syntax highlighting markup) |
Thundergnat (talk | contribs) m (syntax highlighting fixup automation) |
||
Line 8:
{{works with|C sharp|3.0}}
<
using System;
using System.Net;
Line 32:
}
}
</syntaxhighlight>
=={{header|Go}}==
<
import (
Line 73:
}
</syntaxhighlight>
=={{header|Julia}}==
<
conf = MbedTLS.SSLConfig(true, log_secrets="/utl/secret_key_log.log")
Line 82:
println(resp)
</
HTTP.Messages.Response:
"""
Line 102:
=={{header|Kotlin}}==
<
import java.security.KeyStore
Line 138:
println(line)
}
}</
=={{header|Lasso}}==
<
local(x = curl('https://sourceforge.net'))
#x->set(CURLOPT_SSLCERT, #sslcert->readstring)
#sslcert->close
#x->result->asString</
=={{header|Mathematica}} / {{header|Wolfram Language}}==
<
For[ i=0, i < Length[a] , i++, SomeFunction[a]]</
=={{header|Nim}}==
<
var client = newHttpClient(sslContext = newContext(certFile = "mycert.pem"))
var r = client.get("https://www.example.com")</
=={{header|Perl}}==
<
use 5.018_002;
use warnings;
Line 178:
else {
say $res->status_line;
}</
=={{header|Phix}}==
{{libheader|Phix/libcurl}}
Exactly the same as the HTTP#Phix task, except for the CURLOPT_SSLCERT part.
<!--<
<span style="color: #008080;">without</span> <span style="color: #008080;">js</span>
<span style="color: #008080;">include</span> <span style="color: #000000;">builtins</span><span style="color: #0000FF;">\</span><span style="color: #000000;">libcurl</span><span style="color: #0000FF;">.</span><span style="color: #000000;">e</span>
Line 197:
<span style="color: #7060A8;">puts</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span><span style="color: #000000;">res</span><span style="color: #0000FF;">)</span>
<!--</
=={{header|PicoLisp}}==
<
(while (line)
(doSomeProcessingWithLine @) ) )</
=={{header|Python}}==
<
connection = httplib.HTTPSConnection('www.example.com',cert_file='myCert.PEM')
Line 211:
response = connection.getresponse()
data = response.read()
</syntaxhighlight>
=={{header|Racket}}==
Skeleton code to connect to a server:
<
#lang racket
(require openssl/mzssl)
Line 223:
(ssl-load-verify-root-certificates! ctx "my-cert.pem")
(define-values [I O] (ssl-connect "www.example.com" 443 ctx))
</syntaxhighlight>
=={{header|Raku}}==
(formerly Perl 6)
<syntaxhighlight lang="raku" line>
# cert creation commands
Line 256:
$s.close;
</syntaxhighlight>
=={{header|Ruby}}==
<
require 'net/http'
Line 270:
request = Net::HTTP::Get.new uri
http.request request
end</
=={{header|Rust}}==
{{works with|Rust|2021}}
Line 278:
Native (system) TLS libraries are used instead of Rustls, the Rust TLS implementation, because we use a PKCS#12 certificate which at the time of writing does not seem to be available on Rustls. A PKCS#12 certificate is used instead of its PEM equivalent because reading password-protected PEM files [https://docs.rs/reqwest/0.11.6/reqwest/tls/struct.Identity.html#method.from_pem does not seem to be available] either.
<
===src/main.rs===
<
use std::io::Read;
Line 307:
Ok(())
}</
=={{header|Scala}}==
<
import java.net.URL
import java.security.KeyStore
Line 338:
new BufferedSource(con.getInputStream).getLines.foreach(println(_))
}</
=={{header|Tcl}}==
Uses the [http://tls.sourceforge.net Tls] package.
<
package require tls
Line 357:
# Now as for conventional use of the “http” package
set data [http::data $token]
http::cleanup $token</
=={{header|Wren}}==
{{libheader|libcurl}}
An embedded program so we can ask the C host to communicate with libcurl for us.
<
var CURLOPT_URL = 10002
Line 395:
return
}
curl.easyCleanup()</
<br>
We now embed this in the following C program, compile and run it.
<
#include <stdio.h>
Line 514:
free(script);
return 0;
}</
=={{header|zkl}}==
Uses libCurl.
<
c.setOpt("SSLCERT","certFile.pem"); c.setOpt("SSLCERTTYPE","pem");
c.get("http://zenkinetic.com"); // lame example to show how to read</
{{omit from|Batch File|Does not have network access.}}
|