Skip to content

Commit eeebaa1

Browse files
committed
Add readme
1 parent ffe39c1 commit eeebaa1

File tree

6 files changed

+39
-9
lines changed

6 files changed

+39
-9
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ jobs:
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:

.github/workflows/go-release.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff 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

Makefile

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,19 @@ clean:
66

77
.PHONY: pkcs11-proxy-server
88
pkcs11-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
1212
pkcs11-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
1616
pkcs11-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
2020
protoc:
2121
protoc -I proto/ \
22-
--proto_path=${GOPATH}/src \
2322
--go-grpc_out=pkcs11 \
2423
--go_out=pkcs11 \
2524
proto/schema.proto

README.md

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,39 @@
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
213
export PKCS11_PROXY_URI="localhost:8080"
3-
export PKCS11_MODULE="/usr/lib/softhsm/libsofthsm2.so"
4-
14+
# Ca-cert for allowed clients (Optional)
515
export PKCS11_PROXY_CACERT=$(pwd)/ca.crt
16+
# Server cert & key (Optional)
617
export PKCS11_PROXY_KEY=$(pwd)/server.key
718
export 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)
931
export PKCS11_PROXY_CACERT=$(pwd)/ca.crt
32+
# Client cert & key (Optional)
1033
export PKCS11_PROXY_KEY=$(pwd)/client.key
1134
export 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
```

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/ryarnyah/pkcs11-go-proxy
22

3-
go 1.21.3
3+
go 1.22.3
44

55
require (
66
github.com/miekg/pkcs11 v1.1.1

pkcs11/schema.pb.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)