Last active
October 9, 2024 12:50
-
-
Save snyderra/0dcfa4cec3deef1dffdd4b626d8a773a to your computer and use it in GitHub Desktop.
Smart Card Curl on Macos
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #sudo port install opensc | |
| #sudo port install curl | |
| #sudo port install libp11 | |
| export OPENSSL_CONF=$(mktemp) | |
| cat << EOF > $OPENSSL_CONF | |
| openssl_conf = openssl_init | |
| [openssl_init] | |
| engines=engine_section | |
| [engine_section] | |
| pkcs11 = pkcs11_section | |
| [pkcs11_section] | |
| engine_id = pkcs11 | |
| dynamic_path = /opt/local/libexec/openssl3/lib/engines-3/pkcs11.dylib | |
| MODULE_PATH = /opt/local/lib/opensc-pkcs11.so | |
| init = 0 | |
| EOF | |
| # replace <pin> with smart card pin or remove ";pin-value=<pin>" to be prompted | |
| curl --engine pkcs11 \ | |
| -E "pkcs11:id=%01;pin-value=<pin>" \ | |
| --key "pkcs11:id=%01;pin-value=<pin>" \ | |
| --request POST \ | |
| https://example.com |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment