Skip to content

nickolasburr/keuka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

keuka

keuka is a utility for analyzing the properties of SSL/TLS handshakes.

There are two installation methods, Homebrew and manual.

brew tap nickolasburr/pfa
brew install keuka

By default, keuka is installed to /usr/local/bin. You can set the prefix variable when running make to specify an alternate path.

make
make install
-b, --bits Show public key length, in bits.
-c, --chain Show peer certificate chain.
-C, --cipher Show cipher negotiated during handshake.
-i, --issuer Show certificate issuer information.
-m, --method Show method negotiated during handshake.
-N, --no-sni Disable SNI support.
-q, --quiet Suppress progress-related output.
-r, --raw Output raw key and certificate contents.
-S, --serial Show certificate serial number.
-A, --signature-algorithm Show certificate signature algorithm.
-s, --subject Show certificate subject.
-V, --validity Show Not Before/Not After validity time range.
-h, --help Show help information and usage examples.
-v, --version Show version information.

keuka provides basic progress and timing information, including context establishment, connection establishment, and handshake initiation and completion.

keuka www.openssl.org
--- [0.000011s] Establishing SSL context.
--- [0.002499s] SSL context established.
--> [0.003232s] Establishing connection to www.openssl.org.
<-- [0.003261s] Connection established.
--- [0.003347s] Attaching SSL session to socket.
--> [0.003362s] SSL session attached, handshake initiated.
<-- [0.007192s] TLSv1.3 negotiated, handshake complete.
keuka --chain --cipher -- www.amazon.com
--- [0.000011s] Establishing SSL context.
--- [0.002810s] SSL context established.
--> [0.003543s] Establishing connection to www.amazon.com.
<-- [0.003567s] Connection established.
--- [0.003675s] Attaching SSL session to socket.
--> [0.003693s] SSL session attached, handshake initiated.
<-- [0.008298s] TLSv1.3 negotiated, handshake complete.

--- Cipher: TLS_AES_128_GCM_SHA256
--- Certificate Chain:
    0: [redacted]
    1: [redacted]
    2: [redacted]
keuka -mA www.google.com
--- [0.000012s] Establishing SSL context.
--- [0.002750s] SSL context established.
--> [0.003358s] Establishing connection to www.google.com.
<-- [0.003396s] Connection established.
--- [0.003547s] Attaching SSL session to socket.
--> [0.003564s] SSL session attached, handshake initiated.
<-- [0.007649s] TLSv1.3 negotiated, handshake complete.

--- Method: TLSv1.3
--- Signature Algorithm: sha256WithRSAEncryption

keuka was built to make extracting key and certificate information simple. Likewise, it can be used with tools such as sed, grep, and cut to fulfill a variety of tasks. Below are a few examples of advanced usage.

keuka -qC www.amazon.com | cut -d' ' -f3
TLS_AES_128_GCM_SHA256
keuka -qV www.ietf.org | tail -n +3 | sed 's/   --- Not After: //g' | awk '{$1=$1};1'
Jun 27 23:59:59 2022 GMT
keuka -qs www.github.com | sed 's/--- Subject: //g' | tr "," "\n" | tail -1
CN=github.com
keuka -qr www.gnu.org | split -p '-----BEGIN CERTIFICATE-----' - keuka-
# -rw-r--r--  1 nickolasburr staff   453 Nov 11 14:24 keuka-aa
# -rw-r--r--  1 nickolasburr staff   453 Nov 11 14:24 keuka-ab

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmEsA2Ma0mA2LR/chNzHq
FUeF8Fw9b8ZSkCbyDfnFFk7imMI9E9GPoRibqWRvbCx9ypYiPu35HwnGeAqzY/fe
oJuLaQ0IXVmJQ8/c18KzFGR8a5KSgwA/lwIbmkdUhQONHHxvAlaAXrb773v8kX0p
s7dvG+Fi2aP5dH8x8H5WO753h1hKhW7xvJgYQ4jL6sFa432Iejfh9OeI24FLDtWj
7AuhcNp8xKfeIBpPYX8+MDYpUEbCUYgAklXi97YBFCBnPyM2wz3tp9EZ223Y2Wls
ais9ut2sPhVnln0pfzimHMzV4yYohEe+DPSyleyvYnAktGSImm/q7l6lPpkDKBQp
bQIDAQAB
-----END PUBLIC KEY-----

-----BEGIN CERTIFICATE-----
MIIKRDCCCSygAwIBAgISAwANCRhgGOkL54Wacj8CsppBMA0GCSqGSIb3DQEBCwUA
MDIxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1MZXQncyBFbmNyeXB0MQswCQYDVQQD
EwJSMzAeFw0yMjA0MTUxMjI0NDJaFw0yMjA3MTQxMjI0N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CQKGM/EGkPy11Ijb/bM3LNN+VDf+dlznQpf6Av
0KCe6HsbayOFIxo3lIkhziM8mIEdrOYKSbvZyRJOffNvifXhvMF2VKDE1g2plqCX
5CroUwEpyfiWRNcr60H25AqX9PVnO2vkhrWZTQVD+zmC/KskVZCLqWuZBQHliasn
jKScAxzYEJrX+fMP07z55Lpb4pROZrvmw11SqVsdgDo2S5baRN7YRg==
-----END CERTIFICATE-----
  1. Specifying --chain without complementary options shows [redacted] per certificate.
  2. Assumes BSD split(1). For GNU split(1), use --filter instead.

> dyld: Library not loaded: /usr/local/opt/openssl/lib/libssl.1.0.0.dylib

This is a known issue on macOS. The most common solution is to switch to an older version of OpenSSL.

Using Homebrew, you can do the following:

brew switch openssl 1.0.2t

See here for more information.