Skip to content

Instantly share code, notes, and snippets.

@tolgahanakgun
Created February 22, 2020 09:48
Show Gist options
  • Save tolgahanakgun/8e3537e2517c75b31b6f9fb4241f0f93 to your computer and use it in GitHub Desktop.
Save tolgahanakgun/8e3537e2517c75b31b6f9fb4241f0f93 to your computer and use it in GitHub Desktop.
Test clients for CoAP compatible DTLS clients in GnuTLS and OpenSSL
Server is tinydtls, compiled with both Raw Public Key and PSK support, version 0.8.6
psk_identity=Client_identity
psk_key=secretPSK
# psk in hex form
psk_key=73656372657450534b
# start tinydtls server
./dtls-server -v 6
# generate a secp256r1(prime256v1 or Nist 256-p) private and public key
# private key generation
openssl ecparam -name prime256v1 -genkey -noout -out private.pem
# public key generation
openssl ec -in private.pem -pubout -out public.pem
# GnuTLS supports both PSK and Raw Public Key certificates
gnutls-cli --rawpkkeyfile=private.pem --rawpkfile=public.pem -u -p 20220 --priority NONE:+VERS-DTLS1.2:+AES-128-CCM-8:+MAC-ALL:+SIGN-ECDSA-SHA256:+ECDHE-ECDSA:+PSK:+GROUP-SECP256R1:+CTYPE-RAWPK:%NO_TICKETS:%NO_SESSION_HASH --no-ca-verification --pskusername Client_identity --pskkey 73656372657450534b 127.0.0.1
# OpenSSL supports only PSK
openssl s_client -dtls1_2 -connect 127.0.0.1:20220 -cipher PSK-AES128-CCM8 -psk_identity Client_identity -psk 73656372657450534b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment