diff options
author | Michał Zieliński <michal@zielinscy.org.pl> | 2015-10-24 08:53:18 +0200 |
---|---|---|
committer | Michał Zieliński <michal@zielinscy.org.pl> | 2015-10-24 22:17:31 +0200 |
commit | ba61a8d00a65948fc0b3a1c100a20cca711fdd0f (patch) | |
tree | e160d0a04edec991e2dbb02dd1724a5302ed7347 /examples/ssl/pskclient.nim | |
parent | 3ebf27ddd24c04e87e33bfb6f8617d81c9fc1946 (diff) | |
download | Nim-ba61a8d00a65948fc0b3a1c100a20cca711fdd0f.tar.gz |
net.nim: support for TLS-PSK ciphersuites
Diffstat (limited to 'examples/ssl/pskclient.nim')
-rw-r--r-- | examples/ssl/pskclient.nim | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/ssl/pskclient.nim b/examples/ssl/pskclient.nim new file mode 100644 index 000000000..7c93bbb61 --- /dev/null +++ b/examples/ssl/pskclient.nim @@ -0,0 +1,15 @@ +# Create connection encrypted using preshared key (TLS-PSK). +import net + +static: assert defined(ssl) + +let sock = newSocket() +sock.connect("localhost", Port(8800)) + +proc clientFunc(identityHint: string): tuple[identity: string, psk: string] = + echo "identity hint ", identityHint.repr + return ("foo", "psk-of-foo") + +let context = newContext(cipherList="PSK-AES256-CBC-SHA") +context.clientGetPskFunc = clientFunc +context.wrapConnectedSocket(sock, handshakeAsClient) |