File tree Expand file tree Collapse file tree 6 files changed +39
-9
lines changed
Expand file tree Collapse file tree 6 files changed +39
-9
lines changed Original file line number Diff line number Diff line change 1212 runs-on : ubuntu-latest
1313 steps :
1414 - uses : actions/checkout@v2
15+ with :
16+ submodules : ' true'
1517 - name : Setup Go
1618 uses : actions/setup-go@v2
1719 with :
Original file line number Diff line number Diff line change @@ -11,10 +11,12 @@ jobs:
1111 runs-on : ubuntu-latest
1212 steps :
1313 - uses : actions/checkout@v2
14+ with :
15+ submodules : ' true'
1416 - name : Setup Go
1517 uses : actions/setup-go@v2
1618 with :
17- go-version : ' 1.20 '
19+ go-version : ' 1.22 '
1820 - name : Install protoc
1921 run : |
2022 sudo apt-get update && sudo apt-get install gcc-multilib nodejs npm curl unzip -y
Original file line number Diff line number Diff line change 66
77.PHONY : pkcs11-proxy-server
88pkcs11-proxy-server : protoc
9- go build -o pkcs11-proxy-server ./cmd/server
9+ go build -buildvcs=false - o pkcs11-proxy-server ./cmd/server
1010
1111.PHONY : pkcs11-proxy-server.exe
1212pkcs11-proxy-server.exe : protoc
13- CGO_ENABLED=1 CC=/usr/bin/x86_64-w64-mingw32-gcc GOOS=windows go build -o pkcs11-proxy-server.exe ./cmd/server
13+ CGO_ENABLED=1 CC=/usr/bin/x86_64-w64-mingw32-gcc GOOS=windows go build -buildvcs=false - o pkcs11-proxy-server.exe ./cmd/server
1414
1515.PHONY : pkcs11-proxy-module.so
1616pkcs11-proxy-module.so : protoc init
17- go build -o pkcs11-proxy-module.so -buildmode=c-shared ./cmd/module
17+ go build -o pkcs11-proxy-module.so -buildvcs=false - buildmode=c-shared ./cmd/module
1818
1919.PHONY : protoc
2020protoc :
2121 protoc -I proto/ \
22- --proto_path=${GOPATH} /src \
2322 --go-grpc_out=pkcs11 \
2423 --go_out=pkcs11 \
2524 proto/schema.proto
Original file line number Diff line number Diff line change 1+ # Simple PKCS #11 module proxy over GRPC
2+
3+ Can be used to make a bridge with PKCS #11 windows-only module to use it on linux.
4+
5+ ## Usage
6+ ### Generate certs
7+ ``` bash
8+ ./generate-keys.sh
9+ ```
10+ ### Server
111``` bash
12+ # Bind address
213export PKCS11_PROXY_URI=" localhost:8080"
3- export PKCS11_MODULE=" /usr/lib/softhsm/libsofthsm2.so"
4-
14+ # Ca-cert for allowed clients (Optional)
515export PKCS11_PROXY_CACERT=$( pwd) /ca.crt
16+ # Server cert & key (Optional)
617export PKCS11_PROXY_KEY=$( pwd) /server.key
718export PKCS11_PROXY_CERT=$( pwd) /server.crt
19+ # Start server
20+ ./pkcs11-proxy-server
21+ ```
822
23+ ### Client
24+ ``` bash
25+ # Dial address of server
26+ export PKCS11_PROXY_URI=" localhost:8080"
27+ # Module to use on server (must be present only on server host)
28+ export PKCS11_MODULE=" /usr/lib/softhsm/libsofthsm2.so"
29+
30+ # Ca-cert for trusted server (Optional)
931export PKCS11_PROXY_CACERT=$( pwd) /ca.crt
32+ # Client cert & key (Optional)
1033export PKCS11_PROXY_KEY=$( pwd) /client.key
1134export PKCS11_PROXY_CERT=$( pwd) /client.crt
35+
36+ # Example usage on client
37+ p11tool --provider=$( pwd) /pkcs11-proxy-module.so --generate-random=256
38+ p11tool --provider=$( pwd) /pkcs11-proxy-module.so --list-mechanisms
1239```
Original file line number Diff line number Diff line change 11module github.com/ryarnyah/pkcs11-go-proxy
22
3- go 1.21 .3
3+ go 1.22 .3
44
55require (
66 github.com/miekg/pkcs11 v1.1.1
You can’t perform that action at this time.
0 commit comments