{"id":16737678,"url":"https://github.com/wvengen/scproxy","last_synced_at":"2026-04-01T23:40:39.979Z","repository":{"id":66769276,"uuid":"603422134","full_name":"wvengen/scproxy","owner":"wvengen","description":"Buypass SCProxy for Linux (unofficial)","archived":false,"fork":false,"pushed_at":"2025-08-28T13:09:46.000Z","size":46,"stargazers_count":8,"open_issues_count":2,"forks_count":4,"subscribers_count":2,"default_branch":"main","last_synced_at":"2026-03-27T23:42:40.620Z","etag":null,"topics":["buypass","pcsc","smartcard"],"latest_commit_sha":null,"homepage":"https://buypassdev.atlassian.net/wiki/spaces/Smartkort","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wvengen.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-02-18T13:14:37.000Z","updated_at":"2025-10-31T11:08:31.000Z","dependencies_parsed_at":"2023-02-28T21:15:48.861Z","dependency_job_id":"6d6e74a3-b293-4742-8be2-5bdcd126f034","html_url":"https://github.com/wvengen/scproxy","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/wvengen/scproxy","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvengen%2Fscproxy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvengen%2Fscproxy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvengen%2Fscproxy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvengen%2Fscproxy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wvengen","download_url":"https://codeload.github.com/wvengen/scproxy/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wvengen%2Fscproxy/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31293017,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T21:15:39.731Z","status":"ssl_error","status_checked_at":"2026-04-01T21:15:34.046Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["buypass","pcsc","smartcard"],"created_at":"2024-10-13T00:27:27.014Z","updated_at":"2026-04-01T23:40:39.959Z","avatar_url":"https://github.com/wvengen.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SCProxy for Linux\n\nTo use [Buypass](https://www.buypass.no/) smartcard, one needs a local proxy to\nconnect to the smartcard. This solution is called _SCProxy_ or _Javafri_. The\nproxy [is available](https://www.buypass.no/hjelp/hjelp-til-smartkort/javafri/hvordan-installere-javafri)\nfor Windows and Mac OS, but not for Linux.\n\nThis program is a basic attempt to get it working on Linux. It's not very\npolished, and there are likely to be many corner-cases that aren't handled.\nBut it allows one to log into websites with a Buypass smartcard, and to\nchange the card's PIN.\n\n## Install\n\n1. Install the dependencies:\n\n   - [Python](https://www.python.org) version 3.10 or later\n   - [pyscard](https://pyscard.sourceforge.io/), Python for smart cards\n   - [PC/SC-lite](https://pcsclite.apdu.fr/) daemon, for accessing smart cards\n   - [OpenSSL](https://www.openssl.org/), for generating certificates\n\n   On Debian-based distributions (incl. Ubuntu), you can install them using:\n\n   ```sh\n   apt-get install python3 python3-pyscard pcscd openssl\n   ```\n\n2. Clone this repository\n\n   ```sh\n   git clone https://github.com/wvengen/scproxy\n   cd scproxy\n   ```\n\n3. Generate SSL certificates\n\n   ```sh\n   sh gencerts.sh\n   ```\n\n4. Install root certificate (generated in the previous step)\n\n   For _Firefox_, the steps are:\n   - open the _Preferences_ and activate the _View Certificates_ button;\n   - in the _Authorities_ tab, select _Import_;\n   - choose the file `certs/root.crt` and trust it to identify websites.\n\n5. Add a user-agent switcher to your web browser, you'll need it later.\n\n\nTo let this work out of the box, you may try running\n\n```\nmake \u0026\u0026 sudo make install\n```\n\nWith a bit of luck, this installs the program on your system, and sets it\nup to work with systemd using socket activation.\n\n## Use\n\n1. Start SCProxy.\n\n   Before logging in with Buypass, you need to make sure SCProxy is running.\n   At this moment, you'll need to open a terminal and run\n\n   ```sh\n   python3 scproxy.py\n   ```\n\n   If you've run `make install` as described above, this is done automatically.\n\n2. In the user-agent switcher, select the _Windows_ platform.\n\n3. Make sure you smartcard reader is connected and the Buypass card inserted.\n\n4. Visit the website you want to login with using Buypass smartcard, and do so.\n\n5. At the end, you can switch back to the terminal and press \u003ckbd\u003eCtrl-C\u003c/kbd\u003e\n   to terminate SCProxy. (no need if you ran `make install`)\n\n\n## Socket activation\n\nThis program can also be used with systemd socket activation (based on [this](https://github.com/Spindel/systemd-socketactivation)).\n\nSee `system/` for the unit files. The `Makefile` should setup this all up.\n\nTo test socket activation, you can run\n\n```sh\nsystemd-socket-activate -l 31505 python3 scproxy.py\n```\n\n\n# Links\n\n- [I'm not the only one](https://www.diskusjon.no/topic/1874608-buypass-med-kortleser-i-ubuntu/)\n- [Buypass still recommends the Java plugin on Linux](https://www.diskusjon.no/topic/1874608-buypass-med-kortleser-i-ubuntu/)\n  (great they did support Linux some years ago)\n- [Technical intro of SCProxy](https://buypassdev.atlassian.net/wiki/spaces/Smartkort/pages/16515133/L+sningsbeskrivelse),\n  with [Terminalserver notes](https://buypassdev.atlassian.net/wiki/spaces/Smartkort/pages/26214438/L+sningsbeskrivelse+Terminalserver) (Norwegian)\n- [Troubleshooting SCProxy](https://buypassdev.atlassian.net/wiki/spaces/Smartkort/pages/87228452/Troubleshooting+Buypass+Javafri)\n- [List of sw1 sw2 in smartcards](https://arfan.wordpress.com/2015/08/13/list-of-sw1-sw2-in-smart-card/)\n- ISO 7816-4\n- Sniffing [USB with Wireshark](https://nickvsnetworking.com/sim-card-sniffing-visibility-with-wireshark/) and [decoding ISO 7816-4](https://ludovicrousseau.blogspot.com/2019/08/iso-7816-4-spy-using-wireshark.html)\n\n# Technical notes\n\n## Login process\n\nThe Buypass website makes POST requests to SCProxy, which listens on https://127.0.0.1:31505\n\n1. On page load: `POST /scard/version/` to check if SCProxy is running and its version is supported.\n2. If SCProxy is detected: `POST /scard/list/` to obtain a list of smartcard reader names.\n3. If a reader is found: various `POST /scard/apdu/(:reader_name)` to interact with smartcard.\n4. On success: `POST /sdcard/getref/` to obtain a shared key to obfuscate the PIN with.\n5. After PIN entry, several other `POST /scard/apdu/(:reader_name)` requests.\n6. On success, redirect to service, now authenticated.\n\n`POST /scard/apdu/(:reader_name)` handles communication with the smartcard. It has a JSON request body\nwith APDU commands. Here is a `SELECT MF` (master file) command:\n\n```json\n{\n\"timeout\": 10,\n\"apducommands\": [{ \"apdu\":\"00A40000023F00\" }],\n\"session\": \"0123456789abcdef\"\n}\n```\n\nThe `session` is a random string to avoid concurrent requests to the smartcard interfering with each\nother.\n\nWhen a suitable card is inserted, this would return an OK response:\n\n```json\n{\n\"apduresponses\": [{ \"apdu\":\"9000\" }],\n\"errorcode\": 0,\n\"errordetail\": 0\n}\n```\n\n## Testing\n\nTo play around with the API, you can use [curl](https://curl.se) e.g. as follows:\n\n```sh\ncurl --insecure -H 'Sec-Fetch-Mode: cors' -H 'Origin: https://secure.buypass.no' \\\n     --data-raw '' https://127.0.0.1:31505/scard/list/\n```\n\n# License\n\nThis program is licensed under the [GNU GPL v3 or later](LICENSE.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvengen%2Fscproxy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwvengen%2Fscproxy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwvengen%2Fscproxy/lists"}